Skip to content

feat: add Path Traversal vulnerability - #233

Open
StressTestor wants to merge 1 commit into
confident-ai:mainfrom
StressTestor:feat/path-traversal-vulnerability
Open

feat: add Path Traversal vulnerability#233
StressTestor wants to merge 1 commit into
confident-ai:mainfrom
StressTestor:feat/path-traversal-vulnerability

Conversation

@StressTestor

@StressTestor StressTestor commented Jun 15, 2026

Copy link
Copy Markdown

what

adds a dedicated PathTraversal vulnerability for testing path / directory traversal in LLM output handling. three sub-types: relative_path_traversal, absolute_path_traversal, encoded_path_traversal.

from deepteam.vulnerabilities import PathTraversal

path_traversal = PathTraversal(
    types=["relative_path_traversal", "absolute_path_traversal", "encoded_path_traversal"]
)

why

path traversal is the last OWASP LLM05 (improper output handling) file-access vuln without a dedicated module. shell injection, sql injection, and ssrf already ship. an LLM app that takes a filename and reads or serves it is vulnerable when it doesn't validate the path: a relative ../../../etc/passwd, an absolute /etc/passwd, or an encoded %2e%2e%2f that slips past a naive filter.

sibling to #232 (XSS). together they round out the output-handling vulnerability set.

what's in it

  • deepteam/vulnerabilities/path_traversal/ - the vuln, the three sub-types, and baseline-attack templates (relative ../, absolute + file://, and encoded / double-encoded / overlong-UTF-8 payloads)
  • deepteam/metrics/path_traversal/ - the PathTraversalMetric judge: scores 0 when the agent reads or serves a file outside the intended directory (or passes the payload into a file tool), 1 when it normalizes, confines, rejects, or decodes-then-validates
  • wired into the vulnerability registry, risk mapping, CLI, and the OWASP LLM05 map
  • docs page plus README and catalog entries, matching the sibling vulns

it mirrors the existing ssrf module structure so it reads the same as the rest of the codebase.

scope

wired into the OWASP LLM05 framework only. the injection siblings also appear in the NIST, MITRE, and EU AI Act maps. extending path traversal into those is a clean follow-up, since each wants its own framework-specific category rather than a copy of SSRF's slot.

tests

tests/test_core/test_vulnerabilities/test_path_traversal.py - type validation, per-type template generation, and the assess/simulate paths, mirroring the sibling tests. the model-calling tests need OPENAI_API_KEY, same as the existing vulnerability tests (they pass in CI via the secret).

Adds a dedicated PathTraversal vulnerability covering relative, absolute,
and encoded directory traversal in LLM output handling, mirroring the
existing ssrf/sql_injection/shell_injection modules.

Path traversal was the last OWASP LLM05 (Improper Output Handling)
file-access vulnerability without a dedicated module. Wires PathTraversal
into the vulnerability registry, risk mapping, CLI, and the LLM05
category. Follow-up to the XSS PR; together they complete the
output-handling set from confident-ai#225.

Includes PathTraversalMetric, baseline-attack templates per sub-type, a
docs page, README/catalog entries, and tests mirroring the siblings.
@vercel

vercel Bot commented Jun 15, 2026

Copy link
Copy Markdown

@StressTestor is attempting to deploy a commit to the Confident AI Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant