# CVE-2021-21234: Directory Traversal

> An attacker can read arbitrary files outside the logging directory by manipulating the base folder parameter in the log viewer endpoint.

- **Severity:** High 7.7 (`CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N`)
- **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:** 5 Jan 2021
- **Updated:** 3 Aug 2024
- **Also known as:** GHSA-p4q6-qxjx-8jgp

## What is CVE-2021-21234?

CVE-2021-21234 is a high-severity path traversal vulnerability in lukashinsch spring-boot-actuator-logview, published on 5 Jan 2021. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

spring-boot-actuator-logview in a library that adds a simple logfile viewer as spring boot actuator endpoint. It is maven package "eu.hinsch:spring-boot-actuator-logview". In spring-boot-actuator-logview before version 0.2.13 there is a directory traversal vulnerability. The nature of this library is to expose a log file directory via admin (spring boot actuator) HTTP endpoints. Both the filename to view and a base folder (relative to the logging folder root) can be specified via request parameters. While the filename parameter was checked to prevent directory traversal exploits (so that `filename=../somefile` would not work), the base folder parameter was not sufficiently checked, so that `filename=somefile&base=../` could access a file outside the logging base directory). The vulnerability has been patched in release 0.2.13. Any users of 0.2.12 should be able to update without any issues as there are no other changes in that release. There is no workaround to fix the vulnerability other than updating or removing the dependency. However, removing read access of the user the application is run with to any directory not required for running the application can limit the impact. Additionally, access to the logview endpoint can be limited by deploying the application behind a reverse proxy.

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

## Which versions are affected by CVE-2021-21234?

2 open source packages ship an affected version, including eu.hinsch:spring-boot-actuator-logview. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `eu.hinsch:spring-boot-actuator-logview` | Maven | All versions | 0.2.13 |
| `eu.hinsch:spring-boot-actuator-logview` | Maven | All versions | 0.2.13 |

Products: Spring-Boot-Actuator-Logview Project Spring-Boot-Actuator-Logview.

## How do I fix CVE-2021-21234?

Upgrade eu.hinsch:spring-boot-actuator-logview to 0.2.13 or later.

## Is CVE-2021-21234 being exploited?

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

Public exploit code:

- https://github.com/xiaojiangxl/CVE-2021-21234 (github_poc): https://github.com/xiaojiangxl/CVE-2021-21234
- Directory traversal vulnerability in the spring-boot-actuator-logview library (github_poc): https://github.com/PwCNO-CTO/CVE-2021-21234
- Spring Boot Actuator Logview Directory Traversal (nuclei): http/cves/2021/CVE-2021-21234.yaml

## Other vulnerabilities in lukashinsch spring-boot-actuator-logview

- [CVE-2023-29986](https://insights.sbomify.com/CVE-2023-29986/): Path traversal in n/a (medium 5.3)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2021-21234 and fix it if it is affected.

What it is: CVE-2021-21234 is a high-severity path traversal vulnerability in lukashinsch spring-boot-actuator-logview, published on 5 Jan 2021. 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-2021-21234 exists.

Affected packages and fixed versions:
- eu.hinsch:spring-boot-actuator-logview (Maven): affected all versions; fixed in 0.2.13
- eu.hinsch:spring-boot-actuator-logview (Maven): affected all versions; fixed in 0.2.13

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

## Sources

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

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