# CVE-2022-25842: Arbitrary File Write via Archive Extraction (Zip Slip)

> Attackers can achieve remote code execution by exploiting a Zip Slip vulnerability in the Alibaba One Java Agent plugin to overwrite executable files.

- **Severity:** Medium 6.9 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:N/A:L/E:P`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 1 May 2022
- **Updated:** 17 Sep 2024
- **Also known as:** GHSA-9hr3-j9mc-xmq2, SNYK-JAVA-COMALIBABAONEAGENT-2407874

## What is CVE-2022-25842?

CVE-2022-25842 is a medium-severity path traversal vulnerability in com.alibaba.oneagent:one-java-agent-plugin, published on 1 May 2022. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

All versions of package com.alibaba.oneagent:one-java-agent-plugin are vulnerable to Arbitrary File Write via Archive Extraction (Zip Slip) using a specially crafted archive that holds directory traversal filenames (e.g. ../../evil.exe). The attacker can overwrite executable files and either invoke them remotely or wait for the system or user to call them, thus achieving remote command execution on the victim’s machine.

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

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

2 open source packages ship an affected version, including com.alibaba.oneagent:one-java-agent-plugin. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `com.alibaba.oneagent:one-java-agent-plugin` | Maven | All versions | 0.0.2 |
| `com.alibaba.oneagent:one-java-agent-plugin` | Maven | All versions | 0.0.2 |

Products: Alibabagroup One-Java-Agent.

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

Upgrade com.alibaba.oneagent:one-java-agent-plugin to 0.0.2 or later.

## Is CVE-2022-25842 being exploited?

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

Public exploit code:

- https://github.com/shoucheng3/alibaba__one-java-agent_CVE-2022-25842_0-0-1 (github_poc): https://github.com/shoucheng3/alibaba__one-java-agent_CVE-2022-25842_0-0-1

## Fix prompt for AI coding agents

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

What it is: CVE-2022-25842 is a medium-severity path traversal vulnerability in com.alibaba.oneagent:one-java-agent-plugin, published on 1 May 2022. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2022-25842 in the wild and no public exploit code.

Affected packages and fixed versions:
- com.alibaba.oneagent:one-java-agent-plugin (Maven): affected all versions; fixed in 0.0.2
- com.alibaba.oneagent:one-java-agent-plugin (Maven): affected all versions; fixed in 0.0.2

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-25842/ (Markdown: https://insights.sbomify.com/CVE-2022-25842/index.md)
```

## Sources

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

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