GHSL-2022-007: Partial path traversal in Apache Felix Atomos
The file path validation in Apache Felix Atomos used a prefix check on canonical paths without ensuring a trailing slash, allowing a path like '/usr/outnot' to pass as being inside '/usr/out'. An attacker could break out of the expected folder and access files outside the intended directory.
Latest revision 987492ecde0493e3e048ea30974e657b11d875ad on Linux
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 report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The code compared canonical paths using startsWith without ensuring the root path ended with a slash, so a sibling directory with a matching prefix passed the check.
Impact
This issue allows to break out of expected folder.
What the attacker needed
Attacker can supply a file path
The fix
The issue was fixed in the main branch and a fixed version was released.
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 report has not been written yet. The Original tab links to the source.
When a program checks if a file is inside a folder, it compares the start of the file's full path with the folder's path. If the folder path doesn't end with a slash, a file in a similarly named folder (like 'outnot' instead of 'out') can trick the check. This lets someone reach files outside the intended folder.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.