跳转到帖子

游客您好,欢迎来到黑客世界论坛!您可以在这里进行注册。

赤队小组-代号1949(原CHT攻防小组)在这个瞬息万变的网络时代,我们保持初心,创造最好的社区来共同交流网络技术。您可以在论坛获取黑客攻防技巧与知识,您也可以加入我们的Telegram交流群 共同实时探讨交流。论坛禁止各种广告,请注册用户查看我们的使用与隐私策略,谢谢您的配合。小组成员可以获取论坛隐藏内容!

TheHackerWorld官方

hcltm:基于HCL语言实现威胁模型构建

精选回复

发布于

hcltm:基于HCL语言实现威胁模型构建

6267499c8ec41.jpg

关于hcltm

目前,社区中有多种方法可以记录威胁模型,从简单的文本文件,到更深入一点的Word文档,再到全面的威胁模型检测/构建集中解决方案。其中,威胁模型最有价值的两个属性是能够清楚地记录威胁,并能够驱动更深层次的分析。

hcltm旨在提供一个DevOps优先的方法来记录一个系统威胁模型,工具的主要针对的目标如下:

1、简单的文本文件格式

2、命令行驱动式的用户体验

3、整合版本控制系统(VCS)

该项目的hcltm规范基于HashiCorp的配置语言HCL2,其目的是“让人易于阅读和编写,并且是一种基于JSON的变体,更易于机器生成和解析”。结合hcltm cli软件和hcltm规范,安全研究人员可以在HCL中定义系统威胁模型,例如:

threatmodel "Tower of London" {

  description = "A historic castle"

  author = "@xntrik"

 

  attributes {

    new_initiative = "true"

    internet_facing = "true"

    initiative_size = "Small"

  }

 

  information_asset "crown jewels" {

    description = "including the imperial state crown"

    information_classification = "Confidential"

  }

 

  usecase {

    description = "The Queen can fetch the crown"

  }

 

  third_party_dependency "community watch" {

    description = "The community watch helps guard the premise"

    uptime_dependency = "degraded"

  }

 

  threat {

    description = "Someone who isn't the Queen steals the crown"

    impacts = ["Confidentiality"]

    control = "Lots of guards"

  }

 

  data_flow_diagram {

    // ... see below for more information

  }

 

}

关于规范的完整描述,可以点击【这里】或运行下列命令查看。

hcltm generate boilerplate

hcltm命令行接口工具

安装

广大研究人员可以直接访问该项目的【Releases页面】下载该工具的最新版本,并将hcltm代码拷贝到我们的目录路径下。

使用Homebrew安装

brew install xntrik/repo/hcltm

使用Docker运行

docker run --rm -it xntrik/hcltm

使用GitHub Actions运行

hcltm可以使用【GitHubActions】整合进GitHub代码库中,这也是一种管理威胁模型的理想方式,而且也可以有助于将其整合进版本控制系统中。

源码构建

首先,我们需要使用下列命令将该项目源码克隆至本地:

git clone https://github.com/xntrik/hcltm.git

接下来,切换到项目目录中

cd hcltm

并运行下列命令完成工具代码构建:

make bootstrap

make dev

工具使用

使用“-h”命令即可查看该工具支持的参数选项或子命令:

$ hcltm

Usage: hcltm [--version] [--help] <command> [<args>]

 

Available commands are:

    dashboard    基于现有的HCL威胁模型文件生成Markdown文件

    dfd         基于现有的HCL威胁模型文件生成数据流图表PNG文件

    generate     生成一个HCL威胁模型

    list          枚举HCL文件中的威胁模型

    validate      验证现有的HCL威胁模型文件

    view         查看现有的HCL威胁模型文件

配置文件

initiative_sizes = ["S", "M", "L"]

default_initiative_size = "M"

info_classifications = ["1", "2"]

default_info_classification = "1"

impact_types = ["big", "small"]

strides = ["S", "T"]

uptime_dep_classifications = ["N", "D"]

default_uptime_dep_classification = "N"

工具使用

枚举和查看威胁模型

$ hcltm list examples/*

#  File              Threatmodel      Author

1  examples/tm1.hcl  Tower of London  @xntrik

2  examples/tm1.hcl  Fort Knox        @xntrik

3  examples/tm2.hcl  Modelly model    @xntrik

验证威胁模型

$ hcltm validate examples/*

Validated 3 threatmodels in 3 files

生成威胁模型

hcltm generate interactive

生成成交互式编辑器

hcltm generate interactive editor

仪表盘

$ hcltm dashboard -overwrite -outdir=dashboard-example examples/*

Created the 'dashboard-example' directory

Writing dashboard markdown files to 'dashboard-example' and overwriting existing files

Successfully wrote to 'dashboard-example/tm1-toweroflondon.md'

Successfully wrote to 'dashboard-example/tm1-fortknox.md'

Successfully wrote to 'dashboard-example/tm2-modellymodel.png'

Successfully wrote to 'dashboard-example/tm2-modellymodel.md'

Successfully wrote to 'dashboard-example/dashboard.md'

工具使用截图

1650118448_625acf30636e6d40e24bd.png!sma

1650118454_625acf36adb63b6f48e2a.png!sma

1650118461_625acf3d72a31fe4b17e5.png!sma

1650118469_625acf457f8e828145c60.png!sma

许可证协议

本项目的开发与发布遵循MIT开源许可证协议。

项目地址

hcltm:【GitHub传送门】

参考资料

https://owasp.org/www-community/Threat_Modeling

https://github.com/xntrik/hcltm/blob/main/spec.hcl

https://github.com/hashicorp/hcl/tree/hcl2

https://github.com/xntrik/hcltm#data-flow-diagram

https://owasp.org/www-project-proactive-controls/

https://d1.awsstatic.com/whitepapers/Security/AWS_Security_Checklist.pdf

https://www.terraform.io/

https://community.marqeta.com/t5/engineering-blogs/threat-models-at-the-speed-of-devops/ba-p/40

创建帐户或登录后发表意见

最近浏览 0

  • 没有会员查看此页面。