Technical analysis and patches by 0patch
A path traversal flaw in Microsoft's Diagnostic Tool (MSDT) allowed a malicious diagcab file to copy a file with a crafted name from a remote WebDAV share into the user's Startup folder, leading to code execution on next login. An attacker could achieve this by convincing a user to open a diagcab file, which could be downloaded automatically by visiting a website.
blog.0patch.com
Published on blog.0patch.com
With the "Follina" / CVE-2022-30190 0day still hot, i.e., still waiting for an official fix while apparently already getting exploited by nation-backed attackers, another related unfixed vulnerability in Microsoft's Diagnostic Tool (MSDT) bubbled to the surface.
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
The MSDT code assumed that filenames from a remote source were valid Windows filenames and did not check for path traversal sequences like '..\', allowing a crafted filename to escape the intended temporary folder.
Impact
An attacker could execute arbitrary code on the victim's machine after the next login, but the attack requires the user to open a downloaded diagcab file, and Mark of the Web is not checked by MSDT.
What the attacker needed
Victim opens a diagcab file; attacker controls a WebDAV server; Windows 7 or later
The fix
The vulnerability was fixed by Microsoft in August 2022 Windows Updates (CVE-2022-34713), and 0patch provided micropatches that block filenames containing '..\'.
How it was found
- The diagcab archive contains package configuration XML file pointing to a folder on a remote WebDAV server.
- This folder hosts a file named "\..\..\..\..\..\..\..\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\malicious.exe".
- Vulnerable MSDT creates a local temporary folder such as "C:\Users\John\AppData\Local\Temp\SDIAG_0636db01-fabd-49ed-bd1d-b3fbbe5fd0ca".
- It then appends the remote file name to this folder name and gets: "C:\Users\John\AppData\Local\Temp\SDIAG_0636db01-fabd-49ed-bd1d-b3fbbe5fd0ca\..\..\..\..\..\..\..\AppData\Roaming\Microsoft\Windows\Start…
- Which in fact means "C:\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\malicious.exe".
- It finally copies the content of the remote weirdly-named file to malicious.exe in computer's Startup folder, where it will be executed the next time anyone logs in.
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.
This report describes a flaw in a Windows troubleshooting tool. The tool could be tricked into placing a malicious program into a folder that runs programs automatically when you log in. The attacker only needed you to open a special file, which could be downloaded just by visiting a website.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.