SubstackDB: Exploiting Lax Upload Validation to Create Parasitic File Servers
Substack's file upload endpoint accepted any Base64-encoded data without validating file type or content, and only required an active user session. An attacker could upload arbitrary files of any size and use the platform as a free file server, as demonstrated by storing a GPT2 model.
devingaffney.com
Published on devingaffney.com
For the past year, I've been increasingly focusing on what I have come to call "sociotechnical security" - whereas "technical security" seeks to identify and remove unintended flaws in the architecture of platforms, "sociotechnical security" is all about identifying and removing the incentives for how worst-faith…
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 upload endpoint lacked validation of file type and content, and only checked for an active user session, allowing any Base64-encoded data to be stored.
Impact
An attacker could use the platform as a free file server to store and serve arbitrary files, potentially consuming storage and bandwidth at the platform's expense.
What the attacker needed
A valid user account; ability to send HTTP requests
The fix
The upload endpoint should validate file type and content, and use per-upload tokens rather than only a session check.
How it was found
- Capture the cURL request used to upload an image in the WYSIWYG editor.
- Reduce the request to only the essential parts needed to send a file.
- Replace the Base64-encoded image data with Base64-encoded arbitrary content.
- Upload the modified request to store the arbitrary file on the server.
- Download the file from the returned URL to verify it is stored byte-for-byte.
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.
When you upload a picture to a website, the site should check that the file really is a picture and not something else. Here, the site accepted any data that was encoded in a common text format (Base64) and stored it without checking. Because anyone with an account could do this repeatedly, the site could be used as free storage for large files.
What is File upload?
An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.