sqlite介绍
SQLite 是一个开源的嵌入式关系数据库,实现自包容、零配置、支持事务的SQL数据库引擎。 其特点是高度便携、使用方便、结构紧凑、高效、可靠。
与其他数据库管理系统不同,SQLite 的安装和运行非常简单,在大多数情况下 -
只要确保SQLite的二进制文件存在即可开始创建、连接和使用数据库。
下载地址:https://www.sqlite.org/src/zip/sqlite.zip
版本:3.19.0
测试步骤:
下载好源码之后,解压,插桩,编译
unzip sqlite
mkdir build
cd build
CC=/path/to/afl/afl-clang-fast ../configure
make
make test(测试)
如果make test时报错,说是找不到tcl.h文件,运行如下命令:
sudo apt-get install tk8.4-dev
sudo apt-get install tcl-dev
sudo cp /usr/include/tcl/*.h /usr/include/
重新编译并make
选取测试集,下载的sqlite包里面包含一个test文件夹,我们在该文件夹中选取部分文件作为测试集。不建议选取全部文件,一共有900多个文件,耗时太长。
测试集较多时,建议通过afl-tmin与afl-cmin两个命令对测试集进行精简,然后进行fuzz。
afl-fuzz -i /path/to/testcase -o /out_dir /path/to/sqlite3
[外链图片转存中…(img-TYYZXlH1-1570605342887)]
参考:
https://github.com/mackyle/sqlite
http://www.sqlite.org/testing.html
http://lcamtuf.blogspot.com/2015/04/finding-bugs-in-sqlite-easy-way.html