npx skills add ...
npx skills add yaklang/hack-skills --skill upload-insecure-files
Insecure file upload playbook. Use when testing upload validation, storage paths, processing pipelines, preview behavior, overwrite risks, and upload-to-RCE chains.
npx skills add yaklang/hack-skills --skill upload-insecure-files
AI LOAD INSTRUCTION: Expert file upload attack playbook. Use when the target accepts files, imports, avatars, media, documents, or archives and you need the full workflow: validation bypass, storage path abuse, post-upload access, parser exploitation, multi-tenant overwrite, and chaining into XSS, XXE, CMDi, traversal, or business logic impact. For web server parsing vulnerabilities, PUT method exploitation, and specific CVEs (WebLogic, Flink, Tomcat), load the companion SCENARIOS.md.
Also load SCENARIOS.md when you need:
x.asp/ directory parsing, ; semicolon truncation (shell.asp;.jpg)avatar.jpg/.php with cgi.fix_pathinfo=1AddHandler, CVE-2017-15715 \n (0x0A) bypassreadonly + .jsp/ bypass/.php path infoUse this file as the deep upload workflow reference. Also load:
.jsp in filename* — Tomcat's RFC2231Utility narrows each char to byte, so 1.陪sp (U+966A low byte = j) writes 1.jsp to disk while the WAF sees no .jsp literalEvery upload feature should be tested as four separate trust boundaries:
Many targets validate only one stage. The bug usually appears in a different stage than the one where the file was uploaded.
Before payload selection, answer these:
| Validation Style | What to Test |
|---|---|
| extension blacklist | double extension, case toggles, trailing dot, alternate separators |
| content-type only | mismatched multipart Content-Type, browser vs proxy rewrite |
| magic-byte only | polyglot files or valid header plus dangerous tail content |
| server-side rename | whether dangerous content survives rename and later rendering |
| image-only policy | SVG, malformed image plus metadata, parser differential |
| archive or import only | zip contents, nested path names, XML members, decompression behavior |
Representative bypass families:
This small sample set already covers the main use cases of the former standalone upload payload helper, so no extra entry is needed for first-pass selection.
Do not stop at upload success. Successful upload without dangerous retrieval or processing is not enough.
Look for patterns like:
Test for:
A safe file can still be dangerous if the filename is reflected into:
If filename is reflected, treat it like stored input, not like passive metadata.
The highest-value upload bugs often live in asynchronous processors.
| Processor | Risk |
|---|---|
| image resizing or thumbnailing | parser differential, ImageMagick or library bugs, metadata reflection |
| video or audio transcoding | FFmpeg-style parsing and protocol abuse |
| archive extraction | zip slip, overwrite, decompression bombs |
| document import | CSV formula injection, office XML parsing, macro-adjacent workflows |
| XML or SVG parsing | XXE, SSRF, local file disclosure |
| HTML to PDF or preview rendering | SSRF, script execution, local file references |
| AV or DLP scanning | unzip depth, hidden nested content, race conditions |
Upload features frequently hide non-parser bugs:
When the upload path includes account, project, or organization identifiers, always run an A/B authorization test.
| Observation | Pivot |
|---|---|
| SVG or XML accepted | xxe xml external entity |
| filename or metadata reflected | xss cross site scripting |
| converter or processor shells out | cmdi command injection |
| extraction path looks controllable | path traversal lfi |
| overwrite, quota, approval, or tenant bug | business logic vulnerabilities |
Many testers focus only on bypassing file type checks, but forget:
.php file uploaded, if the web server doesn't parse it as PHP, no RCE| Editor | Common Upload Path | Version Indicator |
|---|---|---|
| FCKeditor | /fckeditor/editor/filemanager/connectors/ | /fckeditor/_whatsnew.html |
| CKEditor | /ckeditor/ | /ckeditor/CHANGES.md |
| eWebEditor | /ewebeditor/ | Admin: /ewebeditor/admin_login.asp |
| KindEditor | /kindeditor/attached/ | /kindeditor/kindeditor.js |
| UEditor | /ueditor/net/ or /ueditor/php/ | /ueditor/ueditor.config.js |
| Dimension | Flaw Examples |
|---|---|
| Location | Client-side only, inconsistent front/back |
| Method | Extension blacklist (incomplete), MIME check only, magic bytes only |
| Logic order | Renames AFTER execution check, validates BEFORE full upload |
| Scope | Checks filename but not file content, checks first bytes only |
| Execution context | Upload succeeds but different vhost/handler processes the file |
Files that are simultaneously valid in two or more formats, bypassing format-specific validation while delivering a dangerous payload.
ImageMagick uses "delegates" (external programs) for certain format conversions. Specially crafted files trigger shell command execution:
ImageMagick delegates to Ghostscript for PDF/PS/EPS processing. Ghostscript has had multiple sandbox escapes:
Upload as .eps, .ps, or .pdf → ImageMagick invokes Ghostscript → RCE.
Upload as .m3u8 or .ts → FFmpeg processes it → file content concatenated with header and sent to attacker server or embedded in output video.
FFmpeg fetches the URL server-side → SSRF to cloud metadata endpoint.
Create AVI with subtitle track referencing a URL:
Audit checklist:
When server sends no Content-Type or X-Content-Type-Options: nosniff is missing: