FURQANAHMAD34/security-templates

GitHub: FURQANAHMAD34/security-templates

一套整合 DAST 与 SAST 的生产级漏洞赏金自动化工具包,通过统一入口脚本实现从侦察到误报消除再到 PoC 生成的完整安全测试流程。

Stars: 0 | Forks: 0


# 🛡️ 终极安全分析模板 一个全面且达到生产级标准的模板库,用于**静态分析 (SAST)** 和**动态分析 (DAST)** 安全测试。旨在覆盖完整的漏洞谱系——从源代码缺陷到实时目标利用。 ## 📂 仓库布局 ``` security-templates/ ├── README.md ← you are here ├── BUG-BOUNTY-PLAYBOOK.md ← end-to-end methodology + full coverage checklist ├── nuclei/ ← DYNAMIC analysis (DAST) — live target scanning │ ├── README.md │ ├── _skeletons/ ← copy-paste starting points for every protocol │ ├── cves/ ← curated high-impact CVEs (2017→2024, KEV/EPSS) │ ├── exposures/ ← leaked files, secrets, config disclosure │ ├── vulnerabilities/ ← SQLi, XSS, SSRF, SSTI, LFI, RCE, XXE … │ ├── modern/ ← smuggling, cache poisoning, GraphQL, JWT, SSRF→cloud, proto-pollution │ ├── access-control/ ← IDOR/BOLA, mass assignment, forced-browse, CORS, session, data exposure │ ├── headers/ ← header manipulation: IP/host auth-bypass, X-Forwarded-*, verb tampering, reset poisoning │ ├── api/ ← API sec: Swagger/OpenAPI, GraphQL, BOLA, JWT alg-confusion, rate-limit, data exposure │ ├── cloud/ ← cloud metadata SSRF, bucket takeover, cred exposure, k8s/docker API │ ├── auth/ ← OAuth/OIDC/SAML, 2FA bypass, JWT kid injection, registration flaws │ ├── ai/ ← AI/LLM: prompt injection, exposed AI keys/endpoints, framework debug, AI-SSRF │ ├── fuzzing/ ← ⚡ ADAPTIVE behavioral fuzzers (runtime payloads, DAST mode) │ ├── payloads/ ← runtime payload wordlists (xss/sqli/lfi/ssti/cmdi/ssrf) │ ├── misconfiguration/ ← CORS, headers, dir-listing, TLS │ ├── default-logins/ ← weak / default credentials │ ├── takeovers/ ← subdomain takeover fingerprints │ ├── technologies/ ← tech/version detection │ └── workflows/ ← chained multi-template logic ├── semgrep/ ← STATIC analysis (SAST) — source code scanning │ ├── README.md │ ├── _skeleton.yaml │ ├── python/ javascript/ java/ go/ php/ ruby/ csharp/ cpp/ multi/ ← per-language rules │ ├── cicd/ ← GitHub Actions script-injection / pwn-request / supply-chain │ ├── iac/ ← Dockerfile / compose / Terraform / k8s misconfig │ └── secrets/ generic/ ← secret detection + cross-cutting rules ├── trivy/ ← IaC / container / dependency scanning ├── codeql/ ← deep dataflow static analysis └── scripts/ ← runners, CI, recon pipeline, adaptive payload generator ├── run-all.sh / run-all.ps1 ├── oneshot.sh ← fully-piped recon→auth→scan(unauth+authed)→dedupe→PoC→dashboard ├── recon-master.sh ← deepest recon: ASN→CIDR, subs (passive+brute+permute), JS/secret harvest, screenshots ├── auth-capture.py ← 🔐 Playwright login / browser-cookie capture → auth-headers.txt ├── intruder.sh ← Burp Intruder + Repeater on the CLI (request manipulation) ├── race.sh ← race-condition / single-packet attack (limit-overrun, coupon reuse) ├── bizlogic.sh ← business-logic tampering probe (price/quantity/role/workflow) ├── spyhunt-scan.sh ← spyhunt Target-Intel + vuln modules wrapper ├── api-scan.sh ← API/GraphQL deep flow (swagger parse → api/access-control/auth templates) ├── monitor.sh ← continuous monitoring: diff new subs/hosts/URLs, optional --notify ├── notify.sh ← Slack / Discord / Telegram webhook notifications ├── bug-bounty-pipeline.sh ← recon → live → crawl → known scan → adaptive fuzz ├── dynamic-payload-generator.py ← probes behavior, synthesizes context-aware payloads └── github-actions-security.yml ``` ## 🎛️ 单一入口点 — `secsuite.sh` 仓库根目录下的一个脚本即可运行并验证所有内容: ``` ./secsuite.sh check # validate all templates+scripts + self-test the tools ./secsuite.sh doctor # show which external tools are installed ./secsuite.sh setup # install the whole Fedora toolchain (DEFAULT: offline ZIP, no git clone) ./secsuite.sh setup --online # old path: git clone + go install @latest ./secsuite.sh fetch # just download all source ZIPs into the current folder ./secsuite.sh offline # install from ZIPs already in the current folder ./secsuite.sh templates # download+merge official+custom+community templates ./secsuite.sh oneshot "*.x.com" # full piped recon→scan→dedupe→PoC ./secsuite.sh oneshot app.x.com --login https://app.x.com/login # authed + unauthed in one run ./secsuite.sh auth login --url https://app.x.com/login # capture a session for reuse ./secsuite.sh auth from-browser --domain x.com --browser firefox # grab your live browser cookies ./secsuite.sh recon x.com --aggressive --severity high,critical --tags rce,sqli ./secsuite.sh recon-master "*.x.com" --brute # deepest recon: subs+JS+params+intel, feeds oneshot ./secsuite.sh recon-extra x.com # favicon→Shodan pivot, GitHub recon, waymore, deep-JS # secrets (LinkFinder/SecretFinder/xnLinkFinder/mantra/ # jsluice/sourcemapper + KeyReaper), csprecon, git-dumper, # 401/403 bypass, S3 buckets (auto-runs inside oneshot) ./secsuite.sh vuln-extra x.com # vuln-CLASS detectors: takeover(subzy/baddns), CRLF, # SSTI(TInjA), cache-poison(toxicache), NoSQLi, CORS(Corsy), # open-redirect(Oralyzer), framework-secrets(badsecrets), # smuggling, API-brute(kiterunner/sj), GraphQL(graphw00f/ # graphql-cop/clairvoyance) + HackTricks safe-marker quick-checks # (LFI/SSTI/redirect/SQLi/CORS, response-shaped) → docs/HACKTRICKS-METHODOLOGY.md ./secsuite.sh net-recon x.com # NETWORK layer: IP discovery (dnsx A/AAAA/PTR, asnmap→CIDR, # hakip2host, uncover) → hunt the REAL origin behind the CDN # (cdncheck, SPF ip4: leaks, favicon pivot, hakoriginfinder) → # PROVE the backend IP (curl --resolve vs CDN baseline) → nmap # ports → NSE vuln+vulners / service-NSE / testssl / nuclei # network templates (oneshot pops this in a 2nd terminal) # + 50-service unauth/default-cred probe matrix → docs/NETWORK-RECON.md ./secsuite.sh authz-diff --urls ranked-params.txt --session-a auth/admin.txt --session-b auth/user.txt # headless Autorize — differential BOLA/IDOR/access-control ./secsuite.sh api-scan https://api.x.com --auth-headers auth/auth-headers.txt # API/GraphQL deep scan ./secsuite.sh spyhunt x.com --deep # spyhunt Target-Intel + vuln modules ./secsuite.sh monitor x.com --notify --interval 3600 # continuous new-asset alerts (cron-friendly) ./secsuite.sh templates # sync official (ALL CVEs 2010→now) + community feeds ./secsuite.sh intruder -request req.txt -w payloads.txt --auth-headers auth/auth-headers.txt # Burp Intruder ./secsuite.sh repeater -u https://x.com/ -H "X-Original-URL: /admin" # Burp Repeater (one request) ./secsuite.sh static ./src --sarif # full SAST sweep ./secsuite.sh dedupe a.jsonl b.jsonl --near -o merged.jsonl ./secsuite.sh confirm merged.jsonl -o confirmed.jsonl --report confirm.md # differential FP-killer ./secsuite.sh rce-confirm --nuclei findings.jsonl -o rce/ # upgrade cmdi/SSTI primitives to CONFIRMED-EXEC # with a SAFE arithmetic marker (no real command run) + PoC ./secsuite.sh poc confirmed.jsonl --out poc/ # PoCs carry the CONFIRMED/FP verdict ./secsuite.sh dashboard --recon-dir ./recon-x.com # one shareable HTML report ./secsuite.sh lint nuclei/ --min warn # static false-positive linter for templates ``` ### ✅ 确认阶段 — 在报告前消除误报 `confirm` 会**差异化地**重新测试每一个发现:它重放一次攻击,然后 重放一个*中和后的孪生请求*(将 payload 替换为无害的 token),只有当证据**伴随** payload 出现且**在没有** payload 时消失,它才 信任该发现。盲注/基于时间的漏洞类别通过可重复的响应时间差值来确认。 每个发现都会被评级为 **CONFIRMED / LIKELY / FALSE-POSITIVE / UNCONFIRMED / MANUAL**,误报将被丢弃,判定结果会直接传入 PoC 的 `SUBMISSION.md`。它会在 `oneshot` 中自动运行(使用 `--no-confirm` 禁用): ``` ./secsuite.sh confirm findings-dedup.jsonl -o clean.jsonl --keep confirmed,likely --report confirm.md ``` ### 🔤 编码 / WAF 绕过 — “服务器会接受什么?” 服务器和 WAF 在输入如何解码上存在分歧。`encode` 映射了这一差距:它 将任何 payload 跨越 **29 种方案**进行变异(URL 单次/双重/三重/全十六进制, base64,HTML 实体,`\uXXXX`,`%uXXXX`,超长 UTF-8,空字节,大小写混合, SQL/JS 注释,UTF-7……),并且 — 在 `probe` 模式下 — 以每种编码发射一个测试载荷(canary),以检测目标实际**解码**了哪些编码(此时,仅检查原始字节的 WAF 就可以通过这些编码被绕过): ``` ./secsuite.sh encode mutate --payload "" --out ./enc # every variant ./secsuite.sh encode probe --url "https://x.com/search?q=FUZZ" --attack-class xss --out ./enc # → accepted-encodings.txt + probe-report.md + armed-.txt (payloads re-encoded # into ONLY the schemes the server accepts — feed straight to ffuf/intruder/nuclei) ./secsuite.sh encode probe --url "https://x.com/api" -X POST -H "Content-Type: application/json" \ -d '{"q":"FUZZ"}' --attack-payloads nuclei/payloads/sqli.txt --out ./enc # …or drive the context-aware generator with the accepted set: ./secsuite.sh payloads --url "https://x.com/s?q=FUZZ" --accepted ./enc/accepted-encodings.txt --out ./gen ``` ### 🔐 经过身份验证的扫描(登录**与**未登录状态) 捕获一个真实的会话,然后让 `oneshot` 自动测试这两种状态: ``` # 1) open a browser, log in, press ENTER — cookies/token/CSRF are captured ./secsuite.sh oneshot app.target.com --login https://app.target.com/login # …or reuse the session already in your browser: ./secsuite.sh oneshot app.target.com --browser-cookies firefox # …or feed a previously captured file: ./secsuite.sh oneshot app.target.com --auth-headers auth/auth-headers.txt ``` 它会爬取**经过身份验证的**攻击面,然后对其扫描**两次**:未认证状态 (→ 通过 `nuclei/access-control/` + `nuclei/headers/` 发现失效的访问控制 / IDOR / 强制浏览)和认证状态(→ 发现登录后应用中的注入和逻辑漏洞)。添加 `--auth-only` 以跳过未登录的检查。如果您的 cookie/token 已过期,会话验证器会发出警告(否则您将只是在扫描公开站点)。 ### 合并的 HTML 仪表板 每次扫描都会自动生成 `dashboard.html` — 这是一个单一的**自包含**报告 (内联 CSS/JS,无 CDN),合并了去重后的发现 + PoC + 截图: 严重性摘要、实时搜索、严重性/类别过滤器,以及包含 curl、原始请求/响应、复现步骤、修复建议和参考的可折叠卡片。 它是 **XSS 安全**的(攻击者的 payload 在嵌入数据中已被中和),因此 可以安全地打开和分享。从任何发现文件中生成一个: ``` ./secsuite.sh dashboard --nuclei findings-dedup.jsonl --screens ./screens \ --title example.com -o report.html # add --embed for a true single file ``` `./secsuite.sh check` 是一个“它能正常工作吗?”的命令 — 它会解析每个模板, 对每个脚本进行语法检查,并在样本数据上对排名、去重 和 PoC 工具进行**功能性自测**。 ### 过滤(严重性 / 标签) `recon` 和 `oneshot` 会将过滤器直接传递给 Nuclei,作用于整个 合并的模板集: ``` ./secsuite.sh oneshot x.com --severity critical,high ./secsuite.sh recon x.com --tags rce,sqli,ssrf --exclude-tags fuzz,dos ``` ### 去重 重叠的来源(官方 + 自定义 + 社区)经常会标记出同一个漏洞。 扫描器会在生成 PoC 之前自动去重:精确匹配(`template-id`+URL)和 `--near`(URL+漏洞类别,保留最高严重性)。输出:`findings-dedup.jsonl` + `findings-dedup.md`。 ## 📦 安装 (Fedora) 只需运行: ``` ./secsuite.sh setup && source ~/.bashrc ``` **`setup` 默认使用离线 / ZIP 模式** — 它会通过普通的 HTTPS 下载每个源的 `.zip` 文件并 从中构建,因此它**从不运行 `git clone`**,也不会卡在 GitHub 用户名/密码提示上(一个损坏的凭证助手)。它还避开了三个 使用 `go install …@latest` 会失败的工具(`mantra`、`gitleaks`、`trufflehog`),方法是 从本地源码构建它们。配置选项: ``` ./secsuite.sh setup --zip-dir ~/sec-zips # choose where zips live (default ~/sec-zips) ./secsuite.sh setup --download-only # fetch zips now, install later ./secsuite.sh setup --no-download # install from zips already downloaded ./secsuite.sh setup --online # OLD path: git clone + go install @latest ``` 或者直接驱动这两部分(例如:在一台机器上下载,在另一台机器上安装): ``` mkdir ~/sec-zips && cd ~/sec-zips ../security-templates/secsuite.sh fetch # curl every source ZIP here (no git, no auth) ../security-templates/secsuite.sh offline # build + install from these ZIPs ``` 有关拉取的每个 GitHub 仓库的完整列表及其各自的安装方式,请参阅 **`offline/SOURCES.md`**。有两个仓库可能不可用,并被报告+跳过: `m4ll0k/Infoga`(已被移除)和 `coffinxp/oxabnormal`(通常是私有的)。 ## ⚡ 单命令工作流 (Fedora) ``` # 0) Install the ENTIRE toolchain (DAST + SAST + wordlists + payloads) # Also downloads & MERGES all template sources: official (~10k) + this repo's # custom + ~20 community GitHub repos → one manifest the scanners load together. # Just run `./secsuite.sh setup` (offline/ZIP by default; add --online to force clones). ./secsuite.sh setup && source ~/.bashrc ./scripts/update-templates.sh # (re)merge template sources anytime ./scripts/update-templates.sh --list # show every merged source # 1) DYNAMIC — give it a wildcard/domain or a URL; it does everything: # subdomains → resolve → http ALIVE check → crawl → param mining → # ENDPOINT PRIORITIZATION (bug-score) → content fuzzing → nuclei # (official+custom+DAST fuzz) → dalfox/sqlmap/commix → nikto/testssl/spyhunt → # JS secrets → AUTO-POC GENERATION for every finding ./scripts/recon-scan.sh "*.example.com" --aggressive ./scripts/recon-scan.sh https://app.example.com # 1b) FULLY-PIPED one-shot (output→input the whole way, httpx is the alive-gate): # subfinder|assetfinder|crt.sh → anew → dnsx → httpx(ALIVE) → katana|gau → # prioritize-endpoints → nuclei(-jsonl -irr) → poc-generator ./scripts/oneshot.sh "*.example.com" -r 80 # Generate PoCs from any existing Nuclei JSONL run: nuclei -l hosts.txt -t nuclei/ -jsonl-export out.jsonl -irr python ./scripts/poc-generator.py --nuclei out.jsonl --out ./poc # → poc/INDEX.md # 2) STATIC — give it a source dir or a git URL; runs every SAST tool: # semgrep(packs+custom) + bandit/gosec/njsscan/brakeman/cppcheck + # gitleaks/trufflehog + trivy/checkov/tfsec + dep audits ./scripts/static-scan.sh https://github.com/org/repo --sarif ./scripts/static-scan.sh ./local/source ``` 有关完整的工具清单,请参阅 **`TOOLS.md`**;有关 CVE/CWE 矩阵,请参阅 **`COVERAGE.md`**。 这两个编排器都会同时使用工具**内置的**模板/规则**以及**本仓库的**自定义**模板。 ## 🧭 静态与动态 — 使用哪一个 | 维度 | 静态 (SAST) | 动态 (DAST) | |--------------------|----------------------------------------|------------------------------------------| | **目标** | 源代码、IaC、二进制文件 | 运行中的应用 / 实时主机 | | **包含工具** | Semgrep, CodeQL, Trivy | Nuclei | | **发现内容** | 不安全的模式、污点流、机密信息| 可利用的、可达的漏洞 | | **时机** | Pre-commit, CI, 代码审查 | Staging / 授权的 prod, 侦察 | | **误报**| 较高(无运行时上下文) | 较低(证明可达) | | **覆盖率** | 所有代码路径,包括不可达的 | 仅限已部署和暴露的内容 | **最佳实践:** *两者*都运行。SAST 能以低成本尽早捕获问题;DAST 则能确认实际可利用的内容。两者结合,可以覆盖彼此单独存在时的盲区。 ## 🚀 快速开始 ### 动态 (Nuclei) ``` # Install go install -v github.com/projectdiscovery/nuclei/v3/cmd/nuclei@latest # Run a single template nuclei -u https://target.example.com -t nuclei/vulnerabilities/sqli-error-based.yaml # Run a whole category nuclei -u https://target.example.com -t nuclei/exposures/ # Validate templates before use nuclei -t nuclei/ -validate ``` ### 静态 (Semgrep) ``` # Install pip install semgrep # Scan a codebase with these rules semgrep --config semgrep/ /path/to/source # Single language ruleset semgrep --config semgrep/python/ /path/to/source ``` ## 🎯 覆盖范围映射表 (OWASP Top 10 2021) | OWASP | 静态规则 | 动态模板 | |------------------------------------|-------------------------|-----------------------------| | A01 失效的访问控制 | idor, path-traversal | lfi, idor probes | | A02 加密机制失效 | weak-crypto, secrets | tls-misconfig, security-headers | | A03 注入 | sqli, cmdi, xss, ssti | sqli, xss, cmdi, ssti, xxe | | A04 不安全的设计 | generic patterns | workflows | | A05 安全配置错误 | debug-mode, cors | cors, dir-listing, headers | | A06 易受攻击的组件 | (Trivy) | technologies/version detect | | A07 身份验证失效 | hardcoded-creds | default-logins | | A08 完整性失效 | insecure-deserialization| — | | A09 日志记录失效 | logging rules | — | | A10 SSRF | ssrf | ssrf-generic | 有关详细信息以及用于构建您自己模板的骨架,请参阅每个子目录下的 `README.md`。
标签:CISA项目, DAST, SAST, 域名收集, 安全测试, 密码管理, 应用安全, 恶意软件分析, 攻击性安全, 特征检测, 盲注攻击, 逆向工具