Unauthenticated IPFS Uploads Led to Stored XSS on a Web3 Platform
Two API endpoints allowed unauthenticated file uploads to the platform's IPFS pinning service, and the gateway served uploaded SVGs with a content type that let embedded JavaScript execute in the gateway's origin. An attacker could host arbitrary content under the platform's domain, run script in that origin, and exhaust storage quota.
Published on medium.com
In the fast-paced world of Web3 and decentralized applications, developers are racing to ship features, sometimes overlooking fundamental security principles. Recently, I decided to dig deeper into the infrastructure of a prominent platform, target.com (a fictional name for a very real, redacted launchpad).
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 endpoints lacked any authentication or authorisation check, and the file gateway served user-supplied SVG files inline with a script-capable content type and no download-forcing header.
Impact
An attacker could exhaust the platform's storage quota, host phishing or illegal content under the platform's subdomain, and run script in the gateway origin, potentially leading to session hijacking for users who visit malicious content identifiers.
What the attacker needed
No account needed; victim visits a crafted IPFS gateway URL
The fix
The platform fixed the issue by enforcing authentication on both upload endpoints, adding rate limiting, restricting CORS, and validating uploaded content server-side.
How it was found
- Request a presigned upload URL from the unauthenticated endpoint.
- Upload an SVG file to the returned presigned URL.
- Receive a success response containing the IPFS content identifier.
- Navigate directly to the gateway URL for that content identifier.
- Observe the embedded JavaScript executing in the gateway's origin.
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.
The platform let anyone upload files to its cloud storage without logging in. Because it also served those files in a way that lets a web browser run any script inside them, an attacker could make a malicious file that runs code when someone opens it, under the platform's own web address.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.