安全软件
点击放大

Autonomous AI-powered security auditing for software teams.
scans any Git repository and produces a prioritised report with attack chains, a STRIDE threat model, and an AI-generated code risk score — all in one docker compose up. No SaaS account, no API tokens beyond your own Claude key.

![CI]()
![Python 3.12+]()


---
| Feature | | Semgrep OSS | CodeQL | Snyk |
|---------|:---:|:---:|:---:|:---:|
| Multi-engine SAST (Semgrep + CPG taint) | ✅ | ❌ | partial | ❌ |
| Joern inter-procedural taint (13 scripts) | ✅ | ❌ | ✅ | ❌ |
| AI-generated code detection | ✅ | ❌ | ❌ | ❌ |
| LLM code review (Claude) | ✅ | ❌ | ❌ | ❌ |
| Attack chain synthesis | ✅ | ❌ | ❌ | ❌ |
| STRIDE threat model | ✅ | ❌ | ❌ | ❌ |
| C (OSV) | ✅ | ❌ | ❌ | ✅ |
| 10-language Semgrep rules (135+ rules) | ✅ | partial | ❌ | partial |
| Uni secrets scanner (18 patterns) | ✅ | partial | ❌ | ✅ |
| SARIF output | ✅ | ✅ | ✅ | ✅ |
| Fully self-hosted, no auth required | ✅ | ✅ | ❌ | ❌ |
---
| Service | Stack | Port | Purpose |
|-------------|-----------------------|------|-------------------------------|
| agent | Python 3.12 / FastAPI | 8080 | Scan pipeline + REST API |
| webhook | Rust / Axum | 9000 | GitHub webhook receiver |
| dashboard | Next.js 14 | 3000 | Web UI — findings + reports |
| db | PostgreSQL 16 | 5432 | Persistence |
---
First build takes ~5–10 min (downloads Joern, Java 21, Semgrep, Rust toolchain, Node modules).
---
| Step | What it does |
|------|-------------|
| clone_repo | Clones target repo or checks out a specific commit/PR SHA |
| parse_ast | Tree-sitter: extracts languages, imports, function names, route definitions for architecture fingerprinting |
| run_semgrep | 135+ local rules across 10 languages — taint-mode for multi-hop injection flows, no auth required |
| detect_ai_code | 6-scorer heuristic engine detects AI-generated code: commit metadata, burstiness, security antipatterns, comment density, placeholder strings, phantom methods |
| run_joern | 13 CPG taint scripts for inter-procedural analysis: SQLi, SSRF, SSTI, prototype pollution, JWT confusion, XXE, deserialization, LDAP, and more |
| scan_dependencies | Parses all lockfiles, batch-queries OSV API for CVEs, fingerprints framework |
| llm_code_review | Sends high-risk files to Claude with prepended line numbers; anchors findings to actual code search |
| generate_threat_model | Claude generates a full STRIDE threat model grounded in discovered architecture and findings, mapped to OWASP Top 10 2021 and CWE IDs |
| synthesize_attack_chains | Claude combines findings into realistic multi-step exploits (e.g. SQL injection → credential dump → admin takeover) with C |
| generate_report | Assembles Markdown + SARIF output, ready for GitHub Security tab import |
---
All rules live in src//semgrep_rules/. Run locally with no Semgrep account.
| File | Language | Rules | Key Co |
|------|----------|-------|-------------|
| python-security.yaml | Python | 22 | SQLi, command injection, path tra, pickle/shel, XXE, Jinja2/Mako SSTI, SSRF, zip slip, LDAP injection, subprocess shell injection |
| ja.yaml | Java | 19 | SQLi, SpEL injection, command injection, path tra, SSRF, XXE, deserialization (ObjectInputStream/XMLDecoder), Log4Shell, Thymeleaf/FreeMarker/ SSTI, open redirect, LDAP, weak ciphers |
| php-security.yaml | PHP | 19 | SQLi taint, XSS taint, command injection, e RCE, file inclusion, XXE, session fixation, unserialize, extract(), type juggling, preg_replace /e, open redirect, LDAP, weak hashes |
| go-security.yaml | Go | 11 | SQLi, command injection, path tra, SSRF, TLS InsecureSkip, hardcoded secrets, insecure random, open redirect, template injection, weak ciphers |
| ja.yaml | Ja | 12 | Prototype pollution, NoSQL injection, ReDoS, postMessage origin bypass, path tra, innerHTML XSS, JWT no-algorithm, eval |
| csharp-security.yaml | C# | 12 | SQLi, command injection, path tra, SSRF, XXE, BinaryFormatter/NetDataContractSerializer deserialization, Json.NET TypeNameHandling, LDAP, MAC bypass, weak ciphers |
| ruby-security.yaml | Ruby | 14 | SQLi (Acti + raw Arel), command injection, eval, mass assignment, path tra, SSRF, ERB SSTI, open redirect, Marshal.load, html_safe XSS, weak hashes, ReDoS |
| typescript-security.yaml | TypeScript | 6 | Lodash prototype pollution, unsafe JSON.parse as Type, req.body as any bypass, JWT algorithm confusion, hardcoded secrets |
| secrets-uni.yaml | All | 18 | AWS (AKIA), GCP (AIza), GitHub PAT, GitLab token, Stripe, Slack, SendGrid, Twilio, SSH private keys, credentials in URLs, JWT tokens, OpenAI/Anthropic/Hugging Face keys |
| swift-security.yaml | Swift | 3 | Hardcoded credentials, insecure HTTP, allowsArbitraryLoads |
Total: 136 rules across 10 languages
---
Joern builds a Code Property Graph for the entire repo and runs inter-procedural data-flow analysis — catching that span multiple files and function calls that pattern-matching tools miss.
| Script | Rule ID | Se | Co |
|--------|---------|----------|---------|
| tainted_sql.sc | tainted-sql-injection | critical | User input → SQL sinks across call boundaries |
| command_injection.sc | tainted-command-injection | critical | User input → exec/system/popen |
| path_tra.sc | tainted-path-tra | high | User input → file open/read sinks |
| ssrf.sc | tainted-ssrf | high | User input → HTTP client URL arguments |
| template_injection.sc | template-injection-ssti | critical | User input → Thymeleaf/FreeMarker//Jinja2/Pug/EJS render |
| xxe_injection.sc | xxe-injection | high | User input → XML parser without DTD guard |
| insecure_deserialization.sc | insecure-deserialization | critical | User input → ObjectInputStream/XMLDecoder/pickle/unserialize |
| ldap_injection.sc | ldap-injection | high | User input → LDAP filter without escaping |
| open_redirect.sc | open-redirect | medium | User URL → sendRedirect/Response.Redirect |
| data_leak.sc | sensiti | high | Password/token parameters → log sinks |
| missing_auth.sc | missing-authorization | high | Endpoints missing authentication checks |
| prototype_pollution.sc | prototype-pollution | high | req.body → lodash merge/set/deepMerge |
| jwt_algorithm_confusion.sc | jwt-algorithm-confusion | critical | Algorithm from JWT header → decode call; algorithms=None |
---
The detect_ai_code step flags files that show statistical signatures of AI generation. This matters because 's 2025 GenAI Code Security Report found 45% of AI-generated code introduces security flaws — at a higher rate than human-written code.
Six independent scorers are combined with learned weights:
| Scorer | Weight | What it measures |
|--------|--------|-----------------|
| Commit signals | 30% | AI tool attribution in commit messages (Copilot, Cursor, Codeium); large atomic dumps (200+ additions, 0 deletions) |
| Code patterns | 25% | O docstrings; empty stub functions; broad except Exception; TODO placeholders; burstiness (low line-length CV < 0.35 — AAAI 2024) |
| Security antipatterns | 25% | =False, InsecureSkip, placeholder secrets ("changeme", "your-secret-key"), SHA256 for passwords, JWT =False, timing-unsafe == |
| Comment density | 10% | >20% comment-to-code ratio — AI o |
| Placeholder strings | 5% | example.com, localhost, dummy_key, foo/bar literals |
| Method | 5% | High ratio of called method names not found in stdlib or imports |
Files scoring ≥ 0.40 are flagged with a confidence score and the triggering signals listed in the report.
Research basis: arxiv:2601.17406 (97.2% F1 AI fingerprinting), AAAI 2024 burstiness metric (AUC 0.56 → 0.87), 2025 GenAI Code Security Report.
---
| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | /health | Health check |
| GET | /api/scans | List scans (?page=1&page_size=20) |
| POST | /api/scans | Trigger a scan: {"repo_url": "..."} |
| GET | /api/scans/{id} | Scan details with findings + attack chains |
| GET | /api/scans/{id}/report | Full Markdown report |
| GET | /api/stats | Aggregate stats + 30-day trend |
| GET | /api/repos | Distinct repositories scanned |
| GET | /api/repos/{name}/trend | Per-repo finding trend |
| POST | /internal/scan | Internal — used by the webhook service |
---
1. Create a GitHub App with pull_request events + contents: read + pull_requests: write permissions
2. Install on your org/repo
3. Set GITHUB_APP_ID, GITHUB_WEBHOOK_SECRET, GITHUB_APP_PRI in .env
4. Point the webhook to
The Rust webhook service HMAC-SHA256 signatures, creates a scan record, and forwards to the agent. When the scan completes, a comment is posted on the PR with a findings summary.
---
---
| | Default | Description |
|----------|---------|-------------|
| DATABASE_URL | postgresql://::5432/ | PostgreSQL connection string |
| ANTHROPIC_API_KEY | — | Required. Used for LLM review, threat model, attack chains |
| LLM_MODEL | claude-sonnet-4-6 | Claude model ID |
| CORS_ORIGINS | | Comma-separated allowed origins |
| GITHUB_APP_ID | 0 | GitHub App ID (optional) |
| GITHUB_WEBHOOK_SECRET | — | HMAC-SHA256 secret for webhook |
| GITHUB_APP_PRI | ./github-app.pem | Path to GitHub App private key PEM |
| AGENT_URL | | Internal agent URL used by webhook service |
| SCAN_SANDBOX_DIR | /tmp/ | Where repos are cloned |
| MAX_REPO_SIZE_MB | 500 | Reject repos larger than this |
| SEMGREP_TIMEOUT_SECONDS | 120 | Semgrep per-scan timeout |
| JOERN_TIMEOUT_SECONDS | 300 | Joern per-scan timeout (J ~15s) |
| LOG_LEVEL | INFO | Python log level |
---
---
DB connection error on agent startup
The depends_on: condition: ser in docker-compose.yml handles ordering. If you see this, run docker compose ps and wait for db to show healthy.
Semgrep exits code 7
A registry token is interfering. Ensure SEMGREP_APP_TOKEN is not set in your en — the scanner runs local-only.
Joern times out on large repos
Increase JOERN_TIMEOUT_SECONDS. Joern failures are non-fatal; the pipeline continues with all other findings.
LLM findings missing line numbers
The pipeline searches for each e snippet in the actual file to anchor line numbers. If the e field from Claude doesn't match any real code, line defaults to 0. Check agent logs for [anchor_line].
findings_source_check constraint
Old DB schema. Restart the agent — it drops and recreates this constraint on startup.
---
Contributions are welcome. See CONTRIBUTING.md for guidelines.
Areas we especially want help with:
[rule-proposal] in the title)---
If you discover a security in itself, please follow the process in SECURITY.md. Do not open a public issue.
---
MIT — Copyright (c) 2026 Contributors
开发语言:Python
Star 数:10
该项目属于安全软件方向的开源资源,代码结构清晰,适合安全研究人员学习参考。项目围绕AI-powered multi-language security scanner: 154 Semgrep rules, 13 Joern CPG scripts, AI code detection, and attack-chain correlation展开,提供了可运行的实现,对理解相关安全机制、工具原理与攻防技术具有较高的研究价值。
从技术实现角度看,此类项目的核心在于对底层原理的深入理解与工程化落地。开发者在研究过程中可以结合官方文档与社区讨论,梳理项目的初始化流程、核心模块职责与数据流转,逐步掌握其中的技术细节与设计思路。
1. 下载源码压缩包,解压到本地环境。
2. 根据项目类型准备对应的运行环境与依赖。
3. 按照 README 中的步骤完成配置与部署。
4. 在隔离的测试环境中运行验证,避免影响生产系统。
本资源来源于开源社区,仅供安全研究、技术学习与合法授权范围内的攻防演练使用,请勿用于任何非法或侵害他人权益的用途。使用本项目产生的一切后果由使用者自行承担。
| 资源标题 | Vulnchain - AI-powered multi-language security scanner: 154 Se |
| 所属分类 | 安全软件 |
| 发布作者 | admin |
| 发布时间 | 2026-10-05 23:02:43 |
| 下载权限 | 免费下载 |
| 附件数量 | 2 个下载链接 |
| 浏览次数 | 257 |
| 讨论数量 | 0 |
| 主题状态 | 正常讨论中 |