Skip to content
Info disclosure Disclosed report Intermediate CVE-2017-7768

32 byte arbitrary file reads as SYSTEM with maintenance service

An unprivileged user could trick the Mozilla Maintenance Service into reading the first 32 bytes of any file as the SYSTEM user by providing a hardlinked update.status file. The read content is written to a world-readable log, allowing limited disclosure of sensitive file contents.

Seb Patane Follow

Originally disclosed on Mozilla

  • Fixed in 2 months
  • Paid in 3 months
  • Disclosed after 2 months
Text
Created attachment 8833974
proof-of-concept

An unprivileged (standard) user can use the maintenance service to read the first 32 bytes of any file as the _SYSTEM user. Which isn't amazing, but still better than nothing :)

For example, running the poc with arbitrary_read.rb "C:\Users\Seb\creds.txt" will return the first 32 bytes of the first line in the shell. The full 32 bytes of multiline files can be seen in the C:\Program Files (x86)\Mozilla Maintenance Service\logs\maintenanceservice.log file.

The root cause is that we can trick the maintenance service into reading an arbitrary file in IsStatusApplying [0] by providing a hardlinked update.status where it expects one from the updater.exe. Even though the updater.exe runs, it seems to do so in such a way that it doesn't remove/update the update.status that we have prepared.

When the maintenance service goes to read the update.status from the updater, instead it reads the hardlinked file as _SYSTEM. It then writes this to the maintenanceservice.log file [1], which is world-readable.

The buffer is only 32 bytes long, so that's all we get out of the file. If all 32 bytes are read, the buf string isn't null terminated so the memory past the end of the buffer is logged as well (until it hits a null byte).

The proof of concept is a little bit rushed sorry - although you can create a hardlinked file as an unprivileged user, I've been having trouble deleting them without elevating. Either elevating and removing the hardlink before rerunning the poc, or using a different directory should fix that. The CreateHardlink binary is a compiled version from https://github.com/google/symboliclink-testing-tools/tree/master/CreateHardlink.

Tested on Windows 8.1 x64, Firefox 51.0.1 as well as mozilla-central.

[0] - https://dxr.mozilla.org/mozilla-central/rev/1d025ac534a6333a8170a59a95a8a3673d4028ee/toolkit/components/maintenanceservice/workmonitor.cpp#69
[1] - https://dxr.mozilla.org/mozilla-central/rev/1d025ac534a6333a8170a59a95a8a3673d4028ee/toolkit/components/maintenanceservice/workmonitor.cpp#74

The original report as published on Mozilla's Bugzilla, by Seb Patane. 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 maintenance service trusted a user-controlled update.status file (via a hardlink) and read it as SYSTEM without validating its origin or path.

Impact

An unprivileged user could read the first 32 bytes of any file as SYSTEM, and if the buffer is fully read, additional memory past the buffer may be logged until a null byte.

What the attacker needed

Unprivileged local user; ability to create hardlinks; maintenance service running

How it was found

  1. Create a hardlink named update.status pointing to the target file.
  2. Run the proof-of-concept with the path to the target file.
  3. The maintenance service reads the first 32 bytes of the target file as SYSTEM.
  4. The read bytes are written to the world-readable maintenanceservice.log.

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 maintenance service runs with high privileges (SYSTEM) and reads a status file to decide what to do. A normal user could make that status file point to any file on the system, so the service read the first 32 bytes of that file and wrote them into a log that anyone can read. This let a low-privileged user see small pieces of protected files.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More by Seb Patane

View all

10 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.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.