The Initial Thought Process
Windows Defender's log rotation mechanism deletes the MpCmdRun.log.bak directory recursively when the log file exceeds 16MB. An attacker could create a junction at that path to redirect the deletion to an arbitrary directory, potentially leading to privilege escalation.
itm4n.github.io
Published on itm4n.github.io
Here is my writeup about CVE-2020-1170, an elevation of privilege bug in Windows Defender. Finding a vulnerability in a security-oriented product is quite satisfying.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the log rotation code does not check whether the backup path is a directory or a junction before recursively deleting it.
Impact
An attacker could delete arbitrary files or directories, and by deleting specific folders (such as C:\ProgramData\Microsoft\Windows\WER) could potentially achieve code execution as NT AUTHORITY\SYSTEM.
What the attacker needed
Low-privileged user account; ability to create files and directories in C:\Windows\Temp; ability to create junctions (mountpoints)
How it was found
- Create a directory named MpCmdRun.log.bak in C:\Windows\Temp.
- Set that directory as a mountpoint (junction) to a target directory.
- Fill the MpCmdRun.log file with data until its size is close to 16MB.
- Trigger a signature update using the Update-MpSignature PowerShell command.
- Observe that Defender follows the junction and recursively deletes the target directory.
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 write-up has not been written yet. The Original tab links to the source.
Windows Defender writes log files to a temporary folder that any user can write to. When the log gets too big, Defender renames it to a backup name, but if that backup name is a folder, Defender deletes the folder and everything inside it. An attacker can make that folder a link to another location, so Defender ends up deleting files it shouldn't, which can help an attacker gain higher privileges.
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.