Skip to content
KitploitKITPLOIT
ツールブログ
提出
ツールブログ
提出

ハッキング、侵入テスト、サイバーセキュリティツールをあなたのセキュリティアーセナルに!

Kitploitはハッキング、サイバーセキュリティ、ペネトレーションテストのツールディレクトリです。最新のプロジェクトアップデートを見つけて、脆弱性の発見、システム分析、テストの自動化、セキュリティの強化を行いましょう。

··フィード·お問い合わせ·プライバシー·© 2026 Kitploit

ツールディレクトリ

カテゴリ

すべてのカテゴリを見る
Loading categories
Firmware_Slap — コノリック解析と関数クラスタリングによるファームウェアの脆弱性発見。 | Kitploit
ツール/GitHubGitHub/christhecoolhut/firmware_slap
脆弱性分析エクスプロイトバイナリ解析ファームウェア解析
GitHubchristhecoolhut/firmware_slap

Firmware_Slap

コノリック解析と関数クラスタリングによるファームウェアの脆弱性発見。

リポジトリを見る
476815年前Kitploit レビュー済み

人気

すべて見る →

コミュニティで最も使われているツールを見つけましょう。

すべてのツールを探索

ツールコレクションを閲覧

すべてのツールを見る →
共有

Firmware Slap

Firmware Slapは、ファームウェアの脆弱性発見と関数類似性のために、concolic解析と関数クラスタリングを組み合わせたツールです。Firmware Slapは一連のライブラリとして構築されており、ほとんどの情報をpickleまたはJSON形式でエクスポートして他のツールと連携できます。

Firmware Slap

講演のスライドはこちらから入手できます。

セットアップ

Firmware Slapは仮想環境で実行する必要があります。Python3.6でテスト済みです。

root@kitploit:~
sudo apt install python3-virtualenv
virtualenv -p python3 fwslap
source fwslap/bin/activate

-- または --

root@kitploit:~
cd ~
mkdir .virtualenvs
pip install virtualenv
which virtualenv #note path warnings
pip install virtualenvwrapper
echo "export PATH=$PATH:~/.local/bin" >> ~/.bashrc
echo "export WORKON_HOME=~/.virtualenvs" >> ~/.bashrc
echo "source ~/.local/bin/virtualenvwrapper.sh" >> ~/.bashrc

#usually best here to open new terminal

mkvirtualenv fwslap -p /usr/bin/python3
workon fwslap
root@kitploit:~
python setup.py install

rabbitmq、docker、および(radare2またはGhidra)が必要です。

root@kitploit:~
# Ubuntu
sudo apt install rabbitmq-server docker.io
# OSX
brew install rabbitmq

# Radare2
git clone https://github.com/radare/radare2.git
sudo ./radare2/sys/install.sh
# Ghidra
wget https://ghidra-sre.org/ghidra_9.0.4_PUBLIC_20190516.zip
unzip ghidra_9.0.4_PUBLIC_20190516.zip -d ghidra
echo "export PATH=\$PATH:$PWD/ghidra/ghidra_9.0.4/support" >> ~/.bashrc

GhidraにはJDK 11が必要です。

root@kitploit:~
sudo apt install default-jdk
java --version

Elasticsearch機能を使用する場合は、Elasticsearch_and_kibana.shスクリプトを実行してください。

クイックスタート

rabbitmq-serverが実行中であることを確認してください。

root@kitploit:~
# 別のターミナルで、Firmware_Slapのトップレベルディレクトリから以下を実行
celery -A firmware_slap.celery_tasks worker --loglevel=info
# 基本的なバッファオーバーフロー
Discover_And_Dump.py examples/iwconfig -D iwconfig_results
Load_And_View_Results.py iwconfig_results.all.pickle

# 左ペインの管理をクリック
# 保存済みオブジェクトをクリック
# インポートをクリック
# Firmware Slap内のelasticディレクトリから'elastic_export.json'を選択
# 左ペインのダッシュボードに移動し、'Overview Dashboard'を選択

Load_And_View_Results.py iwconfig_results.all.pickle -s

# コマンドインジェクション
tar -xvf examples/Almond_libs.tar.gz
Vuln_Discover_Celery.py examples/upload.cgi -L Almond_Root/lib/

使用方法

root@kitploit:~
# サンプルで使用するファームウェアを入手
wget https://firmware.securifi.com/AL3_64MB/AL3-R024-64MB
binwalk -Mre AL3-R024-64MB

プロジェクトルートディレクトリからceleryワーカーを起動します:

root@kitploit:~
# 別のターミナルで
celery -A firmware_slap.celery_tasks worker --loglevel=info

別のターミナルウィンドウで、脆弱性発見ジョブを実行します。

root@kitploit:~
$ Vuln_Discover_Celery.py Almond_Root/etc_ro/lighttpd/www/cgi-bin/upload_bootloader.cgi -L Almond_Root/lib/
[+] Getting argument functions
[+] Analyzing 1 functions
  0%|                                                                                                                                                                                                                                   | 0/1 [00:01<?, ?it/s]
{   'Injected_Location': {   'base': '0x7ffefde8',
........................ SNIP ......................
    'type': 'Command Injection'}
Python 3.5.2 (default, Nov 12 2018, 13:43:14) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.3.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: 

返される脆弱性オブジェクト

上記のコマンドは、result変数にオブジェクトを返します。これは、脆弱性に関するあらゆる種類の素晴らしい情報を含む辞書です。オブジェクトには3つの主要なキーがあります:関数引数、メモリ、および注入位置。

root@kitploit:~
In [3]: result.keys()                                                                                 
Out[3]: dict_keys(['args', 'file_name', 'type', 'mem', 'Injected_Location'])

引数 (args)

argsキーは、回復された引数と、脆弱性を再現するためにその引数の値がどうあるべきかについての詳細を示します。以下の例では、1つの引数が回復されており、コマンドインジェクションをトリガーするには、その引数が "reboot" を含むchar*でなければならず、再起動を引き起こします。

root@kitploit:~
In [1]: result['args']                                                           
Out[1]: 
[{'base': 'a1',
  'type': 'int',
  'value': "0x0 -> b'`reboot`\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x00'"}]

メモリ

オブジェクトのメモリコンポーネントは、脆弱性をトリガーするために設定される必要なメモリ値を追跡します。また、必要なメモリ制約を設定するためのスタックアドレスと.textアドレスを、該当するコマンドとともに提供します。最初のメモリイベントはmtd_write_firmware+0x0で、2つ目はmtd_write_firmware+0x38です。将来の表示をきれいにするためにアセンブリが提供されています。

root@kitploit:~
In [2]: result['mem']                                                                   
Out[2]: 
[{'BBL_ADDR': '0x401138',
  'BBL_DESC': {'DESCRIPTION': 'mtd_write_firmware+0x0 in upload_bootloader.cgi (0x401138)',
   'DISASSEMBLY': ['0x401138:\tlui\t$gp, 0x42',
    '0x40113c:\taddiu\t$sp, $sp, -0x228',
    '0x401140:\taddiu\t$gp, $gp, -0x5e90',
    '0x401144:\tlw\t$t9, -0x7f84($gp)',
    '0x401148:\tsw\t$a2, 0x10($sp)',
    '0x40114c:\tlui\t$a2, 0x40',
    '0x401150:\tmove\t$a3, $a1',
    '0x401154:\tsw\t$ra, 0x224($sp)',
    '0x401158:\tsw\t$gp, 0x18($sp)',
    '0x40115c:\tsw\t$a0, 0x14($sp)',
    '0x401160:\taddiu\t$a1, $zero, 0x200',
    '0x401164:\taddiu\t$a0, $sp, 0x20',
    '0x401168:\tjalr\t$t9',
    '0x40116c:\taddiu\t$a2, $a2, 0x196c']},
  'DATA': "b'`reboot`\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00'",
  'DATA_ADDRS': ['0x0']},
 {'BBL_ADDR': '0x401170',
  'BBL_DESC': {'DESCRIPTION': 'mtd_write_firmware+0x38 in upload_bootloader.cgi (0x401170)',
   'DISASSEMBLY': ['0x401170:\tlw\t$gp, 0x18($sp)',
    '0x401174:\tnop\t',
    '0x401178:\tlw\t$t9, -0x7f68($gp)',
    '0x40117c:\tnop\t',
    '0x401180:\tjalr\t$t9',
    '0x401184:\taddiu\t$a0, $sp, 0x20']},
  'DATA': "b'/bin/mtd_write -o 0 -l 0 write `reboot`'",
  'DATA_ADDRS': ['0x7ffefe07']}]

コマンドインジェクション固有

コマンドインジェクションがデモに最も適しているため、コマンドインジェクションの位置を簡単に示すための便利な辞書キーを作成しました。

root@kitploit:~
In [4]: result['Injected_Location']                                                                      
Out[4]: {'base': '0x7ffefde8', 'type': 'char *', 'value': '/bin/mtd_write -o 0 -l 0 write `reboot`'}

サンプル脆弱性クラスタスクリプト

脆弱性クラスタスクリプトは、サンプル脆弱性発見スクリプトの方法を使用して脆弱性を発見し、抽出されたファームウェア全体で与えられた関数のセットのk-meansクラスタを構築して、脆弱な関数と類似した関数を見つけます。

root@kitploit:~
$ Vuln_Cluster_Celery.py -h
usage: Vuln_Cluster_Celery.py [-h] [-L LD_PATH] [-F FUNCTION] [-V VULN_PICKLE]
                              Directory

positional arguments:
  Directory

optional arguments:
  -h, --help            show this help message and exit
  -L LD_PATH, --LD_PATH LD_PATH
                        Path to libraries to load
  -F FUNCTION, --Function FUNCTION
  -V VULN_PICKLE, --Vuln_Pickle VULN_PICKLE

以下のコマンドは、-Fに既知の脆弱な関数を指定します。-Vは前回の実行からダンプされたpickleを指定して新しい脆弱性を発見する必要をなくし、-Lはライブラリパスを指定します。 使用例:

root@kitploit:~
$ python Vuln_Cluster_Celery.py -F mtd_write_firmware -L Almond_Root/lib/ Almond_Root/etc_ro/lighttpd/www/cgi-bin/
[+] Reading Files
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00,  2.80it/s]
Getting functions from executables
Starting main
... Snip ...

ツールをダウンロード