Path traversal in filename in LINE Mac client
A path traversal flaw in the LINE Mac client's handling of zip filenames allowed a crafted zip to execute pre-installed applications or files in the Downloads folder. Attackers could also bypass file upload restrictions to deliver a malicious .terminal file, and if Gatekeeper was disabled, chain both issues to achieve code execution.
Originally disclosed on HackerOne
- Triaged in 13 hours
- Fixed in 40 days
- Paid in 2 months
- Disclosed after 9 months
Summary by the program
Initially, @hackerontwowheels and @renekroka discovered that by using a path traversal payload combined with # to block out the file extension, arbitrary, pre-installed applications could be executed. It was not possible to provide additional arguments to these applications, however.
The payload used for OS X Yosemite was: ..%2f..%2f..%2f..%2f..%2f..%2f..%2fApplications%2fCalculator.app#.zip, which would execute the calculator app.
Running commands with parameters, was not possible (Example: /Applications/iTerm.app ls -al).
Afterwards, the reporters also identified an issue where they could achieve code execution, given that gatekeeper was disabled, by chaining the upload of an executable file through "Keep" (a file storage service in the LINE App), then trigger the execution using the previous path traversal vulnerability. The filetype had to be a .terminal file, due to it not being on the blacklist, as Keep normally filters executables and restricts sharing of these types of files in order to avoid this type of issue.
The complete chain looked like this:
- Upload malicious .terminal file to Keep
- Share .terminal file with victim from Keep
- Victim downloads shared file
- Send malicious .zip file with path traversal vulnerability
- Victim clicks .zip file
- Code is executed (if Gatekeeper is turned off)
Summary by the researcher
Through a logic error in file name parsing, it was possible for a malicious actor to send a specially crafted zip file to a target user, which when opened in the MAC App would execute any application or executable in ~/Downloads. Furthermore, we discovered two ways to bypass the file upload restrictions where we could send any file extension to users, for example .terminal files. Using both logic errors, it was possible for an attacker to send a malicious executable, and then a malformed zipped file to execute the previous executable bypassing all file transfer restrictions and gaining code execution on unsuspecting users.
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
Likely the app did not sanitise the filename inside the zip before using it to build the extraction path, allowing directory traversal.
Impact
An attacker could execute pre-installed applications or, if Gatekeeper was disabled, run a malicious executable delivered via Keep, bypassing file transfer restrictions.
What the attacker needed
Victim uses LINE Mac client; attacker can send files via LINE; victim downloads and opens the zip; Gatekeeper disabled for code execution
How it was found
- Upload a malicious .terminal file to Keep
- Share the .terminal file with the victim from Keep
- Victim downloads the shared file
- Send a malicious .zip file with a path traversal payload
- Victim clicks the .zip file
- Code is executed if Gatekeeper is turned off
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.
The app mishandled the filename inside the zip, so a crafted name could make it run programs already on the Mac, or a file the victim downloaded.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.