Github: https://github.com/trailofbits/manticore
マンティコア
マンティコアは、バイナリとスマートな契約を分析するための象徴的な実行ツールです。
特徴
- 入力生成 :マンティコアは、一意のコードパスをトリガーする入力を自動的に生成します
- クラッシュディスカバリー :マンティコアはメモリ安全違反でプログラムをクラッシュさせる入力を発見
- 実行トレース :マンティコアは、生成された入力ごとに、命令レベルの実行トレースを記録します。
- プログラマティックインターフェイス :マンティコアは、Python APIを介して、分析エンジンへのプログラムによるアクセスを公開しています
マンティコアは以下のタイプのプログラムを分析することができます:
- Linux ELFバイナリ(x86、x86_64、およびARMv7)
- Ethereumスマートコントラクト(EVMバイトコード)( リリースアナウンス )
要件
マンティコアはLinuxでサポートされており、Python 2.7が必要です。 Ubuntu 16.04を強くお勧めします。 Ethereumのスマートな契約分析では、 $PATH
solc
プログラムが必要です。
クイックスタート
いくつかのシェルコマンドでマンティコアをインストールしてみてください( asciinema参照):
# Install system dependencies
sudo apt-get update && sudo apt-get install python-pip -y
# Install manticore and its dependencies
sudo pip2 install manticore
# Download and build the examples
git clone https://github.com/trailofbits/manticore.git && cd manticore/examples/linux
make
# Use the Manticore CLI
manticore basic
cat mcore_*/*0.stdin | ./basic
cat mcore_*/*1.stdin | ./basic
# Use the Manticore API
cd ../script
python count_instructions.py ../linux/helloworld
インストール
オプション1:ユーザーのインストールを実行します( PATH
~/.local/bin
が必要です)。
echo "PATH=\$PATH:~/.local/bin" >> ~/.profile
source ~/.profile
pip install --user manticore
オプション2:仮想環境を使用する( virtualenvwrapperなどが必要)。
pip install virtualenvwrapper
echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.profile
source ~/.profile
mkvirtualenv manticore
pip install manticore
オプション3:システムのインストールを実行します。
sudo pip install manticore
一旦インストールされると、 manticore
CLIツールとPython APIが利用可能になります。
マンティコアの開発版をインストールするには、 wikiを参照してください。
使用法
CLI
マンティコアには、サポートされているプログラムを簡単に記号的に実行するために使用できるコマンドラインインターフェイスがあります。 解析結果は、 mcore_
始まる新しいディレクトリに配置されます。 固執ファイルの拡張子は.solでなければなりません。
$ manticore ./path/to/binary # runs, and creates a mcore_* directory with analysis results
$ manticore ./path/to/binary ab cd # use concrete strings "ab", "cd" as program arguments
$ manticore ./path/to/binary ++ ++ # use two symbolic strings of length two as program arguments
$ manticore ./path/to/contract.sol # runs, and creates a mcore_* directory with analysis results
API
マンティコアには、カスタム解析を実装するために使用できるPythonプログラミングインタフェースがあります。
# example Manticore script
from manticore import Manticore
hook_pc = 0x400ca0
m = Manticore('./path/to/binary')
@m.hook(hook_pc)
def hook(state):
cpu = state.cpu
print 'eax', cpu.EAX
print cpu.read_int(cpu.ESP)
m.terminate() # tell Manticore to stop
m.run()
その他のドキュメントは、いくつかの場所で利用できます。
-
examplesディレクトリには、API機能を紹介する非常に少数の例があります
-
manticore-examplesリポジトリには、実際のCTFの問題を解決するなど、いくつかの例があります
-
APIリファレンスには、 APIに関するより詳細なドキュメントがあります。
マンティコアはベータ版ソフトウェアです。 これは積極的に開発され、維持されており、ユーザーは改善、インターフェースの変更、そしてもちろんいくつかのバグを予想しているはずです。