Fix : (Security) Mitigate Path Traversal Bug
Unsanitised input from the first command-line argument is used directly as a file path in a file output stream, which may allow an attacker to write to arbitrary files. The impact is limited to situations where the program runs with privileges the user supplying the path should not have.
bhaskar_ram Follow with malik_sarkaar
Originally disclosed on HackerOne
- Triaged in 24 days
- Fixed in 24 days
- Paid in 23 days
- Disclosed after 24 days
Unsanitized input from arg[0] argument flows into java.io.FileOutputStream, where it is used as a path. This may result in a Path Traversal vulnerability and allow an attacker to write to arbitrary files.
Impact
Being able to access and manipulate an arbitrary path leads to vulnerabilities when a program is being run with privileges that the user providing the path should not have. A website with a path traversal vulnerability would allow users access to sensitive files on the server hosting it. CLI programs may also be vulnerable to path traversal if they are being ran with elevated privileges (such as with the setuid or setgid flags in Unix systems)
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
Impact
An attacker could write to arbitrary files, which is dangerous when the program runs with privileges the user providing the path should not have.
What the attacker needed
Ability to supply the first argument; program may run with elevated privileges
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.
A program takes a file path from the user and uses it without checking it. If someone supplies a path pointing outside the intended folder, the program may write files anywhere the program is allowed to write. This matters most when the program runs with extra permissions, such as a setuid tool on Unix.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.