T05 · Unauthorized Access and Privilege Escalation
- Location
guard.py:116- Finding
Scan Directory Boundary Bypass Through Symbolic Links
- Content
View full analysis
List[Dict[str, Any]]: """Scan a single file for security patterns.""" findings = [] try: content = filepath.read_text(errors="ignore") except Exception: return findings ``` ```python for filepath in scan_path.rglob("*"): if filepath.is_file() and filepath.suffix in scan_extensions: if any(skip in filepath.parts for skip in skip_dirs): continue findings = scan_file(filepath) # Make paths relative for f in findings: f["file"] = str(filepath.relative_to(scan_path)) all_findings.extend(findings) files_scanned += 1 ``` ### Technical Analysis The scanner recursively identifies files under a user-selected directory using `Path.rglob()`. It then checks candidates with `Path.is_file()` and reads them with `Path.read_text()`. Both operations follow symbolic links. The implementation does not resolve each candidate to its canonical path and verify that the resolved target remains inside `scan_path`. Consequently, a symbolic link located within the selected scan directory can point to a readable file outside that directory, causing the scanner to access data beyond its declared authorization boundary. This behavior contradicts the statement in `SKILL.md` that the Skill does not access files outside the specified scan directory. The behavior also exceeds the minimum filesystem access required for scanning a selected project. The scanner does not print complete file contents and does not upload scan results. However, it can disclose derived information such as matched credential types, finding categories, and line numbers from an external file. The static pre-scan warning concerning SSH keys does not indi ...[truncated 1437 chars]- Remediation
View remediation
