CVE-2021-26954: Qwutils Insert_slice_clone Can Double Drop If Vulnerability

MODERATE
Advisory Identifier: GHSA-68p4-pjpf-xwcq
CVSS 5.3
CWE-415
Published
Advisory Summary

CVE-2021-26954 is a MODERATE (CVSS 5.3) insert_slice_clone can double drop if vulnerability (CWE-415: Double Free) affecting Qwutils libraries in the crates.io ecosystem. The issue involves insert_slice_clone can double drop if clone panics.. Remediation is available by upgrading affected packages to version 0.3.1.

CVE-2021-26954 at a Glance

CVE Identifier CVE-2021-26954
GHSA Identifier GHSA-68p4-pjpf-xwcq
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-415: Double Free
Affected Product Qwutils
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 5.3

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:N/I:N/A:L).

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 None (C:N)
Integrity None (I:N)
Availability Low (A:L)

How to Fix CVE-2021-26954

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

qwutils fixed: 0.3.1
Upgrade qwutils to 0.3.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 qwutils

How to Check if You Are Affected

To determine whether your application is affected by CVE-2021-26954, inspect your project dependencies for Qwutils:

inspect dependencies for qwutils

Analyze the terminal output to locate any version of Qwutils in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.3.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-415: Double Free, where the product calls free() twice on the same memory address. In Qwutils, 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 used ptr::copy when inserting into the middle of a Vec. When ownership was temporarily duplicated during this copy, it calls the clone method of a user provided element. This issue can result in an element being double-freed if the clone call panics. Commit `20cb73d` fixed this issue by adding a set_len(0) call before operating on the vector to avoid dropping the elements during a panic.

CVE-2021-26954 Affected Qwutils Versions

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

References

Frequently Asked Questions

What is CVE-2021-26954?
CVE-2021-26954 is a security vulnerability in Qwutils involving insert_slice_clone can double drop if Clone panics. under CWE-415: Double Free.
Which Qwutils versions are affected?
Affected versions include releases prior to 0.3.1 across affected packages: qwutils.
What version fixes CVE-2021-26954?
Upgrading to 0.3.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is qwutils affected?
Yes, qwutils is affected in releases prior to 0.3.1. Upgrade your dependency to 0.3.1 or later.
What is the CVSS score of CVE-2021-26954?
CVE-2021-26954 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L.
What CWE is associated with CVE-2021-26954?
CVE-2021-26954 is classified under CWE-415: Double Free (The product calls free() twice on the same memory address.).
How can I check crates.io dependencies for CVE-2021-26954?
Run the dependency tree command: 'inspect dependencies for qwutils'. 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-68p4-pjpf-xwcq",
  "modified" : "2023-06-13T20:09:07Z",
  "published" : "2022-05-24T17:41:47Z",
  "aliases" : [ "CVE-2021-26954" ],
  "summary" : "insert_slice_clone can double drop if Clone panics.",
  "details" : "Affected versions of this crate used ptr::copy when inserting into the middle of a Vec. When ownership was temporarily duplicated during this copy, it calls the clone method of a user provided element.\n\nThis issue can result in an element being double-freed if the clone call panics.\n\nCommit `20cb73d` fixed this issue by adding a set_len(0) call before operating on the vector to avoid dropping the elements during a panic.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "qwutils"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.3.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-26954"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/qwertz19281/rust_utils/issues/3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/qwertz19281/rust_utils/commit/20cb73d"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/qwertz19281/rust_utils"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2021-0018.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-415" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-06-17T00:14:33Z",
    "nvd_published_at" : "2021-02-09T23:15:00Z"
  }
}