GHSA-87mf-9wg6-ppf8: Ouroboros Ouroboros Is Unsound Vulnerability

MODERATE
Published
Advisory Summary

GHSA-87mf-9wg6-ppf8 is a MODERATE ouroboros is unsound vulnerability (General Security Weakness) affecting Ouroboros libraries in the crates.io ecosystem. The issue involves ouroboros is unsound. Remediation is available by upgrading affected packages to version 0.16.0.

GHSA-87mf-9wg6-ppf8 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-87mf-9wg6-ppf8
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product Ouroboros
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix GHSA-87mf-9wg6-ppf8

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

ouroboros fixed: 0.16.0
Upgrade ouroboros to 0.16.0
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 ouroboros

How to Check if You Are Affected

To determine whether your application is affected by GHSA-87mf-9wg6-ppf8, inspect your project dependencies for Ouroboros:

inspect dependencies for ouroboros

Analyze the terminal output to locate any version of Ouroboros in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.16.0), 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 General Security Weakness. In Ouroboros, 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

In 0.15.0 and prior, Ouroboros works internally by creating a struct where all uses of 'this are replaced by 'static. However, a recent addition to Miri checks that references passed to functions are valid during the entire execution of the function, even when those references are passed inside a struct. This poses an issue for dropping self-referencing values, as the reference becomes invalid during the dropping process. Effectively, since self-referencing structs are not allowed in vanilla Rust, there is no allowance for dropping data during a function that has also been given a reference to that data. There's usually no way to pass a and &a to the same function. A fix was attempted, where the struct would be turned in to a raw byte array and only transformed back into the underlying data type inside each function. This is allowable as a reference can be created and die over the body of a function, as long as the reference was created inside the function. However, this is also not sound if the original struct contains padding. There is no way to initialize padding bytes to a known value that Miri will accept, so when it is cast to an array some of the bytes contain uninitialized values. This is not acceptable (despite the fact that these bytes are never read) due to the potential for optimizations that may read from the uninitialized bytes. Besides which, this fix does not allow for template or constant parameters as there is no way to check the size of a templated type without giving specific, concrete values for the template parameters. The final solution was to use this fix while wrapping the raw byte array in MaybeUninit<>.

GHSA-87mf-9wg6-ppf8 Affected Ouroboros Versions

1 component(s)
Fixed Versions:
0.16.0
Product / Package Ecosystem Affected Versions Fixed Version
ouroboros
crates.io
< 0.16.0
0.16.0

References

Frequently Asked Questions

What is GHSA-87mf-9wg6-ppf8?
GHSA-87mf-9wg6-ppf8 is a security vulnerability in Ouroboros involving Ouroboros is Unsound under General Security Weakness.
Which Ouroboros versions are affected?
Affected versions include releases prior to 0.16.0 across affected packages: ouroboros.
What version fixes GHSA-87mf-9wg6-ppf8?
Upgrading to 0.16.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is ouroboros affected?
Yes, ouroboros is affected in releases prior to 0.16.0. Upgrade your dependency to 0.16.0 or later.
What CWE is associated with GHSA-87mf-9wg6-ppf8?
GHSA-87mf-9wg6-ppf8 is classified under General Security Weakness.
How can I check crates.io dependencies for GHSA-87mf-9wg6-ppf8?
Run the dependency tree command: 'inspect dependencies for ouroboros'. 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-87mf-9wg6-ppf8",
  "modified" : "2023-06-16T17:45:05Z",
  "published" : "2023-06-12T18:52:23Z",
  "aliases" : [ ],
  "summary" : "Ouroboros is Unsound",
  "details" : "In 0.15.0 and prior, Ouroboros works internally by creating a struct where all uses of 'this are replaced by 'static. However, a recent addition to Miri checks that references passed to functions are valid during the entire execution of the function, even when those references are passed inside a struct. This poses an issue for dropping self-referencing values, as the reference becomes invalid during the dropping process. Effectively, since self-referencing structs are not allowed in vanilla Rust, there is no allowance for dropping data during a function that has also been given a reference to that data. There's usually no way to pass a and &a to the same function.\n\nA fix was attempted, where the struct would be turned in to a raw byte array and only transformed back into the underlying data type inside each function. This is allowable as a reference can be created and die over the body of a function, as long as the reference was created inside the function. However, this is also not sound if the original struct contains padding. There is no way to initialize padding bytes to a known value that Miri will accept, so when it is cast to an array some of the bytes contain uninitialized values. This is not acceptable (despite the fact that these bytes are never read) due to the potential for optimizations that may read from the uninitialized bytes. Besides which, this fix does not allow for template or constant parameters as there is no way to check the size of a templated type without giving specific, concrete values for the template parameters.\n\nThe final solution was to use this fix while wrapping the raw byte array in MaybeUninit<>.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "ouroboros"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.16.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/joshua-maros/ouroboros/issues/88"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/joshua-maros/ouroboros"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2023-0042.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-06-12T18:52:23Z",
    "nvd_published_at" : null
  }
}