Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
threatest — CLI和Go框架,用于威胁检测规则的端到端测试。触发攻击技术并在Datadog和Elastic Security等安全平台中验证警报。 | Kitploit
工具/GitHubGitHub/datadog/threatest
防御工具渗透测试红队
GitHubdatadog/threatest

threatest

CLI和Go框架,用于威胁检测规则的端到端测试。触发攻击技术并在Datadog和Elastic Security等安全平台中验证警报。

查看仓库网站
3452761天前Kitploit 审核通过

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

Threatest

单元测试 静态分析

Threatest

Threatest 是一个用于端到端测试威胁检测的 CLI 和 Go 框架。

Threatest 允许你 引爆 一种攻击技术,并验证预期告警已在您最喜欢的安全平台中生成。

阅读公告博客文章:https://securitylabs.datadoghq.com/articles/threatest-end-to-end-testing-threat-detection/

概念

引爆器

引爆器 描述了攻击技术的执行方式和位置。

支持的引爆器:

  • 本地命令执行
  • SSH 命令执行
  • Stratus Red Team
  • AWS CLI 引爆器
  • AWS 引爆器(仅编程方式,不能与 CLI 一起使用)

告警匹配器

告警匹配器 是一个平台特定的集成,用于检查预期告警是否被触发。

支持的告警匹配器:

  • Datadog 安全信号
  • Elastic Security 信号

引爆与告警关联

每次引爆都会分配一个 UUID。该 UUID 会反映在引爆过程中,并用于确保匹配的告警精确对应于本次引爆。

实现方式取决于引爆器;例如,Stratus Red Team 和 AWS 引爆器将其注入到 User-Agent 中;SSH 引爆器使用包含 UUID 的父进程。

使用

通过 CLI

Threatest 附带一个 CLI,你可以用它来运行描述为 YAML 的测试场景,遵循特定的模式。你可以在编辑器中配置此模式,以获得 IDE 内的 linting 和自动补全(参见 VSCode 文档 结合 YAML 扩展)。

通过下载二进制发布版或使用 Homebrew 安装 CLI:

root@kitploit:~
brew tap datadog/threatest https://github.com/datadog/threatest
brew install datadog/threatest/threatest

示例用法:

root@kitploit:~
$ threatest lint scenarios.threatest.yaml
所有 6 个场景语法有效

# 本地引爆
$ threatest run local-scenarios.threatest.yaml

# 通过 SSH 远程引爆
$ threatest run scenarios.threatest.yaml --ssh-host test-box --ssh-username vagrant

# 或者,从环境变量指定 SSH 参数
$ export THREATEST_SSH_HOST=test-box
$ export THREATEST_SSH_USERNAME=vagrant
$ threatest run scenarios.threatest.yaml

示例场景定义文件

  • 通过 SSH 引爆
root@kitploit:~
scenarios:
  # 通过 SSH 远程引爆
  # 注意:SSH 配置通过 --ssh-host、--ssh-username 和 --ssh-keyfile CLI 参数提供
  - name: curl 元数据服务
    detonate:
      remoteDetonator:
        commands: ["curl http://169.254.169.254 --connect-timeout 1"]
    expectations:
      - timeout: 1m
        datadogSecuritySignal:
          name: "Network utility accessed cloud metadata service"
          severity: medium
  • 使用 Stratus Red Team 引爆
root@kitploit:~
scenarios:
  # Stratus Red Team 引爆
  # 注意:运行前必须向相关云提供商进行身份认证
  # 以下示例等同于手动运行 "stratus detonate aws.exfiltration.ec2-security-group-open-port-22-ingress"
  - name: 打开安全组到互联网
    detonate:
      stratusRedTeamDetonator:
        attackTechnique: aws.exfiltration.ec2-security-group-open-port-22-ingress
    expectations:
      - timeout: 15m
        datadogSecuritySignal:
          name: "Potential administrative port open to the world via AWS security group"
  • 使用 AWS CLI 命令引爆
root@kitploit:~
scenarios:
  # AWS CLI 引爆
  # 注意:运行前必须向 AWS 进行身份认证,并且已安装 AWS CLI
  - name: 打开安全组到互联网
    detonate:
      awsCliDetonator:
        script: |
          set -e
          
          # 设置
          vpc=$(aws ec2 create-vpc --cidr-block 10.0.0.0/16 --query Vpc.VpcId --output text)
          sg=$(aws ec2 create-security-group --group-name sample-sg --description "Test security group" --vpc-id $vpc --query GroupId --output text)
          
          # 打开安全组
          aws ec2 authorize-security-group-ingress --group-id $sg --protocol tcp --port 22 --cidr 0.0.0.0/0
          
          # 清理
          aws ec2 delete-security-group --group-id $sg
          aws ec2 delete-vpc --vpc-id $vpc
    expectations:
      - timeout: 15m
        datadogSecuritySignal:
          name: "Potential administrative port open to the world via AWS security group"

你可以将测试结果输出到 JSON 文件:

root@kitploit:~
$ threatest run scenarios.threatest.yaml --output test-results.json
$ cat test-results.json
[
  {
    "description": "change user password",
    "isSuccess": true,
    "errorMessage": "",
    "durationSeconds": 22.046627348,
    "timeDetonated": "2022-11-15T22:26:14.182844+01:00"
  },
  {
    "description": "adding an SSH key",
    "isSuccess": true,
    "errorMessage": "",
    "durationSeconds": 23.604699625,
    "timeDetonated": "2022-11-15T22:26:14.182832+01:00"
  },
  {
    "description": "change user password",
    "isSuccess": false,
    "errorMessage": "At least one scenario failed:\n\nchange user password returned: change user password: 1 assertions did not pass\n =\u003e Did not find Datadog security signal 'bar'\n",
    "durationSeconds": 3.505294235,
    "timeDetonated": "2022-11-15T22:26:36.229349+01:00"
  }
]

默认情况下,场景以最大 5 个并行度运行。你可以通过 --parallelism 参数增加此设置。 注意,当使用远程 SSH 引爆器时,每个运行的场景都会建立一个新的 SSH 连接。

以编程方式使用 Threatest

参见 examples 以获取完整的编程使用示例。

测试由 Stratus Red Team 触发的 Datadog Cloud SIEM 信号

root@kitploit:~
threatest := Threatest()

threatest.Scenario("AWS console login").
  WhenDetonating(StratusRedTeamTechnique("aws.initial-access.console-login-without-mfa")).
  Expect(DatadogSecuritySignal("AWS Console login without MFA", WithSeverity("medium"))).
  WithTimeout(15 * time.Minute)

assert.NoError(t, threatest.Run())

测试通过 SSH 运行命令触发的 Datadog Cloud Workload Security 信号

root@kitploit:~
ssh, _ := NewSSHCommandExecutor("test-box", "", "")

threatest := Threatest()

threatest.Scenario("curl to metadata service").
  WhenDetonating(NewCommandDetonator(ssh, "curl http://169.254.169.254 --connect-timeout 1")).
  Expect(DatadogSecuritySignal("EC2 Instance Metadata Service Accessed via Network Utility"))

assert.NoError(t, threatest.Run())
下载工具