GHSL-2022-005_GHSL-2022-006: Partial path traversal in Apache Karaf - CVE-2022-22932
The archive extraction routines in Apache Karaf and its Maven plugin checked whether the canonical target path started with the canonical destination directory, but without a trailing slash, so a path like '/usr/outnot' passed the check for '/usr/out'. An attacker could craft a malicious archive to write files outside the intended directory.
Latest revision dc8617af34b64b0dac52d7e337bd22dd6e21b60f 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 path validation used a string prefix check on canonical paths without ensuring the expected directory ended with a slash, allowing sibling directories with a common prefix to pass.
Impact
This issue allows to break out of expected folder.
What the attacker needed
Ability to supply a malicious archive
The fix
The issue was fixed by ensuring the canonical directory path ends with a slash before the prefix check.
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 unpacks an archive, it must ensure files stay inside a chosen folder. The code checked if the destination path began with the folder name, but forgot that '/usr/outnot' also begins with '/usr/out'. So a malicious archive could write 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.