Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Sh Kb File Upload

ASecurity

Knowledge base for finding unrestricted/insecure file upload - uploads that allow dangerous file types, execution in the upload dir, path control over the stored name, or missing content validation, leading to RCE, XSS, or overwrite. Use when hunting file-upload issues. CWE-434/436/616, OWASP A04/A05:2021.

14 stars
0 votes
0 copies
0 views
Added 9/28/2026
ai-agentsrustphpshellflask

Works with

cli

Security Analysis

A100/100

Scanned 9/28/2026

Install to Claude Code

$npx -y skills add dmdhrumilmistry/security-harness --skill sh-kb-file-upload --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Sh Kb File Upload?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Sh Kb File Upload
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/dmdhrumilmistry-sh-kb-file-upload-security-harness/badge)](https://www.skillsdirectory.com/skills/dmdhrumilmistry-sh-kb-file-upload-security-harness)

More formats (shields.io, HTML) on the badges page.

Files
SKILL.md
---
name: sh-kb-file-upload
description: "Knowledge base for finding unrestricted/insecure file upload - uploads that allow dangerous file types, execution in the upload dir, path control over the stored name, or missing content validation, leading to RCE, XSS, or overwrite. Use when hunting file-upload issues. CWE-434/436/616, OWASP A04/A05:2021."
---

# Unrestricted File Upload - Hunter Knowledge Base

Uploads become dangerous when the app trusts the client-provided type/name, stores files where they can be
executed or served, or skips content validation. Worst case: upload a web shell and get RCE.

## What to hunt
- **Executable upload + reachable path** (CWE-434): uploading `.php`/`.jsp`/`.aspx`/`.py` (or a bypass
  variant) into a directory the web server executes -> RCE.
- **Type/extension trust**: validating only the client `Content-Type` or extension (spoofable); no
  server-side content/magic-byte check.
- **Path control over stored name**: attacker sets the filename/path (traversal `../`, overwrite of an
  existing file, null byte, double extension `shell.php.jpg`, trailing dot/space, case tricks, NTFS
  Alternate Data Stream `shell.asp:.jpg`, or a name like `shell.p.phphp` that becomes `shell.php` after a
  single-pass, non-recursive strip of a blacklisted extension).
- **Upload-then-validate race window**: the app writes the file to a web-reachable path first and deletes
  it afterward if validation fails - an attacker who requests the file fast enough (or repeatedly re-uploads
  to widen the window) can get it executed before it's removed.
- **Content-driven XSS / SVG / HTML / polyglot**: uploading `.svg`/`.html` served inline on the app origin
  -> stored XSS; image polyglots; `.xml`-backed formats -> XXE.
- **Missing limits**: no size/rate limit -> DoS; zip-bomb; decompression bombs.
- **Metadata/EXIF or antivirus gaps**; server-side image processing (ImageMagick "ImageTragick") RCE.

## Sinks / patterns (grep targets)
Upload handlers and where they write: `request.files`, `MultipartFile`, `multer`, `formidable`,
`move_uploaded_file`, `save(`/`saveAs(`, `fs.writeFile(uploadPath)`, `os.path.join(upload_dir, filename)`,
`secure_filename` (Flask - check it's actually used), `Content-Type` checks, extension allowlist/denylist.
Also how the file is later **served** (static route over the upload dir) or **processed** (image libs).

## Detection recipe
1. `graft grep "request.files|MultipartFile|multer|move_uploaded_file|save(|writeFile|upload" --json`.
2. For each upload: How is the type validated (extension? content-type? magic bytes?). Is the stored name
   attacker-controlled? Where is it stored, and is that path executable or served inline on the app origin?
3. Trace the stored filename for traversal/overwrite; check size/count limits.

## Payloads / PoC
- Web shell: `shell.php` with `<?php system($_GET['c']); ?>` if PHP execution reachable; `.jsp`/`.aspx` equiv.
- Bypasses: double extension `shell.php.jpg`, null byte `shell.php%00.jpg`, case `shell.PhP`, trailing
  dot/space `shell.php.`, spoofed `Content-Type: image/png` with PHP body, magic-byte prefix + code,
  alternative interpreter extensions often missing from blacklists (`.phtml`, `.php5`, `.pht`, `.shtml`,
  `.asp;.aspx`), URL-encoded extension `exploit%2Ephp`, polyglot image+payload files (e.g. built with
  ExifTool) that pass magic-byte/dimension checks.
- Stored XSS: upload `poc.svg` containing `<script>...</script>` or `poc.html`, served inline.
- Traversal/overwrite: filename `../../app/config.py` (zip-slip for archives).
- PoC: upload the file, then request its served URL and observe execution/script/overwrite.

## False-positive filters
- Server-side **content** validation (magic bytes / re-encode image) **and** an extension **allowlist**
  (not denylist), with a server-generated random stored name (client name discarded).
- Uploads stored outside the webroot / on object storage with `Content-Disposition: attachment` and a
  non-executing content-type, served from a separate origin/domain.
- Size/count/rate limits enforced; archives validated before extraction.
- Validation happens **before** the file is written to any web-reachable path (no upload-then-delete-on-fail
  race window).
- Per-directory config overrides disabled (Apache `AllowOverride None`, IIS handler mappings locked) so a
  smuggled `.htaccess`/`web.config` in the upload dir can't grant execution; on Windows, 8.3 short-filename
  generation disabled (`fsutil behavior set disable8dot3 1`) so a blocked long name can't be reached via its
  short alias.

## CWE / OWASP / severity
CWE-434 (unrestricted upload), CWE-436 (interpretation conflict), CWE-616. OWASP A04/A05:2021.
Upload->RCE -> **critical**; stored XSS via upload -> high; overwrite/DoS -> per impact.

## Chaining hints
Upload web shell -> RCE -> `secrets`/lateral (chain terminus); SVG/HTML upload -> stored `xss` -> admin
takeover; filename control -> `path-traversal` overwrite; XML-backed upload -> `xxe`; feeds `injection`
(processing the file with a shell).

## Mitigation
Allowlist expected extensions **and** validate content (magic bytes / re-encode images) *before* the file
touches any web-reachable path; discard the client filename and generate a random server-side name; store
outside the webroot or on object storage served from a separate origin with `Content-Disposition: attachment`
and a safe content-type; disable per-directory config overrides and short-filename generation; enforce
size/count/rate limits; scan for malware; keep image-processing libraries patched.

Attribution

dmdhrumilmistrydmdhrumilmistry
View sourceMore from dmdhrumilmistry →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Ultra-compressed communication mode that cuts output tokens while keeping technical accuracy. Levels: lite, full, ultra and the wenyan variants. Use for /caveman, "caveman mode", "talk like caveman", "be brief" or "less tokens".

1074701 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

695601 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3351 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

691 votes

math-skill

A comprehensive mathematical reasoning skill for AI assistants — handles arithmetic to research-level problems with rigorous step-by-step reasoning, systematic verification, and transparent uncertainty handling

381 votes
View all in ai-agents →