Write-up: BlogEngine .NET - 0day Discovery
The BlogEngine .NET application had an unauthenticated file deletion endpoint that allowed directory traversal to delete arbitrary files, and an authenticated XML upload feature vulnerable to XXE that could leak user credentials. An attacker could delete critical files to cause denial of service, or chain the XXE with CSRF to steal an administrator's password hash.
Published on 0xlanks.me
One of the first things I try to understand when auditing a new code base, is how the developers have implemented authentication and authorisation controls, and whether or not they're effective. Depending on the complexity of the application, this can sometimes be a monotonous task.
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 file deletion endpoint lacked any authorisation check and failed to sanitise user-supplied file paths, while the XML import feature used an insecure parser configuration that allowed external entities.
Impact
An unauthenticated attacker could delete arbitrary files, causing a denial of service, and could chain an XXE with CSRF to steal an administrator's password hash, leading to account takeover.
What the attacker needed
IIS runs with write/delete permissions in webroot; Victim (admin) visits attacker page; Attacker hosts external DTD
The fix
The report suggests implementing authorisation attributes and sanitising path variables to prevent directory traversal, and upgrading the .NET Framework to a version with secure XML parser defaults and adding CSRF tokens and SameSite cookies.
How it was found
- Send a PUT request to the file manager delete endpoint with a crafted JSON body specifying a file path containing directory traversal.
- Observe that the file is deleted, confirming unauthenticated arbitrary file deletion.
- Upload a malicious XML file to the import endpoint to trigger an XXE call-back.
- Use an external DTD to exfiltrate the users.xml file containing password hashes.
- Craft a CSRF page that automatically submits the malicious XML upload when an administrator visits it.
- Combine with the information disclosure from the file deletion endpoint to learn the full path to users.xml.
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 two security holes in a blogging application. The first lets anyone delete important files on the server without logging in, which can break the site. The second lets an attacker trick a logged-in administrator into uploading a malicious file that can steal user data, including password hashes.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.