Extension sanitization (.lnk, .local) bypass using pipe (|)
Firefox removes pipe characters from filenames and renames .lnk files to .download, but a filename with trailing pipes bypasses the renaming. An attacker could deliver a .lnk file that Firefox saves with its original extension, potentially leading to code execution if the user opens it.
- Fixed in under an hour
- Paid in 8 days
- Disclosed after under an hour
Currently, Firefox (1) removes all | operators from filenames.
It also (2) renames any file ending with .lnk to .download. (https://www.mozilla.org/en-US/security/advisories/mfsa2022-30/#CVE-2022-36314)
The behaviour (1) can be used to bypass (2)
Example: The filename "test.lnk|||" will get saved as "test.lnk" which bypasses behaviour (2) even on the latest Nightly build 111.0a1 (2023-02-05) (64-bit)
Can test using: https://haxatron-server.glitch.me/hashleak-2.html
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 sanitisation of pipe characters happens before the check for the .lnk extension, so the extension check sees a filename that no longer ends with .lnk and skips the rename.
Impact
An attacker could deliver a .lnk file that Firefox saves with its original extension, which may lead to code execution if the user opens it.
What the attacker needed
Victim uses Firefox; victim downloads a malicious .lnk file; victim opens the downloaded file
How it was found
- Create a file named with .lnk extension followed by pipe characters.
- Download the file using Firefox.
- Observe that the file is saved with the .lnk extension instead of being renamed to .download.
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.
Firefox tries to protect users by changing the extension of shortcut files (.lnk) to .download so they are not accidentally opened. It also strips pipe characters from filenames. The report shows that adding pipes after the .lnk extension tricks Firefox into keeping the dangerous .lnk extension.
What is File upload?
An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.