Saturday, September 21, 2019
The WiX Toolset's cabinet file extraction library concatenated archive entry names with the destination path without sanitisation, allowing a malicious .cab file to write files outside the intended directory (Zip Slip). An attacker could exploit this to overwrite executables and achieve code execution with elevated privileges, though the target application's certificate checks initially blocked the attack until the author developed a method to clone certificates onto malicious cab files.
k3ramas.blogspot.com
Published on k3ramas.blogspot.com
While doing research for a pretty large and complicated thick client assessment recently, I ended up diving down a rabbit hole involving cabinet files (.cab) as I noticed the application performing some interesting sequential functions.
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 extraction function took the full file name from the archive and concatenated it with the destination path without any sanitisation or validation.
Impact
An attacker could write arbitrary files to the system, potentially overwriting executables and achieving code execution with elevated privileges, but only after bypassing certificate checks by cloning a valid certificate onto the malicious cab file.
What the attacker needed
Ability to supply a malicious cab file; target uses vulnerable WiX Toolset library; bypass certificate checks (cloned certificate)
The fix
The vulnerability in the DLL was reported to FireGiant and has been remediated as referenced in CVE-2019-16511.
How it was found
- Create a cab file containing a file with a directory traversal name.
- Run the vulnerable extraction code on the cab file.
- Observe that the file is written to the path indicated by the traversal.
- In the thick client, replace the legitimate cab file with the malicious one and continue execution.
- The cab file is extracted and a file is written to C:\windows\system32.
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.
A cabinet file is a Windows archive format, like a zip file. Zip Slip is a flaw where an archive contains a file name with '../' in it, so when extracted, the file lands outside the intended folder. Here, the extraction code did not clean up those names, so a malicious archive could overwrite important system files.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.