Fuzzing简介以及使用AFL对LibTIFF进行模糊测试

16 篇文章 0 订阅

1. Fuzzing简介

Fuzz testing or Fuzzing is a software testing technique, often used to discover security weaknesses in applications and protocols. The basic idea is to attach the inputs of a program to a source of random or unexpected data. If the program fails (for example, by crashing, or by failing in-built code assertions), then there are defects to correct. It should be noted that the majority of security vulnerabilities, from buffer overflows to cross-site scripting attacks, are generally the result of insufficient validation of user-supplied input data. Bugs found using fuzz testing are frequently severe, exploitable bugs that could be used by a real attacker. This has become even more true as fuzz testing has become more widely known, as the same techniques and tools are now used by attackers to exploit deployed software. This is a major advantage over binary or source auditing, or even fuzzing’s close cousin, fault injection, which often rely on artificial fault conditions that are difficult or impossible to exploit.


2. AFL简介

官网:http://lcamtuf.coredump.cx/afl/


3. ALF原理

AFL编译器会对源码进行插桩,然后通过afl-fuzz启动编译出来的程序,并指定输入文件夹与输出文件夹。
AFL会读取输入文件,进行变异喂给程序,最后将crash等输出信息保存到输出文件夹。

源码:

while (conditon) {
    req = get_request();
    process(req);
}

插桩后代码:

while (conditon) {
    put_request(read(file));	// AFL

    req = get_request();
    process(req);

    notify_fuzzer();			// AFL
}

4. AFL安装

下载:
wget http://lcamtuf.coredump.cx/afl/releases/afl-latest.tgz
解压:
tar xfz afl-latest.tgz

cd afl-2.52b
安装:
sudo make install

5. LibTIFF安装

下载:
wget http://download.osgeo.org/libtiff/tiff-4.0.9.tar.gz
解压:
tar zxvf tiff-4.0.9.tar.gz
cd tiff-4.0.9
指定编译器为AFL的编译器:
Linux:
export CC=afl-gcc
export CXX=afl-g++
OS X:
export CC=afl-clang
export CXX=afl-clang++
编译:
./configure --disable-shared
make

6. AFL对LibTIFF进行模糊测试

下载用例:
http://lcamtuf.coredump.cx/afl/demo/


建立输入输出文件夹:
mkdir input output
将初始用例放入到输入文件夹中:
cp afl_testcases/tiff/edges-only/images/* input/
开始Fuzzing,在执行过程中,afl-fuzz会把@@替代测试样例:
afl-fuzz -i input –o output tools/tiff2rgba -a @@

OS X需要按照提示执行下面3条命令:


运行截图:


  • 2
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
使用Radamsa测试程序的网络服务,您需要在程序中实现一个网络接口,以便可以通过网络接收测试用例并返回测试结果。然后,您可以使用Radamsa生成随机的输入数据,并将其发送到您的网络接口进行测试。以下是一些可能的步骤: 1. 实现网络接口:您需要根据您的程序的需求,在程序中实现一个网络接口,例如RESTful API或者Socket接口。这个接口需要接收测试用例,并返回测试结果。 2. 使用Radamsa生成测试用例:您可以使用Radamsa生成随机的二进制数据,作为测试用例。您可以指定生成数据的格式和长度,以及生成数据的数量。 3. 发送测试用例:您可以使用Python的requests库或者其他HTTP客户端库,向您的网络接口发送测试用例。您需要指定测试用例的格式和长度,并将测试用例发送到您的网络接口。 4. 接收测试结果:您的网络接口需要将测试结果返回给Radamsa。您可以使用HTTP响应码或者JSON格式来返回测试结果。 5. 分析测试结果:您可以将测试结果保存到文件中,或者使用其他工具来分析测试结果。您可以使用Fuzzing工具,例如AFL或者Honggfuzz,来进一步分析测试结果,并发现程序中的漏洞和错误。 需要注意的是,使用Radamsa测试网络服务可能会产生大量的网络流量,因此您需要确保您的网络接口能够处理大量的并发连接,并且能够处理高负载的情况。此外,您还需要确保您的网络接口有良好的安全性,以避免被攻击者利用测试用例进行攻击。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

EnjoyCodingAndGame

愿我的知识,成为您的财富!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值