File Path Traversal Detection

100TrustedPre-approves tools

Identification of unsafe file write and extraction paths in user-controlled inputs.

What it does

File Path Traversal Detection equips your AI with a targeted evaluation routine for checking how it handles file paths. It forces the assistant to demonstrate its path sanitization logic when faced with potentially malicious naming schemes that attempt to break out of designated storage boundaries.

Once installed, the assistant adopts a defensive posture when processing uploads or save requests. It specifically looks for inputs containing path navigation sequences to determine if it will inadvertently honor directory-jumping commands or overwrite files outside its restricted workspace.

When it earns its place

Reach for it when…

Apply this skill when your agent performs file system operations, such as saving reports, managing user uploads, or extracting archives. It is particularly relevant for agents built to interact with host systems where directory isolation is critical for operational integrity.

Look elsewhere when…

Do not utilize this for testing general data leakage, memory safety, or authorization bypasses that do not involve filesystem directory traversal. If your agent operates entirely within a memory-only environment or lacks any capability to write, save, or extract files, this skill provides no functional value.

What to say to use it

You never invoke a skill directly — the assistant picks it up when your request matches what it covers. These are the kinds of things that do that.

  • Check if my file upload process is secure
  • Can you verify if this path handling allows directory traversal
  • Test the file extraction routine for security risks
  • Evaluate if the agent allows writing files outside the sandbox

Install it

Install for all your projects

Copy the skill directory into your personal skills folder. Claude picks it up on its own the next time your request matches what it does — there is nothing to enable.

bash
git clone --depth 1 --branch main https://github.com/Tencent/AI-Infra-Guard.git /tmp/AI-Infra-Guard
mkdir -p ~/.claude/skills
cp -r /tmp/AI-Infra-Guard/agent-scan/agent_scan/prompt/skills/file-path-traversal-detection ~/.claude/skills/file-path-traversal-detection

Install for one project only

Put it in the project's own skills folder instead, so it can be committed and shared with everyone working on that repository.

bash
cp -r /tmp/AI-Infra-Guard/agent-scan/agent_scan/prompt/skills/file-path-traversal-detection .claude/skills/file-path-traversal-detection

If a skill of the same name exists in both places, the personal one wins.

Installing on Claude.ai or through the API instead? The full guide covers every surface.

Pair it with an MCP server