agentleFS
awarexoneawarexone/AXguard/file-upload-security/SKILL.md

file-upload-security

Skill18 starsChanged 3 months agoMITView on GitHub

Analyze unsafe file upload handling — use when reviewing multipart uploads, extension/MIME checks, stored filenames, image processors, or user-supplied archives (CWE-434 / A04:2021).

3 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    After AXguard hits upload.* or related path.*.

    line 42
  2. Distinctive:

    No file ingress exists (JSON-only APIs).

    line 47
  3. Distinctive:

    Check extension allowlist vs denylist.

    line 66
  4. Distinctive:

    Check authZ: who can upload / overwrite / read whose objects.

    line 70

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

File Upload Security

Purpose

Guide pre-ship review of unrestricted or weakly restricted file uploads: content that is stored, served, or processed unsafely leading to RCE, XSS, traversal, or malware distribution.

When to Use / When Not to Use

Use when:

  • Multipart endpoints, avatar/doc uploads, multer, Busboy, Django FileField, S3 presigned PUT, archive import, antivirus-less pipelines.
  • After AXguard hits upload.* or related path.*.
  • Uploaded files are later executed, included, or served as HTML/JS.

Do not use when:

  • No file ingress exists (JSON-only APIs).
  • Upload is delegated entirely to a hardened third-party with app-only metadata (still review URL/XSS when displaying).

Security Concepts

Upload risk is a pipeline: accept → name → store → process → serve. Controls must cover type (magic bytes + allowlist), size, path, virus/content policy, and Content-Type when serving. Extension checks alone are insufficient.

Threat Model

Attacker goals:

  1. Upload executable/script into a webroot or template path.
  2. Store HTML/SVG that executes as XSS when served.
  3. Zip-slip / oversized archives (DoS) during extract.
  4. Polyglot files that bypass MIME sniffing or image pipelines (ImageTragick-class).

Analysis Workflow

  1. Map upload endpoints and storage destinations (disk, S3, CDN).
  2. Check extension allowlist vs denylist; confirm MIME and magic-byte validation.
  3. Inspect filename handling — user-controlled names vs random object keys.
  4. Determine if files are served from the app origin with user Content-Type / inline disposition.
  5. Review processors (ImageMagick, LibreOffice, ffmpeg, unzip) for known unsafe flags and shelling out.
  6. Check authZ: who can upload / overwrite / read whose objects.
  7. Confirm size limits, rate limits, and malware scanning expectations for the threat model.

Evidence Requirements

  • Upload handler location
  • Missing type/size/name controls
  • Dangerous serve or process path
  • Impact class (RCE / stored XSS / traversal / DoS)

False Positive Controls

  • Strict allowlist + random keys + non-executable storage + safe Content-Disposition
  • Uploads never served back as active content
  • Admin-only internal tooling with compensating network controls (still note residual risk)

Remediation

  1. Allowlist extensions and verify content signatures; reject mismatches.
  2. Store under random keys outside webroot; never use raw user filenames on disk.
  3. Serve via separate domain with Content-Disposition: attachment and fixed safe Content-Type where possible.
  4. Process in isolated workers with resource limits; patch converters.
  5. Enforce authN/authZ, quotas, and malware scanning for high-risk products.

Verification

Review accept→serve pipeline → Apply allowlist + random keys → Re-run axguard → Confirm no executable serve path

Related Skills

  • path-traversal, xss-analysis, command-injection, deserialization-security
  • security-triage, security-remediation

Framework Mapping

  • CWE-434
  • OWASP Top 10 2021 A04:2021 Insecure Design
  • OWASP API Security Top 10 2023 API8:2023 Security Misconfiguration

References

Research Provenance

Primary sources:

  • OWASP Top 10:2021 A04; OWASP API8:2023; CWE-434 (accessed 2026-09-15)

Secondary / internal:

  • AXGuard rules/upload.json, /axguard-upload
  • AwareXone Agentic-Bug-Hunter upload methodology (concepts only; not copied)

Datasets:

  • UVID HF dataset — category linkage concepts only (MIT license metadata review 2026-09-15)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.