此安装过程适用于64位,ubuntu16.04及以上版本的操作系统
最简易的方式就是通过S2E自带的管理工具s2e-env安装。基本步骤及注意事项如下:
- 安装s2e-env工具
$: git clone https://github.com/S2E/s2e-env.git
$: cd s2e-env
$: pip install .
# Note: if you use pip earlier than version 19, you must add --process-dependency-links:
$: pip install . --process-dependency-links
Tests can be run via
$: python setup.py test
然后就可以在终端界面上使用是s2e这个命令了。
2. 搭建S2E的执行环境
搭建s2e的执行环境主要是依次执行以下命令:
$: s2e init $DIR
这步的作用主要是在DIR目录下初始化一个s2e的环境,包括安装一些以来的软件包以及从github上拉取各个子模块,该步由于国内网络问题,容易出现的是repo init失败。解决办法是:通过which repo命令找到repo的安装位置,然后修改repo文件
REPO_URL = ‘https://gerrit-googlesource.proxy.ustclug.org/git-repo’
$: source $DIR/s2e_activate
$: s2e build //调试模式使用--debug参数
s2e build耗时比较长,这个过程需要保证网络的通畅以及一定的速度,不然容易失败。这个过程是构建s2e的所有组件,包括KLEE,QEMU,libs2e,Z3等。如果安装好之后,需要更新或者重新安装某一组件,可以使用如下命令,这样就会强制重新构建libs2e和qemu模块。
$: s2e build --rebuild-components libs2e qemu
接下来,需要构建一个虚拟机镜像供分析目标使用,首先使用
$: s2e image_build
该命令会列出所有可供选择的镜像(自定义镜像另行制作),如下图所示
Available images:
* all - Build all images
* linux - Build all Linux images
* windows - Build all Windows images
* cgc_debian-9.2.1-i386 - Debian i386 image with CGC kernel and user-space packages
* debian-9.2.1-i386 - Debian i386 image
* debian-9.2.1-x86_64 - Debian x86_64 image
* windows-10ent1703-x86_64 - Windows 10 Enterprise 1703 x86_64
* windows-7sp1ent-x86_64 - Windows 7 Enterprise SP1 x86_64
* windows-7sp1pro-i386 - Windows 7 Professional SP1 i386
* windows-8.1ent-x86_64 - Windows 8.1 Enterprise x86_64
* windows-xpsp3pro-i386 - Windows XP Professional SP3 i386
然后执行
$: s2e image_build debian-9.2.1-i386
至此,就可以使用s2e工具来开始我们的漏洞挖掘之旅。
更多使用方法和介绍请参考官方文档