Skip to content
File upload Disclosed report Intermediate CVE-2023-29542

url/local/lnk/scf .download filename manipulation can be bypassed by using final newline or other sanitized characters

Firefox replaces downloads of dangerous shortcut file types such as .url, .lnk, .scf and .local with a .download extension, but a crafted filename containing a newline character slips past that check. An attacker could therefore get a victim to save a working shortcut file that runs commands or opens a remote location.

Shaheen Fazim Follow

Originally disclosed on Mozilla

  • Fixed in 25 days
  • Paid in 10 days
  • Disclosed after 25 days
Text
Created attachment 9315984
poc.html

Firefox has implemented a security measure aimed at protecting its users by replacing the download of malicious shortcut extensions, such as .url, .lnk, .scf, .local, and others, with the ".download" extension. However, it has been discovered that an attackers can use special character to bypass this filter.

A similar issue has been previously reported by me in Mozilla's bug tracking system (https://bugzilla.mozilla.org/show_bug.cgi?id=1810143) and has recently been addressed in the latest beta version of Firefox (110.0).

After conducting thorough testing on the latest version of Firefox, it has been determined that all dangerous extensions can still be downloaded using this bypass, indicating a lack of a filter to prevent this vulnerability. 

I have provided a proof of concept (poc.html) file that downloads .url. Using the special character '\n' bypass, you can directly modify the fileName variable to test other dangerous extensions, including .scf, .lnk, and .local.

Note: This vulnerability is of a more severe nature, given the ability of not only .url extensions, but also .scf, .lnk, and .local extensions to be downloaded as well.

Solution: Block special characters.

The original report as published on Mozilla's Bugzilla, by Shaheen Fazim. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

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 check that decides whether to rename a download matches the filename ending without first stripping or rejecting control characters such as a newline, so the dangerous extension is not recognised.

Impact

A user who opens the downloaded file could run a shortcut that launches a program or opens a remote address, though the text gives no demonstration of code execution beyond the download itself.

What the attacker needed

Victim uses Firefox; victim opens a malicious page; victim opens the downloaded file

The fix

The download filename handling should reject or strip control and other special characters before deciding whether to rename the file.

How it was found

  1. Open the attached proof-of-concept page in Firefox.
  2. Let the page trigger a download of a shortcut file.
  3. Observe that the file is saved with its dangerous extension instead of being renamed to .download.
  4. Change the filename variable in the page to test other shortcut extensions.

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.

Some file types, like Windows shortcuts, can run programs or open web addresses when opened. Firefox tries to make these harmless by renaming them with a .download ending so they cannot be run by accident. The report says adding a special invisible character (a line break) to the filename tricks Firefox into keeping the dangerous ending, so the file stays usable.

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.

More by Shaheen Fazim

View all

38 more disclosed reports, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Unrestricted file upload

The lesson behind this report.

An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.