Better_Software_Header_MobileBetter_Software_Header_Web

Find what you need - explore our website and developer resources

Fuzzing Qt for fun and profit

A brief introduction to fuzzing and how we successfully use it in Qt

export CC=/path/to/afl-gcc
export CXX=/path/to/afl-g++
./configure ...
make
#include <QtCore>

int main(int argc, char **argv)
{
    QCoreApplication app(argc, argv);

    QFile file(app.arguments().at(1));
    if (!file.open(QIODevice::ReadOnly))
        return 1;

    QJsonDocument jd = QJsonDocument::fromBinaryData(file.readAll());

    return 0;
}
afl-fuzz -m memorylimit \
         -t timeoutlimit \
         [master/slave options] \
         -i testcases/ \
         -o findings/ \
         -- ./test @@
afl-fuzz -m 512 -t 20 -i testcases -o findings-json -M fuzzer00 -- ./afl-qjson @@

AFL running over a testcase.

findings-json/fuzzer00/crashes/id:000000,sig:06,src:000445,op:arith8,pos:168,val:+6
findings-json/fuzzer00/crashes/id:000001,sig:11,src:000445,op:arith8,pos:168,val:+7
findings-json/fuzzer00/crashes/id:000002,sig:11,src:000449,op:arith8,pos:196,val:+6
findings-json/fuzzer00/crashes/id:000003,sig:11,src:000489,op:flip1,pos:435
findings-json/fuzzer01/crashes/id:000000,sig:06,src:000526,op:havoc,rep:2
findings-json/fuzzer01/crashes/id:000001,sig:11,src:000532,op:havoc,rep:2
findings-json/fuzzer01/crashes/id:000002,sig:06,src:000533,op:havoc,rep:4
$ mkdir afl
# mount -t tmpfs -o size=1024M tmpfs afl/
$ cd afl/
$ afl-fuzz -i inputs -o findings ...

About KDAB


3 Comments

30 - Nov - 2016

Litb

5 - Dec - 2016

Giuseppe D'Angelo

13 - Dec - 2016

Leslie Zhai

GiuseppeD'Angelo

Giuseppe D’Angelo

Senior Software Engineer

Learn Modern C++

Learn more