CVE-2021-4287: Binwalk Binwalk Vulnerable To UNIX Symbolic Vulnerability

MODERATE
Advisory Identifier: GHSA-8m3f-g62j-3vx8
CVSS 6.5
CWE-59 CWE-61
Published
Advisory Summary

CVE-2021-4287 is a MODERATE (CVSS 6.5) binwalk vulnerable to unix symbolic vulnerability (CWE-59: Improper Link Resolution Before File Access ('Link Following')) affecting Binwalk libraries in the PyPI ecosystem. The issue involves binwalk vulnerable to unix symbolic link (symlink) following. Remediation is available by upgrading affected packages to version 2.3.3.

CVE-2021-4287 at a Glance

CVE Identifier CVE-2021-4287
GHSA Identifier GHSA-8m3f-g62j-3vx8
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-59: Improper Link Resolution Before File Access ('Link Following')
Affected Product Binwalk
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 6.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:R/S:U/C:H/I:N/A:N).

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

How to Fix CVE-2021-4287

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

binwalk fixed: 2.3.3
pip install binwalk>=2.3.3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show binwalk

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2021-4287, inspect your installed packages using pip:

pip show binwalk

Analyze the terminal output to locate any version of Binwalk in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.3.3), your application is affected.

Note: The pip show binwalk command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-59: Improper Link Resolution Before File Access ('Link Following'), where the product attempts to access a file based on the filename, but it does not properly prevent that filename from identifying a link or shortcut that resolves to an unintended resource. In Binwalk, 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

A vulnerability, which was classified as problematic, was found in ReFirm Labs binwalk up to 2.3.2. Affected is an unknown function of the file src/binwalk/modules/extractor.py of the component Archive Extraction Handler. The manipulation leads to symlink following. It is possible to launch the attack remotely. Upgrading to version 2.3.3 can address this issue. The name of the patch is fa0c0bd59b8588814756942fe4cb5452e76c1dcd. It is recommended to upgrade the affected component. The identifier of this vulnerability is VDB-216876.

CVE-2021-4287 Affected Binwalk Versions

1 component(s)
Fixed Versions:
2.3.3
Product / Package Ecosystem Affected Versions Fixed Version
binwalk
PyPI
< 2.3.3
2.3.3

References

Frequently Asked Questions

What is CVE-2021-4287?
CVE-2021-4287 is a security vulnerability in Binwalk involving binwalk vulnerable to UNIX Symbolic Link (Symlink) Following under CWE-59: Improper Link Resolution Before File Access ('Link Following').
Which Binwalk versions are affected?
Affected versions include releases prior to 2.3.3 across affected packages: binwalk.
What version fixes CVE-2021-4287?
Upgrading to 2.3.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is binwalk affected?
Yes, binwalk is affected in releases prior to 2.3.3. Upgrade your dependency to 2.3.3 or later.
What is the CVSS score of CVE-2021-4287?
CVE-2021-4287 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2021-4287?
CVE-2021-4287 is classified under CWE-59: Improper Link Resolution Before File Access ('Link Following') (The product attempts to access a file based on the filename, but it does not properly prevent that filename from identifying a link or shortcut that resolves to an unintended resource.).
How can I check PyPI dependencies for CVE-2021-4287?
Run the dependency tree command: 'pip show binwalk'. 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-8m3f-g62j-3vx8",
  "modified" : "2023-01-19T00:59:08Z",
  "published" : "2022-12-27T12:30:19Z",
  "aliases" : [ "CVE-2021-4287" ],
  "summary" : "binwalk vulnerable to UNIX Symbolic Link (Symlink) Following",
  "details" : "A vulnerability, which was classified as problematic, was found in ReFirm Labs binwalk up to 2.3.2. Affected is an unknown function of the file src/binwalk/modules/extractor.py of the component Archive Extraction Handler. The manipulation leads to symlink following. It is possible to launch the attack remotely. Upgrading to version 2.3.3 can address this issue. The name of the patch is fa0c0bd59b8588814756942fe4cb5452e76c1dcd. It is recommended to upgrade the affected component. The identifier of this vulnerability is VDB-216876.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "binwalk"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.3.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-4287"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ReFirmLabs/binwalk/pull/556"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ReFirmLabs/binwalk/commit/fa0c0bd59b8588814756942fe4cb5452e76c1dcd"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/ReFirmLabs/binwalk"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ReFirmLabs/binwalk/releases/tag/v2.3.3"
  }, {
    "type" : "WEB",
    "url" : "https://vuldb.com/?ctiid.216876"
  }, {
    "type" : "WEB",
    "url" : "https://vuldb.com/?id.216876"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-59", "CWE-61" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-12-30T17:48:02Z",
    "nvd_published_at" : "2022-12-27T11:15:00Z"
  }
}