# CVE-2022-46178: Path Traversal In MeterSpere allows file upload to any path

> Attackers can upload files to arbitrary paths due to lack of filename validation, potentially leading to code execution or data modification.

- **Severity:** High 7.4 (`CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 29 Dec 2022
- **Updated:** 10 Apr 2025
- **Also known as:** GHSA-9p62-x3c5-hr5p

## What is CVE-2022-46178?

CVE-2022-46178 is a high-severity path traversal vulnerability in metersphere, published on 29 Dec 2022. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

MeterSphere is a one-stop open source continuous testing platform, covering test management, interface testing, UI testing and performance testing. Versions prior to 2.5.1 allow users to upload a file, but do not validate the file name, which may lead to upload file to any path. The vulnerability has been fixed in v2.5.1. There are no workarounds.

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

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

2 open source packages ship an affected version, including io.metersphere:metersphere. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `io.metersphere:metersphere` | Maven | All versions | 2.5.1 |
| `io.metersphere:metersphere` | Maven | All versions | 2.5.1 |

Products: Metersphere Metersphere.

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

Upgrade io.metersphere:metersphere to 2.5.1 or later.

## Is CVE-2022-46178 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-46178 exists.

## Other vulnerabilities in metersphere

- [CVE-2023-29944](https://insights.sbomify.com/CVE-2023-29944/): Command injection in n/a (critical 9.8)
- [CVE-2021-45790](https://insights.sbomify.com/CVE-2021-45790/): File upload in n/a (critical 9.8)
- [CVE-2021-45788](https://insights.sbomify.com/CVE-2021-45788/): SQL injection in n/a (high 8.8)
- [CVE-2023-25573](https://insights.sbomify.com/CVE-2023-25573/): Improper access control to download file in metersphere (high 8.6)
- [CVE-2022-23512](https://insights.sbomify.com/CVE-2022-23512/): Metersphere is vulnerable to Path Injection. (high 7.7)

## Fix prompt for AI coding agents

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

What it is: CVE-2022-46178 is a high-severity path traversal vulnerability in metersphere, published on 29 Dec 2022. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-46178 exists.

Affected packages and fixed versions:
- io.metersphere:metersphere (Maven): affected all versions; fixed in 2.5.1
- io.metersphere:metersphere (Maven): affected all versions; fixed in 2.5.1

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

## Sources

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

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