AI summary by TwinMind
S3 Is A Security Nightmare (Common Exploit Showcase)
Theo - t3․gg
16m 47s
S3 Security Issues Introduction
- Video about S3 security flaws, configuration issues causing massive security vulnerabilities
- February blog post discovery led to video content planning
- Community member Eva conducted extensive S3 exploit research
- Reference to previous Firebase exploit: 900 sites, 125 million accounts, $4 billion potential bank credentials
Pre-signed Post URL Explanation
- Traditional file upload: user → server → S3 (double bandwidth cost)
- Pre-signed post URL allows direct upload: user → S3 (eliminates ingress/egress costs)
- Process flow:
- User requests permission to upload
- Server generates pre-signed post URL with specific permissions, time window, file delimiters
- User uploads directly to S3 using URL
- Benefits: eliminated bandwidth costs, reduced latency
- Drawbacks: many configuration mistakes possible
Cross-Site Scripting (XSS) Vulnerability
- Companies create subdomains like files.company.com or cdn.company.com for S3
- Poor content type handling allows HTML file uploads
- Improperly set cookies enable account takeover
- HTML/JavaScript served from specific URL has access to domain cookies
- If cookies work on subdomains (files.google.com + google.com), HTML pages can access credentials
- Cross-site scripting = one of scariest exploit methods
Tally Case Study - XSS Exploit
- Tally: modern Google Forms alternative with image support, profile pictures
- Custom endpoint uploads files to S3 after performing checks
- Request example: API.tso upload block asset
- Response: pixel image, name, URL storage.t.o, image pink pixel.PNG, size 83 bytes
- HTML file upload attempt: hello image source X on error alert one
- Successfully posted XSS HTML as asset with correct MIME type
- Browser MIME sniffing: browsers try to detect HTML even with different content type headers
- Tally sanitized XSS payload but not foolproof
- SVG XML exploit: xmlns W3.org forcing XML parsing mode
- Successful cross-site scripting on files.t.o with session cookie in scope (HTTP only)
Authentication Token Extraction
- Tally endpoint allows authentication token retrieval from refresh cookie
- Final payload: refetch page with credentials, await fetch attacker callback
- Full user information dump when clicking SVG link
- Window.location.replace cleanup to appear like normal homepage visit
- Result: one-click full account compromise
- No bounty awarded (startup), but issue fixed quickly
Path Control Vulnerability
- Services allowing user control of file path/key during upload
- Problem: server doesn't check if file already exists
- Allows client to override other users' files
- Common issue across most services
P Case Study - File Override
- P: donation page platform for streamers with team splitting
- Channel banners, profile pictures stored on S3
- Request: API.pg.v10 upload sign ACL public read, key for file, file types image PNG
- Key randomly generated by client
- Changing key to existing user's file allows override
- Successfully changed Thor's profile picture to gnome for one minute
- Classic case of insecured S3 uploads
Upload Thing Solution
- Built specifically to solve file upload problems
- Common issues: incorrect implementation, eating unnecessary bandwidth costs, improper authentication, allowing unauthorized uploads, incorrect naming
- Upload Thing features:
- Generated keys prevent file override
- URLs contain key + file extension
- File names stored separately from URL
- Authentication required on user's server
- Enforces security patterns by default
- Setup time: literal minutes, some users under 10 seconds
- Speedrun record: 9 seconds 245 milliseconds using bash history shortcuts
- Requires user authentication management on own server
- Drag and drop functionality
Security Recommendations
- Set cookies properly
- Don't allow user control of file keys
- Avoid client-side ACL setting
- Use third-party solutions carefully due to common implementation errors
- S3 documentation lacks clarity, amplifying issues
Alternative Solutions Listed
- Upload Thing (primary recommendation)
- B scale file upload API
- File stack
- Simple file uploader with transform/delivery APIs
