CVE-2023-28638: Snappier Snappier Vulnerable To Buffer Overrun Vulnerability

HIGH
Advisory Identifier: GHSA-838x-pcvx-6p5w
CVSS 7.0
CWE-119
Published
Advisory Summary

CVE-2023-28638 is a HIGH (CVSS 7.0) snappier vulnerable to buffer overrun vulnerability (CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer) affecting Snappier libraries in the NuGet ecosystem. The issue involves snappier vulnerable to buffer overrun due to improper restriction of operations within the bounds of a memory buffer. Remediation is available by upgrading affected packages to version 1.1.1.

CVE-2023-28638 at a Glance

CVE Identifier CVE-2023-28638
GHSA Identifier GHSA-838x-pcvx-6p5w
Severity HIGH
CVSS v3.1 Base Score 7.0
CWE Classification CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer
Affected Product Snappier
Package Ecosystem NuGet
Published Date
Last Updated

Security Impact

CVSS: 7.0

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

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

How to Fix CVE-2023-28638

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

Snappier fixed: 1.1.1
Upgrade Snappier to 1.1.1
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 Snappier

How to Check if You Are Affected

To determine whether your application is affected by CVE-2023-28638, inspect your project dependencies for Snappier:

inspect dependencies for Snappier

Analyze the terminal output to locate any version of Snappier in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.1.1), 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-119: Improper Restriction of Operations within the Bounds of a Memory Buffer, where the product performs operations on a memory buffer, but it reads from or writes to a memory location outside the buffer's intended boundary. this may result in read or write operations on unexpected memory locations that could be linked to other variables, data structures, or internal program data. In Snappier, 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

### Impact This is a buffer overrun vulnerability that can affect any user of Snappier 1.1.0. In this release, much of the code was rewritten to use byte references rather than pointers to pinned buffers. This change generally improves performance and reduces workload on the garbage collector. However, when the garbage collector performs compaction and rearranges memory, it must update any byte references on the stack to refer to the updated location. The .NET garbage collector can only update these byte references if they still point within the buffer or to a point one byte past the end of the buffer. If they point outside this area, the buffer itself may be moved while the byte reference stays the same. There are several places in 1.1.0 where byte references very briefly point outside the valid areas of buffers. These are at locations in the code being used for buffer range checks. While the invalid references are never dereferenced directly, if a GC compaction were to occur during the brief window when they are on the stack then it could invalidate the buffer range check and allow other operations to overrun the buffer. This should be very difficult for an attacker to trigger intentionally. It would require a repetitive bulk attack with the hope that a GC compaction would occur at precisely the right moment during one of the requests. However, one of the range checks with this problem is a check based on input data in the decompression buffer, meaning malformed input data could be used to increase the chance of success. Note that any resulting buffer overrun is likely to cause access to protected memory, which will then cause an exception and the process to be terminated. Therefore, the most likely result of an attack is a denial of service. ### Patches This is patched in release 1.1.1. ### Workarounds Pinning any buffers to a fixed location before using them for compression or decompression should mitigate some, but not all, of these cases. At least one temporary decompression buffer is internal to the library and never pinned.

CVE-2023-28638 Affected Snappier Versions

1 component(s)
Fixed Versions:
1.1.1
Product / Package Ecosystem Affected Versions Fixed Version
Snappier
NuGet
≥ 1.1.0
< 1.1.1
All 1 versions
1.1.0
1.1.1

References

Frequently Asked Questions

What is CVE-2023-28638?
CVE-2023-28638 is a security vulnerability in Snappier involving Snappier vulnerable to buffer overrun due to improper restriction of operations within the bounds of a memory buffer under CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer.
Which Snappier versions are affected?
Affected versions include releases prior to 1.1.1 across affected packages: Snappier.
What version fixes CVE-2023-28638?
Upgrading to 1.1.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is Snappier affected?
Yes, Snappier is affected in releases prior to 1.1.1. Upgrade your dependency to 1.1.1 or later.
What is the CVSS score of CVE-2023-28638?
CVE-2023-28638 has a CVSS v3.1 base score of 7.0 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:H.
What CWE is associated with CVE-2023-28638?
CVE-2023-28638 is classified under CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer (The product performs operations on a memory buffer, but it reads from or writes to a memory location outside the buffer's intended boundary. This may result in read or write operations on unexpected memory locations that could be linked to other variables, data structures, or internal program data.).
How can I check NuGet dependencies for CVE-2023-28638?
Run the dependency tree command: 'inspect dependencies for Snappier'. 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-838x-pcvx-6p5w",
  "modified" : "2023-03-27T22:23:43Z",
  "published" : "2023-03-27T22:23:43Z",
  "aliases" : [ "CVE-2023-28638" ],
  "summary" : "Snappier vulnerable to buffer overrun due to improper restriction of operations within the bounds of a memory buffer",
  "details" : "### Impact\nThis is a buffer overrun vulnerability that can affect any user of Snappier 1.1.0. In this release, much of the code was rewritten to use byte references rather than pointers to pinned buffers. This change generally improves performance and reduces workload on the garbage collector. However, when the garbage collector performs compaction and rearranges memory, it must update any byte references on the stack to refer to the updated location. The .NET garbage collector can only update these byte references if they still point within the buffer or to a point one byte past the end of the buffer. If they point outside this area, the buffer itself may be moved while the byte reference stays the same.\n\nThere are several places in 1.1.0 where byte references very briefly point outside the valid areas of buffers. These are at locations in the code being used for buffer range checks. While the invalid references are never dereferenced directly, if a GC compaction were to occur during the brief window when they are on the stack then it could invalidate the buffer range check and allow other operations to overrun the buffer.\n\nThis should be very difficult for an attacker to trigger intentionally. It would require a repetitive bulk attack with the hope that a GC compaction would occur at precisely the right moment during one of the requests. However, one of the range checks with this problem is a check based on input data in the decompression buffer, meaning malformed input data could be used to increase the chance of success.\n\nNote that any resulting buffer overrun is likely to cause access to protected memory, which will then cause an exception and the process to be terminated. Therefore, the most likely result of an attack is a denial of service.\n\n### Patches\nThis is patched in release 1.1.1.\n\n### Workarounds\nPinning any buffers to a fixed location before using them for compression or decompression should mitigate some, but not all, of these cases. At least one temporary decompression buffer is internal to the library and never pinned.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "NuGet",
      "name" : "Snappier"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.1.0"
      }, {
        "fixed" : "1.1.1"
      } ]
    } ],
    "versions" : [ "1.1.0" ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/brantburnett/Snappier/security/advisories/GHSA-838x-pcvx-6p5w"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-28638"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/brantburnett/Snappier/pull/73"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/brantburnett/Snappier/commit/d7ac5267b5b18439e6d108f8138edf48c436b32f"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/brantburnett/Snappier"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/brantburnett/Snappier/releases/tag/release%2F1.1.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-119" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-03-27T22:23:43Z",
    "nvd_published_at" : "2023-03-27T21:15:00Z"
  }
}