CVE-2021-43620: Fruity Improper Input Validation Vulnerability

HIGH
Advisory Identifier: GHSA-h352-g5vw-3926
CVSS 7.5
CWE-20
Published
Advisory Summary

CVE-2021-43620 is a HIGH (CVSS 7.5) improper input validation vulnerability (CWE-20: Improper Input Validation) affecting Fruity libraries in the crates.io ecosystem. The issue involves improper input validation in fruity. Remediation is available by upgrading affected packages to version 0.3.0.

CVE-2021-43620 at a Glance

CVE Identifier CVE-2021-43620
GHSA Identifier GHSA-h352-g5vw-3926
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-20: Improper Input Validation
Affected Product Fruity
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 7.5

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

How to Fix CVE-2021-43620

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

fruity fixed: 0.3.0
Upgrade fruity to 0.3.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 fruity

How to Check if You Are Affected

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

inspect dependencies for fruity

Analyze the terminal output to locate any version of Fruity in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.3.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 CWE-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Fruity, 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

Methods of NSString for conversion to a string may return a partial result. Since they call CStr::from_ptr on a pointer to the string buffer, the string is terminated at the first null byte, which might not be the end of the string. In addition to the vulnerable functions listed for this issue, the implementations of Display, PartialEq, PartialOrd, and ToString for NSString are also affected, since they call those functions. Since NSString is commonly used as the type for paths by the Foundation framework, null byte truncation might allow for easily bypassing file extension checks. For example, if a file name is provided by a user and validated to have one of a specific set of extensions, with validation taking place before truncation, an attacker can add an accepted extension after a null byte (e.g., file.exe\0.txt). After truncation, the file name used by the application would be file.exe. It would be better to generate unique names for files, instead of using user-provided names, but not all applications take this approach.

CVE-2021-43620 Affected Fruity Versions

1 component(s)
Fixed Versions:
0.3.0
Product / Package Ecosystem Affected Versions Fixed Version
fruity
crates.io
≥ 0.1.0
< 0.3.0
0.3.0

References

Frequently Asked Questions

What is CVE-2021-43620?
CVE-2021-43620 is a security vulnerability in Fruity involving Improper Input Validation in fruity under CWE-20: Improper Input Validation.
Which Fruity versions are affected?
Affected versions include releases prior to 0.3.0 across affected packages: fruity.
What version fixes CVE-2021-43620?
Upgrading to 0.3.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is fruity affected?
Yes, fruity is affected in releases prior to 0.3.0. Upgrade your dependency to 0.3.0 or later.
What is the CVSS score of CVE-2021-43620?
CVE-2021-43620 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N.
What CWE is associated with CVE-2021-43620?
CVE-2021-43620 is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check crates.io dependencies for CVE-2021-43620?
Run the dependency tree command: 'inspect dependencies for fruity'. 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-h352-g5vw-3926",
  "modified" : "2023-06-13T17:27:02Z",
  "published" : "2021-11-16T17:26:47Z",
  "aliases" : [ "CVE-2021-43620" ],
  "summary" : "Improper Input Validation in fruity",
  "details" : "Methods of NSString for conversion to a string may return a partial result. Since they call CStr::from_ptr on a pointer to the string buffer, the string is terminated at the first null byte, which might not be the end of the string.\n\nIn addition to the vulnerable functions listed for this issue, the implementations of Display, PartialEq, PartialOrd, and ToString for NSString are also affected, since they call those functions.\n\nSince NSString is commonly used as the type for paths by the Foundation framework, null byte truncation might allow for easily bypassing file extension checks. For example, if a file name is provided by a user and validated to have one of a specific set of extensions, with validation taking place before truncation, an attacker can add an accepted extension after a null byte (e.g., file.exe\\0.txt). After truncation, the file name used by the application would be file.exe.\n\nIt would be better to generate unique names for files, instead of using user-provided names, but not all applications take this approach.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "fruity"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.1.0"
      }, {
        "fixed" : "0.3.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-43620"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nvzqz/fruity/issues/14"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rustsec/advisory-db/pull/1102"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/nvzqz/fruity"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2021-0123.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-11-16T15:32:42Z",
    "nvd_published_at" : "2021-11-15T05:15:00Z"
  }
}