FACT:一款固件类比分析测试平台

作者:网友投稿 时间:2018-08-02 21:44

字号
0×01 工具简介

1.FACT 全称 Firmware Analysis and Comparison Tool 是一个拥有WEB端的自动化固件测试平台。

2.旨在自动执行固件安全分析(路由器,物联网,UEFI,网络摄像头,无人驾驶飞机……)

3.工具基于Python-flask框架,采用模块化开发并支持插件接入,因此对于二次开发和优化非常便捷。

4.FACT可以自动化完成固件解包任务并对其进行固件分析包括:

软件识别

(1)使用哪个操作系统?

(2)哪些节目存在?

(3)使用哪些版本?

(4)哪些服务在启动时启动

(5)这些漏洞有哪些?

查找用户凭据

加密材料检测

(1)私人钥匙

(2)证书

(3)CPU架构(需要进行仿真和反汇编)

5.FACT 同样也自动化的实现了固件的类比,可以很方便的对比出来旧版本与新版本固件之间的变动。以找出开发商对新固件在哪里进行了更新,同样也可以识别是否为开发商原始固件。比如:

(1)识别已更改/相同的文件

(2)识别更改的软件版本 

0×02 主要功能分析

1.FACT的业务代码主要有三块

Unpacking – 固件解包

Analysis – 固件系统分析

Comparison – 固件类比

2.每一块业务代码又由一下两部分组成:

(1)Scheduler – 任务调度器

(2)Multiple plugins – 插件集

3.每个调度器拥有独立的工作线程

总流程图

 FACT:一款固件类比分析测试平台

固件解包工作流程图

FACT在识别文件类型的时候会调用”file”命令,并使用自带的一个mime库来标记文件类型。

 FACT:一款固件类比分析测试平台

FACT在识别文件类型的时候会调用”file”命令,并使用自带的一个mime库来标记文件类型。

在确定文件类型后调度器会选择正确的插件进行解包任务。

固件系统分析工作流程图

 FACT:一款固件类比分析测试平台

调度器一次只会调用一个插件,当上一个插件任务结束后才会继续调用下一个插件。

插件工作时可以拥有多个线程一起进行。

插件可以调用以及查看前面插件执行后的二进制结果。

固件系统类比工作流程图

 FACT:一款固件类比分析测试平台

固件系统类比任务是与固件分析任务分开的,需要进行类比的固件要先进行固件分析。

需要手工填入需要进行类比的固件UIDS。

类比工作是单线程工作,相对节省系统资源。

0×03 具体代码分析

FACT 的配置文件位于./src/config/main.cfg

# ------ 数据库配置 ------ [data_storage] firmware_file_storage_directory = /media/data/fact_fw_data mongo_server = localhost mongo_port = 27018 main_database = fact_main intercom_database_prefix = fact_intercom statistic_database = fact_stats view_storage = fact_views # Threshold for extraction of analysis results into a file instead of DB storage report_threshold = 100000 # 认证信息 db_admin_user = fact_admin db_admin_pw = 6fJEb5LkV2hRtWq0 db_readonly_user = fact_readonly db_readonly_pw = RFaoFSr8b6BMSbzt # 用户管理 user_database  = sqlite:////media/data/fact_auth_data/fact_users.db password_salt = 5up3r5tr0n6_p455w0rd_5417 # 数据库结构信息 variety_path = bin/variety.js structural_threshold = 40 [Logging] logFile=/tmp/fact_main.log mongoDbLogFile=/tmp/fact_mongo.log logLevel=WARNING # ------ 解包插件配置管理 ------ [unpack] threads = 4 # 如果文件类型在白名单中,将不会被提取 whitelist = audio/mpeg, image/png, image/jpeg, image/gif, application/x-shockwave-flash, video/mp4, video/mpeg, video/quicktime, video/x-msvideo, video/ogg, text/plain # 递归提取深度 max_depth = 8 # ------ 分析插件配置管理 ------ [default_plugins] # choose preselected plugins plugins = cpu_architecture, crypto_material, exploit_mitigations, ip_and_uri_finder, software_components, users_and_passwords # -- 插件设置项 -- [asc] threads = 4 [base64_decoder] string_min_length = 15 # It might be useful to set base64_section_min_length = string_min_length / 3 * 4 base64_section_min_length = 20 [binary_analysis] threads = 4 [binwalk] threads = 2 [check_path] threads = 4 [cpu_architecture] threads = 2 mime_ignore = application/pdf, application/postscript, application/xml, application/xhtml+xml, application/x-dvi, image/gif, image/jpeg, image/png, text/comma-separated-values, text/css, text/html, text/plain, text/javascript, text/xml, video/mpeg,  video/x-msvideo, application/x-httpd-php, application/msword [crypto_code] threads = 2 [crypto_material] threads = 2 [cwe_checker] threads = 4 [exploit_mitigations] threads = 4 [file_hashes] threads = 2 hashes = md5, sha1, sha256, sha512, ripemd160, whirlpool [init_systems] threads = 2 [ip_and_uri_finder] threads = 2 [malware_scanner] threads = 4 [manufacturer_detection] threads = 2 [printable_strings] threads = 2 min_length = 6 [similar_files] threads = 4 [software_components] threads = 2 [string_evaluator] threads = 2 [software_version_string_finder] threads = 2 [users_and_passwords] threads = 4 # ------ Web Interface ------ [database] results_per_page = 10 number_of_latest_firmwares_to_display = 10 # !!!!=如果你不知道这些是干啥的,就不要瞎改!!!!(作者原话) [ExpertSettings] block_delay = 2 ssdeep_ignore = 1 communication_timeout = 60 unpack_threshold = 0.8 unpack_throttle_limit = 50 throw_exceptions = false authentication = false 

由于FACT三块业务功能代码结构类似,这里以Unpack 功能为例,详细的讲解代码逻辑。

责任编辑:CQITer新闻报料:400-888-8888   本站原创,未经授权不得转载
继续阅读
热新闻
推荐
关于我们联系我们免责声明隐私政策 友情链接