Ir al contenido

📕 现场手册 11.1:自动化与CI/CD(规模武装)

分类:仅供红队阅览

0阅读

分类:仅限红队成员查看

目标:我们将实施持续攻击能力,并将先进的进攻工具集成到自动化工作流中。

MITRE ATT&CK:T1558,T1595(主动扫描)。

传统sqlmap手动扫描方式在扫描数千个资产时很慢。我们需要速度与规避能力。

基于YAML模板的扫描器。可以定义精确的漏洞并针对10,000个主机在几分钟内发起攻击。

基于错误的SQL注入YAML模板:

id: error-based-sqli
info:
name: Error Based SQL Injection
severity: critical
requests:
- method: GET
path:
- "{{BaseURL}}/product?id=1'"
matchers:
- type: word
words:
- "You have an error in your SQL syntax"
part: body

一种用Python编写的现代SQLMap替代工具。

  • 优势:专门优化用于< strong >WAF规避和处理复杂HTTP头。
  • 用途:它类似于SQLMap,但具有更好的启发式算法来检测难以发现的注入。 ghauri -u "http://target.com/?id=1" --dbs

我们不会从终端运行SQLMap。我们将作为REST服务运行,以便我们的脚本可以协调攻击。

  1. 启动服务器:sqlmapapi -s
  2. 创建任务:POST /task/new
  3. 启动扫描:POST /scan/<task_id>/start
  4. 读取数据:GET /scan/<task_id>/data

我们将攻击转化为开发阶段(“紫色团队管道”)

GitHub Actions 工作流(示例): 每当开发团队向staging执行“推送”时,我们就会发起攻击。

name: Offensive Pipeline
on: [push]
jobs:
security-test:
runs-on: ubuntu-latest
steps:
- name: Deploy App
run: ./deploy_staging.sh
- name: Nuclei Scan
run: nuclei -u [https://staging-app.com](https://staging-app.com) -t sqli-templates/ -o vulnerabilities.txt
- name: Ghauri Deep Scan
if: steps.nuclei.outputs.found == 'true'
run: ghauri -u [https://staging-app.com/vuln-endpoint](https://staging-app.com/vuln-endpoint) --dbs
  • 反馈循环:如果Nuclei在管道中发现漏洞,构建必须自动失败。
  • 误报:我们将根据我们技术栈特有的错误信息调整Nuclei模板的matchers,以减少噪音。