CVE-2020-25016: Rgb Out Of Bounds Access Vulnerability

CRITICAL
Advisory Identifier: GHSA-g4rw-8m5q-6453
CVSS 9.1
CWE-843 CWE-119
Published
Advisory Summary

CVE-2020-25016 is a CRITICAL (CVSS 9.1) out of bounds access vulnerability (CWE-843: Access of Resource Using Incompatible Type ('Type Confusion')) affecting Rgb libraries in the crates.io ecosystem. The issue involves out of bounds access in rgb. Remediation is available by upgrading affected packages to version 0.8.20.

CVE-2020-25016 at a Glance

CVE Identifier CVE-2020-25016
GHSA Identifier GHSA-g4rw-8m5q-6453
Severity CRITICAL
CVSS v3.1 Base Score 9.1
CWE Classification CWE-843: Access of Resource Using Incompatible Type ('Type Confusion')
Affected Product Rgb
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 9.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2020-25016

To remediate this vulnerability, upgrade all affected Rgb dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

rgb fixed: 0.8.20
Upgrade rgb to 0.8.20
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for rgb

How to Check if You Are Affected

To determine whether your application is affected by CVE-2020-25016, inspect your project dependencies for Rgb:

inspect dependencies for rgb

Analyze the terminal output to locate any version of Rgb in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.8.20), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-843: Access of Resource Using Incompatible Type ('Type Confusion'), where the product allocates or initializes a resource such as a pointer, object, or variable using one type, but it later accesses that resource using a type that is incompatible with the original type. In Rgb, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

Affected versions of rgb crate allow viewing and modifying data of any type T wrapped in RGB<T> as bytes, and do not correctly constrain RGB<T> and other wrapper structures to the types for which it is safe to do so. Safety violation possible for a type wrapped in RGB<T> and similar wrapper structures: * If T contains padding, viewing it as bytes may lead to exposure of contents of uninitialized memory. * If T contains a pointer, modifying it as bytes may lead to dereferencing of arbitrary pointers. * Any safety and/or validity invariants for T may be violated. The issue was resolved by requiring all types wrapped in structures provided by RGB crate to implement an unsafe marker trait.

CVE-2020-25016 Affected Rgb Versions

1 component(s)
Fixed Versions:
0.8.20
Product / Package Ecosystem Affected Versions Fixed Version
rgb
crates.io
≥ 0.5.4
< 0.8.20
0.8.20

References

Frequently Asked Questions

What is CVE-2020-25016?
CVE-2020-25016 is a security vulnerability in Rgb involving Out of bounds access in rgb under CWE-843: Access of Resource Using Incompatible Type ('Type Confusion').
Which Rgb versions are affected?
Affected versions include releases prior to 0.8.20 across affected packages: rgb.
What version fixes CVE-2020-25016?
Upgrading to 0.8.20 (or the latest patched release for your respective branch) resolves the vulnerability.
Is rgb affected?
Yes, rgb is affected in releases prior to 0.8.20. Upgrade your dependency to 0.8.20 or later.
What is the CVSS score of CVE-2020-25016?
CVE-2020-25016 has a CVSS v3.1 base score of 9.1 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N.
What CWE is associated with CVE-2020-25016?
CVE-2020-25016 is classified under CWE-843: Access of Resource Using Incompatible Type ('Type Confusion') (The product allocates or initializes a resource such as a pointer, object, or variable using one type, but it later accesses that resource using a type that is incompatible with the original type.).
How can I check crates.io dependencies for CVE-2020-25016?
Run the dependency tree command: 'inspect dependencies for rgb'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-g4rw-8m5q-6453",
  "modified" : "2023-06-13T20:26:14Z",
  "published" : "2021-08-25T20:45:12Z",
  "aliases" : [ "CVE-2020-25016" ],
  "summary" : "Out of bounds access in rgb",
  "details" : "Affected versions of rgb crate allow viewing and modifying data of any type T wrapped in RGB<T> as bytes, and do not correctly constrain RGB<T> and other wrapper structures to the types for which it is safe to do so.\n\nSafety violation possible for a type wrapped in RGB<T> and similar wrapper structures:\n\n* If T contains padding, viewing it as bytes may lead to exposure of contents of uninitialized memory.\n* If T contains a pointer, modifying it as bytes may lead to dereferencing of arbitrary pointers.\n* Any safety and/or validity invariants for T may be violated.\n\nThe issue was resolved by requiring all types wrapped in structures provided by RGB crate to implement an unsafe marker trait.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "rgb"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.5.4"
      }, {
        "fixed" : "0.8.20"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-25016"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/kornelski/rust-rgb/issues/35"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/kornelski/rust-rgb"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2020-0029.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-119", "CWE-843" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-08-19T21:21:37Z",
    "nvd_published_at" : null
  }
}