# CVE-2022-4510: Path Traversal in binwalk

> Attackers can achieve remote code execution by crafting malicious PFS files that exploit path traversal in binwalk's extraction mode.

- **Severity:** High 7.8 (`CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 25 Jan 2023
- **Updated:** 16 Dec 2025
- **Also known as:** DEBIAN-CVE-2022-4510, DLA-3339-1, DLA-4410-1, GHSA-3cm8-v4mc-gppg, MGASA-2023-0074, PYSEC-2026-787, UBUNTU-CVE-2022-4510, openSUSE-SU-2024:12649-1

## What is CVE-2022-4510?

CVE-2022-4510 is a high-severity path traversal vulnerability in Refirm Labs binwalk, published on 25 Jan 2023. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

### Official description

A path traversal vulnerability was identified in ReFirm Labs binwalk from version 2.1.2b through 2.3.3 included. By crafting a malicious PFS filesystem file, an attacker can get binwalk's PFS extractor to extract files at arbitrary locations when binwalk is run in extraction mode (-e option). Remote code execution can be achieved by building a PFS filesystem that, upon extraction, would extract a malicious binwalk module into the folder .config/binwalk/plugins.
 This vulnerability is associated with program files src/binwalk/plugins/unpfs.py.

This issue affects binwalk from 2.1.2b through 2.3.3 included.

Weakness: CWE-22 (Improper Limitation of a Pathname to a Restricted Directory)

## Which versions are affected by CVE-2022-4510?

3 open source packages ship an affected version, including binwalk. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `binwalk` | PyPI | From 2.1.2b to 2.3.3 | None |
| `binwalk` | PyPI | From 2.1.2b to 2.3.3 | None |
| `binwalk` | PyPI | From 2.1.2b | 2.3.4 |
| `binwalk` | openSUSE:Tumbleweed | All versions | 2.3.3-2.1 |

Products: Microsoft Binwalk.

## How do I fix CVE-2022-4510?

Upgrade binwalk to 2.3.4 or later.

## Is CVE-2022-4510 being exploited?

There is no known exploitation of CVE-2022-4510 in the wild and no public exploit code.

Public exploit code:

- A Python script for generating exploits targeting CVE-2022-4510 RCE Binwalk. It supports SSH, command execution, and reverse shell options. Exploits are saved in PNG format. Ideal for testing and demonstrations. (github_poc): https://github.com/adhikara13/CVE-2022-4510-WalkingPath
- Binwalk Remote Command Execution (github_poc): https://github.com/electr0sm0g/CVE-2022-4510
- Python script that generates pfs payloads to exploit CVE-2022-4510 (github_poc): https://github.com/Kalagious/BadPfs-CVE-2022-4510
- Binwalk v2.3.2 - Remote Command Execution (RCE) (exploitdb)

## Other vulnerabilities in Refirm Labs binwalk

- [CVE-2021-4287](https://insights.sbomify.com/CVE-2021-4287/): ReFirm Labs binwalk Archive Extraction extractor.py symlink (medium 5.0)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2022-4510 and fix it if it is affected.

What it is: CVE-2022-4510 is a high-severity path traversal vulnerability in Refirm Labs binwalk, published on 25 Jan 2023. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2022-4510 in the wild and no public exploit code.

Affected packages and fixed versions:
- binwalk (PyPI): affected from 2.1.2b up to 2.3.3; no fix listed
- binwalk (PyPI): affected from 2.1.2b up to 2.3.3; no fix listed
- binwalk (PyPI): affected from 2.1.2b; fixed in 2.3.4

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2022-4510/ (Markdown: https://insights.sbomify.com/CVE-2022-4510/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2022-4510
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2022-4510
- OSV: https://osv.dev/vulnerability/CVE-2022-4510

---
From sbomify Insights: https://insights.sbomify.com/CVE-2022-4510/
Summaries are generated and may contain mistakes; the official description above is the record.
