CVE-2021-21234 Spring Boot Actuator Logview Directory Traversal
The logview endpoint of the Spring Boot Actuator Logview library only checked the filename parameter for directory traversal sequences and never validated the base path parameter. An attacker could supply a traversal sequence in the base parameter to read arbitrary files on the server, such as the system password file.
pyn3rd.github.io
Published on pyn3rd.github.io
Prior to spring-boot-actuator-logview 0.2.13, the securityCheck() method exists in LogViewEndpoint, but the securityCheck() method only filter the .. in fileName, ignoring the security check of basePath, so the attacker can construct payload with the evasion of check in basePath.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
What the attacker needed
Logview endpoint reachable; no authentication required
The fix
From version 0.2.13 the base path is strictly validated so path traversal is no longer permitted; it was fixed in that release.
How it was found
- Start the Spring Boot project with the logview endpoint enabled and confirm the page loads.
- Send a request to the log view endpoint with a traversal sequence in the base parameter and a target file in the filename parameter.
- Observe that the logging path is built from the base parameter without validation.
- Observe that the base folder and filename are concatenated into the final path with no further check.
- Receive the contents of the target file in the response.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
This library adds a web page that lets administrators view log files. It tried to stop people from escaping the log folder by blocking '..' (a path meaning 'go up one folder') in the file name, but forgot to check the other parameter that sets the starting folder. So a visitor could point the starting folder outside the log directory and read any file the server process can access.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.