Skip to content

feat(detector): implement AI data exfiltration detector (Epic 4-F3)#32

Open
KbWen wants to merge 12 commits into
mainfrom
feat/data-exfiltration
Open

feat(detector): implement AI data exfiltration detector (Epic 4-F3)#32
KbWen wants to merge 12 commits into
mainfrom
feat/data-exfiltration

Conversation

@KbWen

@KbWen KbWen commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Implements the AI Data Exfiltration Detector (Epic 4-F3) to audit code for LLM prompt exfiltration, MCP tool leaks, and public web writes.

KbWen added 12 commits June 15, 2026 10:58
- Implemented DataExfiltrationDetector checking LLM prompt, MCP tool leaks, and public web writes.
- Added esprima AST fallback and Shannon entropy filters.
- Completed unit tests and coverage optimization (247 passes, 92% module coverage).
- Added logging for production observability readiness.

Reviewed-by: wen
…ypasses in silent installer

- Strip JS block comments, python docstrings, single line comments, and string literals before performing human-in-the-loop (HITL) indicators checks.
- Expand data exfiltration text scanner to dynamically extract balanced parenthesized blocks to support nested calls.
- Initialize has_mcp in JS/TS visitor and text scanner fallback dynamically from filename.
- Add test coverage for long entropy keys, nested parenthesized blocks, mcp filename heuristics, and docstring/comment HITL bypasses.

Reviewed-by: wen
@KbWen

KbWen commented Jun 26, 2026

Copy link
Copy Markdown
Owner Author

🔒 Security Hardening & Evasion Defenses Applied (加固與規避防禦已完成)

This PR has been successfully hardened against all bypass vectors identified by security experts and Tenth Man auditors:

🛠️ Key Improvements (關鍵改進項目):

  1. SSRF IP Normalization (SSRF IP 標準化): Normalized IPv4 formats (decimal, octal, hexadecimal, and IPv6-mapped Hex e.g., ::ffff:a9fe:a9fe -> 169.254.169.254) to prevent cloud metadata SSRF evasion.
  2. Case Normalization (大小寫正規化): Enforced lowercase conversion at path and hostname checks to prevent case-mixing protocol bypasses (e.g. HTTP://).
  3. TOCTOU Defenses (時間差防範): Cleared variable taint validation status instantly upon any assignment, modification, or loop iteration to prevent variable re-assignment reuse bypasses.
  4. Dummy Validation Block (防範虛假驗證): Restricted validation flags to standalone expression checks and control flow conditions (e.g. if (validate_path(x))), blocking ignored boolean validation return values.
  5. JS AST Visitor Hardening (JS 走訪器加固): Added support for JS template literal interpolation, object destructuring in MCP parameters, and monitored file transfer utilities (fs.copyFileSync, fs.renameSync).

🧪 Verification (驗證結果):

  • All Tests Pass: 281/281 unit tests passed successfully on Windows env.
  • Self-Scan: Local self-scan achieved Grade A (100/100) with 0 warning findings.

Ready for final review and merge!

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