AI-Infra-Guard
ApplicationTencent/AI-Infra-Guard
AI Red Teaming platform securing AI ecosystems via agent, skill, MCP and infrastructure scans.
Overview
A full-stack AI Red Teaming platform that integrates Agent Scan, Skills Scan, MCP Scan, AI infrastructure vulnerability scanning, and LLM jailbreak evaluation. It provides comprehensive, intelligent security self-examination for AI systems, with a web interface and standalone CLI tools.
README Preview
\n \n\n\n 📖 Documentation | \n 🌐 🇨🇳 中文 · 🇯🇵 日本語 · 🇪🇸 Español · 🇩🇪 Deutsch · 🇫🇷 Français · 🇰🇷 한국어 · 🇧🇷 Português · 🇷🇺 Русский\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n\n \n \n \n \n \n \n \n \n \n\n\n \n \n \n\n\n\n\n\n 🚀 AI Red Teaming Platform by Tencent Zhuque Lab\n\n\nA.I.G (AI-Infra-Guard) integrates capabilities such as ClawScan(OpenClaw Security Scan), Agent Scan,AI infra vulnerability scan, MCP Server & Agent Skills scan, and Jailbreak Evaluation, aiming to provide users with the most comprehensive, intelligent, and user-friendly solution for AI security risk self-examination.\n\n\n We are committed to making A.I.G(AI-Infra-Guard) the industry-leading AI red teaming platform. More stars help this project reach a wider audience, attracting more developers to contribute, which accelerates iteration and improvement. Your star is crucial to us!\n\n\n \n \n \n\n\n\n\n## 📋 User Feedback Survey\n\nHelp us improve A.I.G! Please take 3-5 minutes to fill out our [User Feedback Survey](https://doc.weixin.qq.com/forms/AJEAIQdfAAoAFkA0QbdAFwCNcKSO0BFLf). Users who provide high-quality feedback and leave a valid email address will receive an exclusive Tencent souvenir gift.\n\n\n\n## 🚀 What's New\n\n- **2026-08-17** · [v4.5.2](https://github.com/Tencent/AI-Infra-Guard/releases/tag/v4.5.2) — Skill-Scan: .pyc bytecode bypass detection + charset smuggling defense; MCP-Scan: RCE prevention via tool whitelisting in dynamic mode; new SkillJack research project; vuln library expanded to 2000+ CVE rules.\n- **2026-07-30** · [v4.5.1](https://github.com/Tencent/AI-Infra-Guard/releases/tag/v4.5.1) — Jailbreak Evaluation: 4 multi-turn jailbreak attacks (Many-Shot, PAIR, GOAT, ActorAttack); Agent-Scan: 5 new OWASP skills + web-exfiltration detection (10 skills total); MCP-Scan: 4 new security rules\n- **2026-07-27**
FAQ (5)
TroubleshootingHow do I fix 'undefined: TestDemoAgent, BaseUrl, Token' build errors and websocket English/Chinese assertion failures when running `go test ./...` in AI-Infra-Guard?
Update main to include PR #674 (commit 51d63e2) and PR #677 (commit ff82482), then run:
git pull --ff-only
go build ./...
go test ./... -count=1
Those changes fix the stale references in common/agent/tasks_test.go (TestDemoAgent, BaseUrl, Token, Model), align the five common/websocket assertions with the returned English error messages, and make environment-dependent tests resolve paths from the repo root or skip when Chrome, the local 127.0.0.1:8265 service, or /mcp-server is unavailable. PR #677 also adds .github/workflows/go-test.yml, so CI now runs go build ./... and go test ./... -count=1 on pushes to main and pull requests.
If you cannot update immediately, either define or remove the stale test symbols in common/agent/tasks_test.go, and update the websocket test expectations to match the actual API response language instead of mixing English responses with Chinese expected strings.
TroubleshootingHow to fix aig-skill-scan security bypass where malicious code hidden in .venv/node_modules directories is not detected?
The vulnerability occurs because aig-skill-scan unconditionally skips all scanning of directories defined in _TREE_SKIP_DIRS (including __pycache__, .git, node_modules, .venv, venv, dist, build, .next, .nuxt) for performance. Attackers can evade detection by placing malicious scripts in these directories and invoking them from legitimate Skill code (e.g. subprocess.run(["python", ".venv/hidden.py"])).
Remediation steps:
1. Do not treat directories in _TREE_SKIP_DIRS as fully trusted.
2. Retain the default behavior of skipping full recursive scans for these directories to preserve performance.
3. Add targeted detection logic: when the scanner identifies Skill code executing, importing, or loading files from skipped directories, either run an on-demand security scan on the referenced target file or trigger a risk alert immediately.
TroubleshootingHow do I fix AI-Infra-Guard not scanning __pycache__ and .pyc files and falsely reporting a malicious skill as SAFE?
This affects AI-Infra-Guard v4.5.1. dir_tree and the static pre_scan pass exclude __pycache__ and .pyc/.pyo/.pyd files, so CPython bytecode can execute during import while remaining invisible to the scanner.
Preferred fix: upgrade to a release containing the PR fix(skill-scan): stop hiding compiled bytecode from audit surface. The fix includes compiled bytecode in both the LLM directory tree and static scan.
If you must patch v4.5.1 yourself:
1. Edit skill_scan/tools/dir/dir_actions.py.
2. Remove '__pycache__' from _IGNORED_DIRS.
3. Remove '.pyc', '.pyo', and '.pyd' from _IGNORED_EXTS.
4. Apply the same inclusion change to the static pre_scan file enumeration.
5. Restart the scanner and rescan.
Immediate workaround for an untrusted skill:
find skill -type d -name __pycache__ -print
find skill -type f \( -name '*.pyc' -o -name '*.pyo' -o -name '*.pyd' \) -printManually inspect or decompile discovered bytecode. Reject skills containing unexpected compiled files. To remove non-native bytecode before installation:
find skill -type d -name __pycache__ -prune -exec rm -rf {} +
find skill -type f \( -name '*.pyc' -o -name '*.pyo' \) -deleteTreat
.pyd files as native Windows executable code and review them separately. A SAFE verdict with 100/100 on an unpatched scanner does not prove that a skill is safe.TroubleshootingWhy does AI-Infra-Guard MCP dynamic scan only show the first content block of MCP tool results?
This is a bug in MCPTools.call_remote_tool (mcp_scan/utils/mcp_tools.py), which read only CallToolResult.content[0], discarding later content blocks, structuredContent, isError, and result/block metadata. Fixed by PR #727 (merged as commit 7b62e47110): update AI-Infra-Guard to a version including that commit. After the fix, call_remote_tool serializes the full CallToolResult — all content blocks, structured content, error status, and metadata — so structured-only responses and multi-block results reach the scan agent. The plain-text fast path for simple single-block results is preserved, and readable text is prioritized over opaque media within the 20,000-character history preview so later evidence is not hidden.
TroubleshootingWhy does LLM security evaluation send 80+ requests per minute even with concurrency set to 1 and QPM limited to 20, and why do requests continue after stopping the task?
This occurs because prompt evaluation does not apply rate-limit-aware backoff when the target model returns QPM/429 errors. Failed calls can trigger rapid retries or additional dispatches, exceeding the configured concurrency and quota. Task shutdown also does not immediately terminate the whole worker process group, so in-flight or queued requests continue briefly.
Fix: upgrade to the release containing PR fix(prompt-eval): rate-limit aware backoff, circuit breaker and process-group termination (fixes #633), then restart the evaluation service/workers. The fix adds QPM/429 backoff, opens a circuit breaker when the model is rate-limited, and terminates the process group when the task is stopped.
Temporary workaround: enforce a client-side rate limit below the model's QPM quota, disable immediate retries or use exponential backoff for QPM errors, and manually stop/restart the worker process after cancelling a task to flush remaining requests.