Skip to content
Path traversal Advisory Intermediate CVE-2022-23457

GHSL-2022-008: Path traversal in the OWASP Enterprise Security API (ESAPI)- CVE-2022-23457

The getValidDirectoryPath method in ESAPI incorrectly validates that a directory is inside a specified parent by using a string prefix check on canonical paths without ensuring a trailing slash. An attacker could bypass the check and access directories outside the intended parent.

jarlob Follow

Originally disclosed on GitHub Security Lab

getValidDirectoryPath incorrectly treats sibling of a root directory as a child.

jarlob, on GitHub Security Lab

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 uses a simple string prefix check on canonical paths without ensuring the parent path ends with a slash, so a sibling directory with a name that starts with the parent's name is incorrectly considered a child.

Impact

This issue allows to break out of expected directory.

What the attacker needed

Attacker can control the input path; parent path lacks trailing slash

The fix

The issue was fixed in version 2.3.0.0.

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.

This is a path traversal bug. The software tries to check that a file path is inside a certain folder, but it does the check by comparing the start of the path as text. If the parent folder path doesn't end with a slash, a sibling folder with a similar name (like 'outnot' vs 'out') can pass the check even though it's not actually inside the parent. An attacker could use this to access files outside the intended directory.

What is Path traversal?

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.

More by jarlob

View all

192 more disclosed reports, best first.

More from GitHub Security Lab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.