detecting-path-traversal

Detects path traversal vulnerabilities in Spring Boot and JSP web application source code.

Updated Jun 24, 2026
One-click install
npx skills add https://github.com/bs-koo/gx-security --skill detecting-path-traversal-bs-koo
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: detecting-path-traversal
Source: https://github.com/bs-koo/gx-security/tree/main/skills/detecting-path-traversal
Command: npx skills add https://github.com/bs-koo/gx-security --skill detecting-path-traversal-bs-koo

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Web applications that build file paths from user input (download, viewer, attachment features) are exposed to path traversal attacks like ../ sequences reaching /etc/passwd or WEB-INF/web.xml. This Skill finds those vulnerable code patterns in SQIsoft Spring Boot and JSP/Servlet codebases and filters out false positives. ## Core Features & Use Cases - Hybrid two-stage detection: A Semgrep ruleset (with grep fallback) collects broad candidates, then AI context verification confirms real vulnerabilities by checking for getCanonicalPath() + startsWith(base) validation. - Dual stack support: Covers spring-modern (@RequestParam into Paths.get/File/Resource, ZipSlip) and jsp-legacy (download.do?filePath= blacklist-only filtering, encoding bypass risks). - Standardized reporting: Outputs confirmed findings with severity, vulnerable point, root cause, conceptual PoC, and fix guidance mapped to CWE-22 and OWASP A01:2021. - Use Case: Point it at a repository like Gseed_Web_Renew to confirm whether the file download controller's blacklist filter can be bypassed with URL-encoded %2e%2e%2f sequences. ## Quick Start Run the path traversal check on my project source at D:\SQ\Gseed_Web_Renew and report confirmed vulnerabilities with fixes.

Frequently Asked Questions about detecting-path-traversal

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I detect path traversal vulnerabilities in Java code?▼

Run the scan_pathtraversal.py script against your source directory, which uses Semgrep rules or a grep fallback to find candidates like @RequestParam values passed into Paths.get() or new File(). Each candidate is then verified in context to confirm exploitability.

What is ZipSlip and how is it detected?▼

ZipSlip is a path traversal flaw where ZIP entry names containing ../ write files outside the extraction directory. The scanner flags new File(dest, entry.getName()) calls that lack a getCanonicalPath() check confirming the output stays within the destination directory.

Does the scanner work without Semgrep installed?▼

Yes, it falls back to regex-based grep scanning when Semgrep is unavailable, though with lower recall. The script prints a fallback warning since zero findings under grep fallback does not guarantee the code is safe.

Why are blacklist filters for ../ considered insufficient?▼

Blacklist filters checking for literal ../ strings can be bypassed with URL encoding (%2e%2e%2f), double encoding, or Unicode normalization. The recommended fix is getCanonicalPath() normalization followed by a startsWith() check against the canonical allowed base directory.

What counts as a false positive in path traversal scanning?▼

Code is safe when getCanonicalPath() plus startsWith(canonicalBase) validation is present, when whitelist ID mapping hides real paths from users, or when paths come entirely from server-side constants. These patterns are excluded during AI context verification.