Maintenance Service Updater Callback Parameter File Deletion Elevation of Privilege
The Mozilla Maintenance Service updater appends a fixed suffix to a user-supplied callback path, but truncates the result to a fixed buffer length, allowing a non-privileged user to delete an arbitrary file. An attacker could use this to delete files such as firefox.exe and potentially elevate privileges.
Originally disclosed on Mozilla
- Fixed in 2 months
- Paid in 3 months
- Disclosed after 2 months
Created attachment 8816459
poc.rb
It is possible to exploit the updater as a non privileged user to delete an arbitrary file by passing a special path to the callback parameter of the updater via the Mozilla Maintenance Service.
During the update the callback parameter is used to generate a path to delete a file by appending a ".moz-callback" suffix (updater.cpp:3505). The result buffer of this operation has the length MAX_PATH (260) if the result is larger it will truncated. This can be exploited to bypass the appending operation and to delete a file, which has a path with the length 259. Further with relative path components this can be exploited to delete files with a smaller absolute path. With the ability to delete arbitrary files it´s possible to elevate privilege further.
I have tested the poc with the current nightly version of firefox and windows 7. It deletes the firefox.exe at 'C:\Program Files (x86)\Nightly\firefox.exe'.
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 updater builds a file path by appending a suffix to user input into a fixed-size buffer without checking for truncation, so a long path loses the suffix and points to an arbitrary file.
Impact
A non-privileged user could delete arbitrary files, including firefox.exe, and this could be used to elevate privileges further.
What the attacker needed
Non-privileged user account; Windows 7; nightly Firefox build
How it was found
- Run the proof-of-concept as a non-privileged user on Windows 7 with a nightly Firefox build.
- The proof-of-concept passes a specially crafted path to the updater's callback parameter.
- The updater appends the suffix and truncates the result, causing it to delete the targeted file.
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 updater takes a file path from the user and adds a fixed ending to it before deleting the file. Because the combined path is cut short at a fixed length, a specially crafted long path can make the updater delete a different file than intended. This lets a normal user delete protected files, which can lead to more serious attacks.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.