agentleFS
awarexoneawarexone/AXguard/path-traversal/SKILL.md

path-traversal

Skill18 starsChanged 3 months agoMITView on GitHub

Analyze path traversal and unsafe file access — use when user input influences file paths, downloads, includes, zip extraction, or static file send APIs (CWE-22 / A01:2021).

  • Reads credentials

4 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

8 rules. About 0 are common, 6 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

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

    After AXguard hits path.*.

    line 41
  2. Very specific:

    Read secrets (/etc/passwd, .env, cloud creds, keys).

    line 57
  3. Distinctive:

    Check normalization order: decode → normalize → root check (watch double-encoding).

    line 65
  4. Distinctive:

    Verify post-resolve containment under intended root (not prefix string checks alone).

    line 66
  5. Distinctive:

    Do not concatenate untrusted strings into filesystem paths.

    line 87
  6. Distinctive:

    Use object storage keys or random stored names.

    line 88
  7. Distinctive:

    After resolve, enforce directory containment.

    line 89
  8. Distinctive:

    Run with least file privileges.

    line 91

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “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

Path Traversal Analysis

Purpose

Encode defensive reasoning for path traversal (and related LFI/zip-slip): attacker-controlled path segments escape an intended directory and read/write unintended files.

When to Use / When Not to Use

Use when:

  • open, send_file, sendFile, include/require of dynamic paths, download-by-name, template path params, archive extraction, cloud key prefixes built from user input.
  • After AXguard hits path.*.
  • Upload features store user-chosen filenames (pair with file-upload-security).

Do not use when:

  • Paths are fully server-derived IDs mapped via DB to stored objects with no filesystem join of raw names.
  • Pure URL path routing without filesystem access (authorization issues belong in authorization-analysis).

Security Concepts

Traversal uses ../, encoded variants, absolute paths, symlink tricks, and archive entries with ../ (zip-slip). Safe pattern: resolve to absolute path, then verify it remains under an allowlisted root (commonpath / startsWith after normalization).

Threat Model

Attacker goals:

  1. Read secrets (/etc/passwd, .env, cloud creds, keys).
  2. Overwrite app code, templates, or SSH keys (when write sinks exist).
  3. Include/execute unintended files (language-specific LFI → RCE).

Analysis Workflow

  1. Find filesystem sinks: open/read/write, download helpers, dynamic includes, unzip/untar.
  2. Trace user influence on filename, relative segment, or archive entry name.
  3. Check normalization order: decode → normalize → root check (watch double-encoding).
  4. Verify post-resolve containment under intended root (not prefix string checks alone).
  5. For archives: validate each entry path before extract; reject absolute/.. entries.
  6. Note symlink following behavior of the API.
  7. Assess impact by readable/writable sensitivity of the process sandbox.

Evidence Requirements

  • Sink file:line and path construction
  • Missing canonicalization or root containment
  • Attacker-controlled segment
  • Impact hypothesis (secret read / overwrite / include)

False Positive Controls

  • Opaque object IDs with server-side path map
  • Strict allowlist of filenames/extensions mapped to fixed directory
  • Paths constrained to UUID-only with no separators after validation
  • Docs/examples not reachable in production code paths

Remediation

  1. Do not concatenate untrusted strings into filesystem paths.
  2. Use object storage keys or random stored names; keep display names separate.
  3. After resolve, enforce directory containment.
  4. Harden zip extraction (strip paths, reject .., extract to empty temp dir).
  5. Run with least file privileges; no secrets in web-readable trees.

Verification

Detect path joins → Enforce root containment / ID maps → Re-run axguard → Add tests for ../ and encoded variants (authorized fixtures only)

Related Skills

  • file-upload-security — malicious names and content types
  • command-injection — path args passed to shells
  • api-security, security-triage, security-remediation

Framework Mapping

  • CWE-22
  • OWASP Top 10 2021 A01:2021 Broken Access Control

References

Research Provenance

Primary sources:

  • OWASP Top 10:2021 A01 (accessed 2026-09-15)
  • CWE-22 (accessed 2026-09-15)

Secondary / internal:

  • AXGuard rules/path.json, /axguard-path
  • AwareXone Agentic-Bug-Hunter path/LFI 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.