CVE-2018-20995: Slice deque Memory Corruption Slice-deque Vulnerability

CRITICAL
Advisory Identifier: GHSA-hr3c-6mmp-6m39
CVSS 9.8
CWE-119
Published
Advisory Summary

CVE-2018-20995 is a CRITICAL (CVSS 9.8) memory corruption slice-deque vulnerability (CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer) affecting Slice deque libraries in the crates.io ecosystem. The issue involves memory corruption slice-deque. Remediation is available by upgrading affected packages to version 0.1.16.

CVE-2018-20995 at a Glance

CVE Identifier CVE-2018-20995
GHSA Identifier GHSA-hr3c-6mmp-6m39
Severity CRITICAL
CVSS v3.1 Base Score 9.8
CWE Classification CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer
Affected Product Slice deque
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 9.8

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

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 High (A:H)

How to Fix CVE-2018-20995

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

slice-deque fixed: 0.1.16
Upgrade slice-deque to 0.1.16
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 slice-deque

How to Check if You Are Affected

To determine whether your application is affected by CVE-2018-20995, inspect your project dependencies for Slice deque:

inspect dependencies for slice-deque

Analyze the terminal output to locate any version of Slice deque in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.1.16), 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 Slice deque, 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 this crate did not properly update the head and tail of the deque when inserting and removing elements from the front if, before insertion or removal, the tail of the deque was in the mirrored memory region, and if, after insertion or removal, the head of the deque is exactly at the beginning of the mirrored memory region. An attacker that controls both element insertion and removal into the deque could put it in a corrupted state. Once the deque enters such an state, its head and tail are corrupted, but in bounds of the allocated memory. This can result in partial reads and writes, reads of uninitialized memory, reads of memory containing previously dropped objects, etc. An attacker could exploit this to alter program execution. The flaw was corrected by properly updating the head and tail of the deque in this case.

CVE-2018-20995 Affected Slice deque Versions

1 component(s)
Fixed Versions:
0.1.16
Product / Package Ecosystem Affected Versions Fixed Version
slice-deque
crates.io
< 0.1.16
0.1.16

References

Frequently Asked Questions

What is CVE-2018-20995?
CVE-2018-20995 is a security vulnerability in Slice deque involving Memory corruption slice-deque under CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer.
Which Slice deque versions are affected?
Affected versions include releases prior to 0.1.16 across affected packages: slice-deque.
What version fixes CVE-2018-20995?
Upgrading to 0.1.16 (or the latest patched release for your respective branch) resolves the vulnerability.
Is slice-deque affected?
Yes, slice-deque is affected in releases prior to 0.1.16. Upgrade your dependency to 0.1.16 or later.
What is the CVSS score of CVE-2018-20995?
CVE-2018-20995 has a CVSS v3.1 base score of 9.8 (CRITICAL) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2018-20995?
CVE-2018-20995 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 crates.io dependencies for CVE-2018-20995?
Run the dependency tree command: 'inspect dependencies for slice-deque'. 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-hr3c-6mmp-6m39",
  "modified" : "2023-06-13T20:55:45Z",
  "published" : "2021-08-25T20:42:57Z",
  "aliases" : [ "CVE-2018-20995" ],
  "summary" : "Memory corruption slice-deque",
  "details" : "Affected versions of this crate did not properly update the head and tail of the deque when inserting and removing elements from the front if, before insertion or removal, the tail of the deque was in the mirrored memory region, and if, after insertion or removal, the head of the deque is exactly at the beginning of the mirrored memory region.\n\nAn attacker that controls both element insertion and removal into the deque could put it in a corrupted state. Once the deque enters such an state, its head and tail are corrupted, but in bounds of the allocated memory. This can result in partial reads and writes, reads of uninitialized memory, reads of memory containing previously dropped objects, etc. An attacker could exploit this to alter program execution.\n\nThe flaw was corrected by properly updating the head and tail of the deque in this case.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "slice-deque"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.1.16"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2018-20995"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/gnzlbg/slice_deque/issues/57"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/gnzlbg/slice_deque"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2018-0008.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-119" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-08-19T21:25:30Z",
    "nvd_published_at" : null
  }
}