Code Monkey home page Code Monkey logo

aflnet's Introduction

AFLNet: A Greybox Fuzzer for Network Protocols

AFLNet is a greybox fuzzer for protocol implementations. Unlike existing protocol fuzzers, it takes a mutational approach and uses state-feedback, in addition to code-coverage feedback, to guide the fuzzing process. AFLNet is seeded with a corpus of recorded message exchanges between the server and an actual client. No protocol specification or message grammars are required. It acts as a client and replays variations of the original sequence of messages sent to the server and retains those variations that were effective at increasing the coverage of the code or state space. To identify the server states that are exercised by a message sequence, AFLNet uses the server’s response codes. From this feedback, AFLNet identifies progressive regions in the state space, and systematically steers towards such regions.

Licences

AFLNet is licensed under Apache License, Version 2.0.

AFLNet is an extension of American Fuzzy Lop written and maintained by Michał Zalewski <[email protected]>. For details on American Fuzzy Lop, we refer to README-AFL.md.

Citing AFLNet

AFLNet has been accepted for publication as a Testing Tool paper at the IEEE International Conference on Software Testing, Verification and Validation (ICST) 2020.

@inproceedings{AFLNet,
author={Van{-}Thuan Pham and Marcel B{\"o}hme and Abhik Roychoudhury},
title={AFLNet: A Greybox Fuzzer for Network Protocols},
booktitle={Proceedings of the 13rd IEEE International Conference on Software Testing, Verification and Validation : Testing Tools Track},
year={2020},}

Installation (Tested on Ubuntu 18.04 & 16.04 64-bit)

Prerequisites

# Install clang (as required by AFL/AFLNet to enable llvm_mode)
sudo apt-get install clang
# Install graphviz development
sudo apt-get install graphviz-dev libcap-dev

AFLNet

Download AFLNet and compile it. We have tested AFLNet on Ubuntu 18.04 and Ubuntu 16.04 64-bit and it would also work on all environments that support the vanilla AFL and graphviz.

# First, clone this AFLNet repository to a folder named aflnet
git clone <links to the repository> aflnet
# Then move to the source code folder
cd aflnet
make clean all
cd llvm_mode
# The following make command may not work if llvm-config cannot be found
# To fix this issue, just set the LLVM_CONFIG env. variable to the specific llvm-config version on your machine
# On Ubuntu 18.04, it could be llvm-config-6.0 if you have installed clang using apt-get
make
# Move to AFLNet's parent folder
cd ../..
export AFLNET=$(pwd)/aflnet
export WORKDIR=$(pwd)

Setup PATH environment variables

export PATH=$PATH:$AFLNET
export AFL_PATH=$AFLNET

Usage

AFLNet adds the following options to AFL. Run afl-fuzz --help to see all options. Please also see the FAQs section for common questions about these AFLNet's options.

  • -N netinfo: server information (e.g., tcp://127.0.0.1/8554)

  • -P protocol: application protocol to be tested (e.g., RTSP, FTP, DTLS12, DNS, DICOM, SMTP, SSH, TLS, DAAP-HTTP, SIP)

  • -D usec: (optional) waiting time (in microseconds) for the server to complete its initialization

  • -e netnsname: (optional) network namespace name to run the server in

  • -K : (optional) send SIGTERM signal to gracefully terminate the server after consuming all request messages

  • -E : (optional) enable state aware mode

  • -R : (optional) enable region-level mutation operators

  • -F : (optional) enable false negative reduction mode

  • -c script : (optional) name or full path to a script for server cleanup

  • -q algo: (optional) state selection algorithm (e.g., 1. RANDOM_SELECTION, 2. ROUND_ROBIN, 3. FAVOR)

  • -s algo: (optional) seed selection algorithm (e.g., 1. RANDOM_SELECTION, 2. ROUND_ROBIN, 3. FAVOR)

Example command:

afl-fuzz -d -i in -o out -N <server info> -x <dictionary file> -P <protocol> -D 10000 -q 3 -s 3 -E -K -R <executable binary and its arguments (e.g., port number)>

Tutorial - Fuzzing Live555 media streaming server

Live555 Streaming Media is a C++ library for multimedia streaming. The library supports open protocols such as RTP/RTCP and RTSP for streaming. It is used internally by widely-used media players such as VLC and MPlayer and some security cameras & network video recorders (e.g., DLink D-View Cameras, Senstar Symphony, WISENET Video Recorder). In this example, we show how AFLNet can be used to fuzz Live555 and discover bugs in its RTSP server reference implementation (testOnDemandRTSPServer). Similar steps would be followed to fuzz servers implementing other protocols (e.g., FTP, SMTP, SSH).

If you want to run some experiments quickly, please take a look at ProFuzzBench. ProFuzzBench includes a suite of representative open-source network servers for popular protocols (e.g., TLS, SSH, SMTP, FTP, SIP), and tools to automate experimentation.

Step-0. Server and client compilation & setup

The newest source code of Live555 can be downloaded as a tarball at Live555 public page. There is also a mirror of the library on GitHub. In this example, we choose to fuzz an old version of Live555 which was commited to the repository on August 28th, 2018. While fuzzing this specific version of Live555, AFLNet exposed four vulnerabilites in Live555, two of which were zero-day. To compile and setup Live555, please use the following commands.

cd $WORKDIR
# Clone live555 repository
git clone https://github.com/rgaufman/live555.git
# Move to the folder
cd live555
# Checkout the buggy version of Live555
git checkout ceeb4f4
# Apply a patch. See the detailed explanation for the patch below
patch -p1 < $AFLNET/tutorials/live555/ceeb4f4.patch
# Generate Makefile
./genMakefiles linux
# Compile the source
make clean all

As you can see from the commands, we apply a patch to make the server effectively fuzzable. In addition to the changes for generating a Makefile which uses afl-clang-fast++ to do the coverage feedback-enabled instrumentation, we make a small change to disable random session ID generation in Live555. In the unmodified version of Live555, it generates a session ID for each connection and the session ID should be included in subsequent requests sent from the connected client. Otherwise, the requests are quickly rejected by the server and this leads to undeterministic paths while fuzzing. Specifically, the same message sequence could exercise different server paths because the session ID is changing. We handle this specific issue by modifing Live555 in such a way that it always generates the same session ID.

Once Live555 source code has been successfully compiled, we should see the server under test (testOnDemandRTSPServer) and the sample RTSP client (testRTSPClient) placed inside the testProgs folder. We can test the server by running the following commands.

# Move to the folder keeping the RTSP server and client
cd $WORKDIR/live555/testProgs
# Copy sample media source files to the server folder
cp $AFLNET/tutorials/live555/sample_media_sources/*.* ./
# Run the RTSP server on port 8554
./testOnDemandRTSPServer 8554
# Run the sample client on another screen/terminal
./testRTSPClient rtsp://127.0.0.1:8554/wavAudioTest

We should see the outputs from the sample client showing that it successfully connects to the server, sends requests and receives responses including streaming data from the server.

Step-1. Prepare message sequences as seed inputs

AFLNet takes message sequences as seed inputs so we first capture some sample usage scenarios between the sample client (testRTSPClient) and the server under test (SUT). The following steps show how we prepare a seed input for AFLNet based on a usage scenario in which the server streams an audio file in WAV format to the client upon requests. The same steps can be followed to prepare other seed inputs for other media source files (e.g., WebM, MP3).

We first start the server under test

cd $WORKDIR/live555/testProgs
./testOnDemandRTSPServer 8554

After that, we ask tcpdump data-network packet analyzer to capture all traffics through the port opened by the server, which is 8554 in this case. Note that you may need to change the network interface that works for your setup using the -i option.

sudo tcpdump -w rtsp.pcap -i lo port 8554

Once both the server and tcpdump have been started, we run the sample client

cd $WORKDIR/live555/testProgs
./testRTSPClient rtsp://127.0.0.1:8554/wavAudioTest

When the client completes its execution, we stop tcpdump. All the requests and responses in the communication between the client and the server should be stored in the specified rtsp.pcap file. Now we use Wireshark network analyzer to extract only the requests and use the request sequence as a seed input for AFLNet. Please install Wireshark if you haven't done so.

We first open the PCAP file with Wireshark.

wireshark rtsp.pcap

This is a screenshot of Wireshark. It shows packets (requests and responses) in multiple rows, one row for one packet.

Analyzing the pcap file with Wireshark

To extract the request sequence, we first do a right-click and choose Follow->TCP Stream.

Follow TCP Stream

Wireshark will then display all requests and responses in plain text.

View requests and responses in plain text

As we are only interested in the requests for our purpose, we choose incoming traffic to the SUT-opened port by selecting an option from the bottom-left drop-down list. We choose 127.0.0.1:57998->127.0.0.1:8554 in this example which askes Wireshark to display all request messages sent to port 8554.

View requests in plain text

Finally, we switch the data mode so that we can see the request sequence in raw (i.e., binary) mode. Click "Save as" and save it to a file, say rtsp_requests_wav.raw.

View and save requests in raw binary

The newly saved file rtsp_requests_wav.raw can be fed to AFLNet as a seed input. You can follow the above steps to create other seed inputs for AFLNet, say rtsp_requests_mp3.raw and so on. We have prepared a ready-to-use seed corpus in the tutorials/live555/in-rtsp folder.

Step-2. Make modifications to the server code (optional)

Fuzzing network servers is challenging and in several cases, we may need to slightly modify the server under test to make it (effectively and efficiently) fuzzable. For example, this blog post shows several modifications to OpenSSH server to improve the fuzzing performance including disable encryption, disable MAC and so on. In this tutorial, the RTSP server uses the same response code 200 for all successful client requests, no matter what actual server state is. So to make fuzzing more effective, we can apply this simple patch that decomposes the big state 200 into smaller states. It makes the inferred state machine more fine grained and hence AFLNet has more information to guide the state space exploration.

Step-3. Fuzzing

cd $WORKDIR/live555/testProgs
afl-fuzz -d -i $AFLNET/tutorials/live555/in-rtsp -o out-live555 -N tcp://127.0.0.1/8554 -x $AFLNET/tutorials/live555/rtsp.dict -P RTSP -D 10000 -q 3 -s 3 -E -K -R ./testOnDemandRTSPServer 8554

Once AFLNet discovers a bug (e.g., a crash or a hang), a test case containing the message sequence that triggers the bug will be stored in replayable-crashes or replayable-hangs folder. In the fuzzing process, AFLNet State Machine Learning component keeps inferring the implmented state machine of the SUT and a .dot file (ipsm.dot) is updated accordingly so that the user can view that file (using a .dot viewer like xdot) to monitor the current progress of AFLNet in terms of protocol inferencing. Please read the AFLNet paper for more information.

Step-4. Reproducing the crashes found

AFLNet has an utility (aflnet-replay) which can replay message sequences stored in crash and hang-triggering files (in replayable-crashes and replayable-hangs folders). Each file is structured in such a way that aflnet-replay can extract messages based on their size. aflnet-replay takes three parameters which are 1) the path to the test case generated by AFLNet, 2) the network protocol under test, and 3) the server port number. The following commands reproduce a PoC for CVE-2019-7314.

cd $WORKDIR/live555/testProgs
# Start the server
./testOnDemandRTSPServer 8554
# Run aflnet-replay
aflnet-replay $AFLNET/tutorials/live555/CVE_2019_7314.poc RTSP 8554

To get more information about the discovered bug (e.g., crash call stack), you can run the buggy server with GDB or you can apply the Address Sanitizer-Enabled patch ($AFLNET/tutorials/live555/ceeb4f4_ASAN.patch) and recompile the server before running it.

FAQs

1. How do I extend AFLNet?

AFLNet has a modular design that makes it easy to be extended.

1.1. How do I add support for another protocol?

If you want to support another protocol, all you need is to follow the steps below.

Step-1. Implement 2 functions to parse the request and response sequences

You can use the available extract_requests_* and extract_response_codes_* functions as references. These functions should be declared and implemented in aflnet.h and aflnet.c, respectively. Note that, please use the same function parameters.

Step-2. Update main function to support a new protocol

Please update the code that handles the -P option in the main function to support a new protocol.

1.2. How do I implement another search strategy?

It is quite straightforward. You just need to update the two functions choose_target_state and choose_seed. The function update_scores_and_select_next_state may need an extension too.

2. What happens if I don't enable the state-aware mode by adding -E option?

If -E is not enabled, even though AFLNet still manages the requests' boundaries information so it can still follow the sequence diagram of the protocol -- sending a request, waiting for a response and so on, which is not supported by normal networked-enabled AFL. However, in this setup AFLNet will ignore the responses and it does not construct the state machine from the response codes. As a result, AFLNet cannot use the state machine to guide the exploration.

3. When I need -c option and what I should write in the cleanup script?

You may need to provide this option to keep network fuzzing more deterministic. For example, when you fuzz a FTP server you need to clear all the files/folders created in the previous fuzzing iteration in the shared folder because if you do not do so, the server will not be able to create a file if it exists. It means that the FTP server will work differently when it receives the same sequence of requests from the client, which is AFLNet in this fuzzing setup. So basically the script should include commands to clean the environment affecting the behaviors of the server and give the server a clean environment to start.

4. What is false-negative reduction mode and when I should enable it using -F?

Unlike stateless programs (e.g., image processing libraries like LibPNG), several stateful servers (e.g., the RTSP server in the above tutorial) do not terminate themselves after consuming all requests from the client, which is AFLNet in this fuzzing setup. So AFLNet needs to gracefully terminate the server by sending the SIGTERM signal (when -K is specified). Otherwise, AFLNet will detect normal server executions as hangs. However, the issue is that if AFLNet sends SIGTERM signal too early, say right after all request messages have been sent to the server, the server may be forced to terminate when it is still doing some tasks which may lead to server crashes (i.e., false negatives -- the server crashes are missed). The false-negative reduction mode is designed to handle such situations. However, it could slow down the fuzzing process leading to slower execution speed.

aflnet's People

Contributors

adrianherrera avatar aesophor avatar amlamarra avatar ammaraskar avatar andronat avatar bayandin avatar ddcc avatar dmtch avatar dnagarju avatar dor1s avatar fouzhe avatar harrypale avatar jjk96 avatar joeyjiao avatar jonathanmetzman avatar kiprey avatar mlgiraud avatar neuracr avatar nrauschcom avatar ol-imorozko avatar oneliey avatar paulfiterau avatar pfg666 avatar pietroferretti avatar pyhuang avatar rnatella avatar rootup avatar sea-n avatar thuanpv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aflnet's Issues

SYSTEM ERROR

hi
i am trying to do fuzzing for light-ftp protocol but i am getting system error please help me to resolve this error

sudo afl-fuzz -d -i ~/AFLNET/aflnet/tutorials/lightftp/in-ftp -o out-lightftp -N tcp://127.0.0.1/2200 -x ~/AFLNET/aflnet/tutorials/lightftp/ftp.dict -P FTP -D 10000 -q 3 -s 3 -E -R -c ./ftpclean.sh ./fftp fftp.conf 2200
afl-fuzz 2.56b by [email protected]
[+] You have 16 CPU cores and 3 runnable tasks (utilization: 19%).
[+] Try parallel jobs - see /usr/local/share/doc/afl/parallel_fuzzing.txt.
[] Checking CPU core loadout...
[+] Found a free CPU core, binding to #0.
[
] Checking core_pattern...
[] Checking CPU scaling governor...
[
] Setting up output directories...
[+] Output directory exists but deemed OK to reuse.
[] Deleting old session data...
[+] Output dir cleanup successful.
[
] Scanning '/home/soujanyaa/AFLNET/aflnet/tutorials/lightftp/in-ftp'...
[+] No auto-generated dictionary tokens to reuse.
[] Creating hard links for all input files...
[
] Loading extra dictionary from '/home/soujanyaa/AFLNET/aflnet/tutorials/lightftp/ftp.dict' (level 0)...
[+] Loaded 32 extra tokens, size range 3 B to 4 B.
[] Validating target binary...
[
] Attempting dry run with 'id:000000,orig:ftp_requests_full_anonymous.raw'...
[*] Spinning up the fork server...
[+] All right - fork server is up.

[-] SYSTEM ERROR : AFLNet - the states hashtable should always contain an entry of the initial state
Stop location : update_state_aware_variables(), afl-fuzz.c:910
OS message : No such process

Support Protocol Q/A

Hi.

Does the AFLNET tool support protocols operating in the Data Link Layer and Physical Layer?

Example : CAN Protocol

It seems that only protocols that support the "TCP/IP" transport layer exist.

Thank you.

aflnet(fuzzer) not working.

I tried purging to the network administrator binary and found the following error:

afl-fuzz 2.56b by [email protected]
[+] You have 8 CPU cores and 2 runnable tasks (utilization: 25%).
[+] Try parallel jobs - see /usr/local/share/doc/afl/parallel_fuzzing.txt.
[] Checking CPU core loadout...
[+] Found a free CPU core, binding to #0.
[
] Checking core_pattern...
[] Checking CPU scaling governor...
[
] Setting up output directories...
[+] Output directory exists but deemed OK to reuse.
[] Deleting old session data...
[+] Output dir cleanup successful.
[
] Scanning '../dns_testcases/'...
[+] No auto-generated dictionary tokens to reuse.
[] Creating hard links for all input files...
[
] Validating target binary...
[] Attempting dry run with 'id:000000,orig:overflow.bin'...
[
] Spinning up the fork server...
[+] All right - fork server is up.

[-] SYSTEM ERROR : AFLNet - the states hashtable should always contain an entry of the initial state
Stop location : update_state_aware_variables(), afl-fuzz.c:900
OS message : No such process

why error message?

A issue consultation for aflnet

Hello, I am very interested in the application extension of alfnet. And I use afl-g++ to achieve target service instrumented.
However, there is a problem, that could be to get your help. I searched the solutions for this issue from internet, they said it might be afl-g++’s bug. If changed to using afl-clang/afl-clang++, that could be fine.

But what I need that afl-g++ belongs to using CC which is gcc8.2, the reason that our target service and depended sub-modules are compiled with gcc8.2.
So we need to combine afl-g++(that belongs to gcc8.2) with gcc8.2 for our target service instrumented. It could be occur this issue as follows,

/home/opt/compiler/gcc-8.2/bin/../lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: bc_out/baidu/undb/meta/output/lib/libdalton-meta.a(baidu_undb_meta_dalton-meta_lib_undb_meta_client_service.cpp.o): TLS transition from R_X86_64_TLSGD to R_X86_64_GOTTPOFF against _ZN4bvar6detail10AgentGroupINS0_13AgentCombinerIjjNS0_5AddToIjEEE5AgentEE13_s_tls_blocksE' at 0xfb3f in section .text' failed /home/opt/compiler/gcc-8.2/bin/../lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: final link failed: nonrepresentable section on output collect2: error: ld returned 1 exit status

I really sincerely consult to the solution for our case . Looking forward to yours reply.

Where is the LearnLib part of the afl-net?

As its mentioned in the paper there is a module using learnlib to use ML to learn the states of the protocol. Therefore, Im trying to use afl-net but I dont know where is the learnlib module so I can modify it.

How to port for Android?

My target binary doesn't compile on host, so how to port it for Android?
I see the dependency on graphviz while Android doesn't have it.

I'm thinking these options

  1. compile aflnet on adeb on device since adeb environment can install graphviz.
  2. compile aflnet as static binary on host using cross compiler.
  3. port graphviz to android.

might need to try each.

Unnaturally high pending_favs

In order to have a baseline to compare against for my thesis i implemented the OPC UA protocol for aflnet.
It seems to work so far, but the pending_favs variable takes on some unnaturally high values.
See the following images for example:
image

Have you come across this issue as well? I'm not sure if this is from my implementation of the protocol, or maybe a bug in the stateful code.
The relevant parts should be on my fork now: https://github.com/mlgiraud/aflnet-1/tree/feature/opcua

Stack Smashing in state_sequence_to_string

On the current master branch, if the state id is too big, the sprintf call will write 11 or 12 bytes and destroy the stack.
See here:

aflnet/aflnet.c

Line 1416 in c8b7e44

char strState[10];

Changing this to char strState[12]; should fix the problem.
Also, it might be better to use snprintf.

live555 states decomposed patch not working

Hello, I'm writing my degree thesis and I am focusing on this project (I would like to implement a new protocol for AFLNet).

I was following the tutorial for live555 (Step 0).
The only different command was:
patch -p1 < $AFLNET/tutorials/live555/ceeb4f4.patch
instead of:
patch -p1 < $AFLNET/tutorials/live555/ceeb4f4_states_decomposed.patch

The problem is that when I start client to capture data with tcpdump, it doesn't stream:


❯ ./testRTSPClient rtsp://127.0.0.1:8554/wavAudioTest

Created new TCP socket 3 for connection
Connecting to 127.0.0.1, port 8554 on socket 3...
...remote connection opened
Sending request: DESCRIBE rtsp://127.0.0.1:8554/wavAudioTest RTSP/1.0
CSeq: 2
User-Agent: ./testRTSPClient (LIVE555 Streaming Media v2018.08.28)
Accept: application/sdp

Received 545 new bytes of response data.
Received a complete DESCRIBE response:
RTSP/1.0 200 OK
CSeq: 2
Date: Wed, Feb 03 2021 08:53:25 GMT
Content-Base: rtsp://127.0.0.1:8554/wavAudioTest/
Content-Type: application/sdp
Content-Length: 377

v=0
o=- 1612342402140975 1 IN IP4 192.168.0.50
s=Session streamed by "testOnDemandRTSPServer"
i=wavAudioTest
t=0 0
a=tool:LIVE555 Streaming Media v2018.08.28
a=type:broadcast
a=control:*
a=range:npt=0-5.044
a=x-qt-text-nam:Session streamed by "testOnDemandRTSPServer"
a=x-qt-text-inf:wavAudioTest
m=audio 0 RTP/AVP 10
c=IN IP4 0.0.0.0
b=AS:1411
a=control:track1

[URL:"rtsp://127.0.0.1:8554/wavAudioTest/"]: Got a SDP description:
v=0
o=- 1612342402140975 1 IN IP4 192.168.0.50
s=Session streamed by "testOnDemandRTSPServer"
i=wavAudioTest
t=0 0
a=tool:LIVE555 Streaming Media v2018.08.28
a=type:broadcast
a=control:*
a=range:npt=0-5.044
a=x-qt-text-nam:Session streamed by "testOnDemandRTSPServer"
a=x-qt-text-inf:wavAudioTest
m=audio 0 RTP/AVP 10
c=IN IP4 0.0.0.0
b=AS:1411
a=control:track1

[URL:"rtsp://127.0.0.1:8554/wavAudioTest/"]: Initiated the "audio/L16" subsession (client ports 37578-37579)
Sending request: SETUP rtsp://127.0.0.1:8554/wavAudioTest/track1 RTSP/1.0
CSeq: 3
User-Agent: ./testRTSPClient (LIVE555 Streaming Media v2018.08.28)
Transport: RTP/AVP;unicast;client_port=37578-37579

Received 208 new bytes of response data.
Received a complete SETUP response:
RTSP/1.0 201 OK
CSeq: 3
Date: Wed, Feb 03 2021 08:53:25 GMT
Transport: RTP/AVP;unicast;destination=127.0.0.1;source=127.0.0.1;client_port=37578-37579;server_port=6970-6971
Session: 000022B8;timeout=65

[URL:"rtsp://127.0.0.1:8554/wavAudioTest/"]: Failed to set up the "audio/L16" subsession: 201 OK
[URL:"rtsp://127.0.0.1:8554/wavAudioTest/"]: Failed to start playing session: No RTSP session is currently in progress

[URL:"rtsp://127.0.0.1:8554/wavAudioTest/"]: Closing the stream.


The ceeb4f4 patch is working fine, but after more than 5 hours AFLNet didn't find any crash.

Thank you

A question about afl-cov with aflnet.

Hi, I use aflnet to test a network program. When I finished test, I want to use afl-cov to see the coverage of the program. But afl-cov use stdin or file as input. However aflnet's testcase is network package.
Can you help me? Thank you very much.

Unable to build QEMU

I ran the ./build_qemu_support.sh script with the dependencies installed but it was unable to complete:

andrew ~/aflnet/qemu_mode (master) $ ./build_qemu_support.sh 
=================================================
AFL binary-only instrumentation QEMU build script
=================================================

[*] Performing basic sanity checks...
[+] All checks passed!
[*] Downloading QEMU 2.10.0 from the web...

[... long wget output ...]

2020-05-01 16:41:54 (3.39 MB/s) - ‘qemu-2.10.0.tar.xz’ saved [25040324/25040324]

[+] Cryptographic signature on qemu-2.10.0.tar.xz checks out.
[*] Uncompressing archive (this will take a while)...
[+] Unpacking successful.
[*] Configuring QEMU for ...
[*] Applying patches...
patching file linux-user/elfload.c
patching file accel/tcg/cpu-exec.c
patching file linux-user/syscall.c
patching file configure
patching file util/memfd.c
[+] Patching done.

ERROR: "cc" either does not exist or does not work

Segmentation fault in the default lightftp tutorial

Hello I'm trying to run the lightftp tutorial through the dockerfile provided and I get a segmentation fault.

ubuntu@f0588163c0a6:~/LightFTP/Source/Release$ $AFLNET/afl-fuzz -d -i $AFLNET/tutorials/lightftp/in-ftp/ -o out-lightftp -N tcp://127.0.0.1/2200 -x $AFLNET/tutor
ials/lightftp/ftp.dict -P FTP -D 10000 -q 3 -s 3 -E -R -c ./ftpclean.sh ./fftp ./fftp-tasos.conf 2200
afl-fuzz 2.56b by <[email protected]>
[+] You have 4 CPU cores and 3 runnable tasks (utilization: 75%).
[+] Try parallel jobs - see docs/parallel_fuzzing.txt.
[*] Checking CPU core loadout...
[+] Found a free CPU core, binding to #0.
[*] Checking core_pattern...
[*] Setting up output directories...
[*] Scanning '/home/ubuntu/aflnet/tutorials/lightftp/in-ftp/'...
[+] No auto-generated dictionary tokens to reuse.
[*] Creating hard links for all input files...
[*] Loading extra dictionary from '/home/ubuntu/aflnet/tutorials/lightftp/ftp.dict' (level 0)...
[+] Loaded 32 extra tokens, size range 3 B to 4 B.
[*] Validating target binary...
[*] Attempting dry run with 'id:000000,orig:ftp_requests_full_anonymous.raw'...
[*] Spinning up the fork server...
[+] All right - fork server is up.
rm: cannot remove '/home/ubuntu/fftplog': No such file or directory
rm: cannot remove '/home/ubuntu/fftplog': No such file or directory
rm: cannot remove '/home/ubuntu/fftplog': No such file or directory
rm: cannot remove '/home/ubuntu/fftplog': No such file or directory
rm: cannot remove '/home/ubuntu/fftplog': No such file or directory
rm: cannot remove '/home/ubuntu/fftplog': No such file or directory
rm: cannot remove '/home/ubuntu/fftplog': No such file or directory
rm: cannot remove '/home/ubuntu/fftplog': No such file or directory
    len = 76, map size = 15, exec speed = 1384268 us
[*] Attempting dry run with 'id:000001,orig:ftp_requests_full_normal.raw'...
rm: cannot remove '/home/ubuntu/fftplog': No such file or directory
rm: cannot remove '/home/ubuntu/fftplog': No such file or directory
rm: cannot remove '/home/ubuntu/fftplog': No such file or directory
rm: cannot remove '/home/ubuntu/fftplog': No such file or directory
rm: cannot remove '/home/ubuntu/fftplog': No such file or directory
rm: cannot remove '/home/ubuntu/fftplog': No such file or directory
rm: cannot remove '/home/ubuntu/fftplog': No such file or directory
rm: cannot remove '/home/ubuntu/fftplog': No such file or directory
    len = 83, map size = 15, exec speed = 1383848 us
[!] WARNING: No new instrumentation output, test case may be useless.
[+] All test cases processed.

[!] WARNING: The target binary is pretty slow! See docs/perf_tips.txt.
[!] WARNING: Some test cases look useless. Consider using a smaller set.
[+] Here are some useful stats:

    Test case count : 1 favored, 0 variable, 2 total
       Bitmap range : 15 to 15 bits (average: 15.00 bits)
        Exec timing : 1.38M to 1.38M us (average: 1.38M us)

[*] No -t option specified, so I'll use exec timeout of 1000 ms.
[+] All set and ready to roll!
Segmentation fault

pthread_create function in lightftp not executed

Hi, I use aflnet to test lightftp ,and i checked the the coverage of the program,found that all the pthread_create functions were not executed successfully except pthread_create in ftpmain,I think this is a reason for the low coverage,and I want to know why.Could you tell me the reason.

for example

context->WorkerThreadValid = pthread_create(&tid, NULL,(__ptr_thread_start_routine)&append_thread, context);
if ( context->WorkerThreadValid == 0 )
	context->WorkerThreadId = tid;

the context->WorkerThreadValid is never become 0
void *stor_thread(PFTPCONTEXT context) functions like this never executed

Segmentation fault when trying to fuzz uftpd.

When trying to fuzz uftpd AFLNet segfaults.
I compiled uftpd like this:
cd /home/vagrant/uftpd && sudo ./autogen.sh && sudo ./configure --prefix=/usr && sudo make CFLAGS="-g -fsanitize=address" LDFLAGS="-fsanitize=address" CC="/home/vagrant/aflnet/afl-gcc" && sudo make install
and then executed
aflnet/afl-fuzz -i in -o out -N 127.0.0.1/9999 -P FTP -m none -- uftpd -o ftp=9999 -n
as root.
AFLNet reports
afl-fuzz 2.56b by <[email protected]>
[+] You have 1 CPU core and 1 runnable tasks (utilization: 100%).
[*] Checking core_pattern...
[*] Setting up output directories...
[+] Output directory exists but deemed OK to reuse.
[*] Deleting old session data...
[+] Output dir cleanup successful.
[*] Scanning 'in'...
[+] No auto-generated dictionary tokens to reuse.
[*] Creating hard links for all input files...
[*] Validating target binary...
[*] Attempting dry run with 'id:000000,orig:in'...
[*] Spinning up the fork server...
[+] All right - fork server is up.
Segmentation fault
and journalctl | tail gives
Jul 14 13:27:59 vagrant kernel: afl-fuzz[24556]: segfault at 0 ip 00007ffff736ea1d sp 00007fffffffdf40 error 4 in libc-2.27.so[7ffff722c000+1e7000]

Connection betweeen AFLNet and AFL++?!

Hello,

I wanted to do a test with AFLNet for HTTP protocol.
When I ran the command, it showed me a message related to AFL++ which I cannot see why!
What I could see from the command, it is completely the same as the command for AFL++, how they can be distinguished?! Am I missing something here? because I cannot find any documents explaining both AFL++ and AFLNet, and I suppose they are being used for a different purpose.

Here is the message that I got after running AFLNet.

afl-fuzz++3.13a based on afl by Michal Zalewski and a large online community
[+] afl++ is maintained by Marc "van Hauser" Heuse, Heiko "hexcoder" Eißfeldt, Andrea Fioraldi and Dominik Maier
[+] afl++ is open source, get it at https://github.com/AFLplusplus/AFLplusplus
[+] NOTE: This is v3.x which changes defaults and behaviours - see README.md
[+] No -M/-S set, autoconfiguring for "-S default"
[*] Getting to work...
[+] Using exponential power schedule (FAST)
[+] Enabled testcache with 50 MB
[*] Checking core_pattern...
[!] WARNING: Could not check CPU scaling governor
[+] You have 6 CPU cores and 2 runnable tasks (utilization: 33%).
[+] Try parallel jobs - see /usr/local/share/doc/afl/parallel_fuzzing.md.
[*] Setting up output directories...
[*] Checking CPU core loadout...
[+] Found a free CPU core, try binding to #0.
[*] Scanning 'in-http/'...
[+] Loaded a total of 1 seeds.
[*] Creating hard links for all input files...
[*] Validating target binary...

[-] Looks like the target binary is not instrumented! The fuzzer depends on
    compile-time instrumentation to isolate interesting test cases while
    mutating the input data. For more information, and for tips on how to
    instrument binaries, please see /usr/local/share/doc/afl/README.md.

    When source code is not available, you may be able to leverage QEMU
    mode support. Consult the README.md for tips on how to enable this.
    (It is also possible to use afl-fuzz as a traditional, non-instrumented fuzzer.
    For that, you can use the -n option - but expect much worse results.)

[-] PROGRAM ABORT : No instrumentation detected
         Location : check_binary(), src/afl-fuzz-init.c:2737

Could you please give me more explanation of what is happening here?

Thank you in advance.
Respectfully yours,
Mahdis.

Crash at sync_fuzzers() when running without -E option (No crash with -E, but it gives another error)

I detect a crash trying synchronisation (-S ) with a parallel aflnet fuzzer, when -E is NOT provided.
I am using commit 0f51f9e

and I run fuzzer as:
/home/ubuntu/aflnet/afl-fuzz -S 1 -i /home/ubuntu/experiments/in-dns/ -o /home/ubuntu/out -N udp://127.0.0.1/5353 -P DNS -D 10000 -K ./dnsmasq

The backtrace is:
Core was generated by `/home/ubuntu/aflnet/afl-fuzz -S 1 -i /home/ubuntu/experiments/in-dns/ -o /home/'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0000000000416c7d in send_over_network () at afl-fuzz.c:1069
1069 n = net_send(sockfd, timeout, kl_val(it)->mdata, kl_val(it)->msize);
(gdb) bt
#0 0x0000000000416c7d in send_over_network () at afl-fuzz.c:1069
#1 0x0000000000417b47 in run_target (argv=argv@entry=0x7ffc36bc4c28, timeout=40) at afl-fuzz.c:3263
#2 0x0000000000403541 in sync_fuzzers (argv=0x7ffc36bc4c28) at afl-fuzz.c:7732
#3 0x0000000000405e29 in main (argc=, argv=) at afl-fuzz.c:9271

However, if I provide -E option, like:

/home/ubuntu/aflnet/afl-fuzz -S 1 -i /home/ubuntu/experiments/in-dns/ -o /home/ubuntu/out -N udp://127.0.0.1/5353 -P DNS -D 10000 -E -K ./dnsmasq

I get this error:

SYSTEM ERROR : No server states have been detected. Server responses are likely empty!
Stop location : main(), afl-fuzz.c:9167
OS message : No such process

a question about the fuzzing command

Hello!
I am a Master student working on my thesis related to AFLNet.
For getting familiar to how this fuzzer works, firstly I am trying to fuzz a C program, which is a simple echo server/client for testing fuzzers and contains vulnerabilities by design.
The problem that I am facing is the command I need to use for making the fuzzing. In the example command that you have provided: afl-fuzz -d -i in -o out -N -x -P -D 10000 -q 3 -s 3 -E -K -R <executable binary and its arguments (e.g., port number)>, do I need to make any changes for fuzzing this simple C program? (After specifying my server info, I do not know and I am not sure how to write the other part of commands.) I have provided a screenshot for that:

Fuzzing

Also, related to fuzzing ftp, the same commands and the same method should be followed?

parallel fuzzing not working

Hi,

I tried to use completely different configuration for two aflnet instances. However, when one fuzzer is getting seeds from another fuzzer (invoking sync_fuzzers). Segmentation falut happens. Here is the backtrace gdb printed:

Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) **bt**
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007f5d8b207859 in __GI_abort () at abort.c:79
#2  0x000055c1d0b3c5c8 in DFL_ck_free (mem=<optimized out>) at alloc-inl.h:150
#3  save_kl_messages_to_file (kl_messages=<optimized out>,
    fname=0x55c1d0e7bbf8 "out-lightftp/afl-slave/queue/id:000002,sync:afl-master,src:000003,+cov",
    replay_enabled=0 '\000', max_count=<optimized out>) at aflnet.c:1458
#4  0x000055c1d0b2d26d in save_if_interesting (argv=0x7ffcb7e294b8, mem=0x7f5d8b57d000, len=76,
    fault=<optimized out>) at afl-fuzz.c:4005
#5  0x000055c1d0b336b1 in sync_fuzzers (argv=0x7ffcb7e294b8) at afl-fuzz.c:7740
#6  0x000055c1d0b14c5a in main (argc=<optimized out>, argv=<optimized out>) at afl-fuzz.c:9169

Looking at the code and debug information, I noticed that the variable "kl_messages" is not initialized propley before invoking function "save_if_interesting". Could you take a look? Thanks in advanced!

about state problem

i have a question that when i send mutation M2 , if state of target changed, how the fuzz go on? will it continue to mutate m2 and send it? Or reset the target to the state s and go on mutation? Or the fuzz will reselect a new state s to fuzz?
thanks for replying!

Crashing input on live555

Hi, in order to evaluate my approach i am, in addition to open62541, testing live555 and lightftp.
For live555 i extracted some messages and added them to the corpus.
However, one of my initial inputs crashes the target (or rather it will hang, but aflnet classifies it as a crash).

Can you confirm, that the attached input bricks the server?
If not, then it is probably a configuration error on my part.
crash.tar.gz

PS:
If you are interested in some initial results, i can send them to you.
For open62541 at least it seems like i almost reach the same performance as aflnet, but without having to extract any information out of the responses (meaning you don't have to write an extraction function).

Clarification on extract_request and extract_response

I want to add new protocol to aflnet. Looking through the code, E.G extract_response_codes_http, parser continues after getting status code. Does this mean it is expected that there are multiple requests in buf? Or is this just a guard for mutated input? Same question for extract_requests_x.

Question: skipping seeds with generating_state_id != target_state_id

The state skipping works mostly analogous to AFL as far as i can tell.
However, there is one line which i am confused about.
What is the reasoning behind skipping seeds with high probability that were generated in a different state?

            //Skip this seed with high probability if it is neither an initial seed nor a seed generated while the
            //current target_state_id was targeted
            if (result->generating_state_id != target_state_id && !result->is_initial_seed && UR(100) < 90) continue;

If for example state A is fuzzed and generates a new input that discovers the new state B, then the generating state for that queue entry will be state A.
However, if we later fuzz state B, then the seed that generated this state will be skipped with 90% probability, because the generating state id is different from the target state id.

This seems counter intuitive, or am i missing something here?

What is session_virgin_bits?

I'm a little bit confused with the purpose of session_virgin_bits in these lines here. What's their purpose? AFAIKT this is a no-op right?

Some questions about the “region_t* extract_requests_*” function

Hello, I am a beginner in fuzzing and am very interested in your research. Yesterday, I read about the extract_requests_tls function. One thing is not very clear:
1、In the function extract_requests_tls (line 242), you define a variable "bytes_to_skip". I don't quite understand what this variable does? Why skip the payload?
2、Regarding the variables you define in each function of extract_requests_*: byte_count, mem_count, region_count, what do these three variables mean when reading the source code?
I am really interested in your research and hope to get your answers, thank you very much!

Some doubts about UDP encapsulation

Hi, Thuan, I have some doubts about UDP encapsulation, when I read your source code, I found AFLNET uses send and recv to wrappers for sending and receiving data over socket, but in UDP communication, recvfrom and sendto are the two functions which are often used, because it is need to know the destination socket address, just use send and recv to wrapper for sending and receiving data, Are there any problems in using UDP?

Suggestion: easier to use = more adoption

First, great job on this project so far. Really helping to get more coverage fuzzing lots of servers.

Suggestion I would make it to focus on the aflnet ecosystem and usability. Right now, as I understand it, there are many steps to prep the target for fuzzing. It would be great to narrow these steps into a simple process, closer to what its like for native AFL fuzzing, something like this:

  1. Instrument target
  2. Patch target
  3. Fuzz target

It's not straightforward to develop of course, but its worth the effort. Having a ./install.sh would be helpful as well. "Experimental" automatic patch generation would really speed up the process and less manual effort as well. Try and automate most or all the steps in the process.

Also, more real-world examples instead of just a sample app would be great. Maybe there will be more blogs with demos in time for this in nothing else.

As a reference, the Mutiny fuzzer has usability in mind: simply feed it a pcap, it generates a .fuzzer file and you pass it to ./mutiny. Super easy and simple for anyone to use.

Just my thoughts (that you all asked for in a different forum :) I hope this is helpful! Awesome project!

a question about no -E

i have a question.if -E is not enabled, aflnet also will fuzz following the sequence, but how to do the mutation. if -E is not enabled, <M1,M2,M3> will be not use, so what rules will each message in the squence do the mutation?
thanks!

how to support SNMP?

hi, when i tried to do something to support snmp, some issues occures:
1、i didn't know how to extract the status code from the response
2、if it needs to associate the response and the request

afl-analyze not working!

Hello,
I am running a test with AFLNet. AFLNet could discover several crashes in our example, and I would like to use afl-analyze to get some analysis information for the crashes or other inputs, however, I am receiving an error like this:

[-] PROGRAM ABORT : No instrumentation detected.
         Location : main(), afl-analyze.c:1077

We instrument our code in order to perform the AFLNet test. Please clarify why I am unable to utilize this tool.

Thank you in advance.

aflnet not generating que

Hello. I have been using afl-fuzz for a little while now. I just started implementing aflnet in my fuzzing. I am new to fuzzing so this is probably a very simple question. I just started the fuzzer and i am fuzzing the HTTP protocol. Is the fuzzer suposed to be generating new code paths like the standard afl-fuzz or no? also does aflnet require a dictionary file or does it mutate the next input? Here is a screenshot of my output. this is the first time i am using aflnet so i am sure i am just missing something.

I captured an HTTP requestion via wireshark and saved it as a raw file as the input for the fuzzer.

Thanks,
aflnet issue

RTSP/1.0 404 File Not Found, Or In Incorrect Format on live555 step1

Hi~👋

When I used the Tutorial - Fuzzing Live555 media streaming server, I couldn't get normal TCP packets in step1.
Here is the server output

srv

Here is the client

cuc@cuc-VirtualBox:~/workspace/live555/testProgs$ ./testRTSPClient rtsp://10.0.2.15:8554/wavAudio
Test
Created new TCP socket 3 for connection
Connecting to 10.0.2.15, port 8554 on socket 3...
...remote connection opened
Sending request: DESCRIBE rtsp://10.0.2.15:8554/wavAudioTest RTSP/1.0
CSeq: 2
User-Agent: ./testRTSPClient (LIVE555 Streaming Media v2018.08.28)
Accept: application/sdp

Received 101 new bytes of response data.
Received a complete DESCRIBE response:
RTSP/1.0 404 File Not Found, Or In Incorrect Format
CSeq: 2
Date: Tue, Jun 08 2021 14:09:59 GMT

[URL:"rtsp://10.0.2.15:8554/wavAudioTest"]: Failed to get a SDP description: 404 File Not Found, Or In Incorrect Format
[URL:"rtsp://10.0.2.15:8554/wavAudioTest"]: Closing the stream.
cuc@cuc-VirtualBox:~/workspace/live555/testProgs$ ./testRTSPClient rtsp://10.0.2.15:8554/wavAudioTest

clt2

It doesn't work to modify the ip

clt

Using wireshark to view and there is no detailed communication data package.

pcap

I strictly follow the pre-steps to construct it. Is there any other environment needed?😅

QEMU Mode not working

I followed the instructions to build AFLNet and QEMU mode (sticking with x86_64 for now). Then I built Live555 w/out AFL instrumentation. I attempt to run AFLNet in QEMU mode, but it gets stuck and I have to Ctrl+C to close it:

andrew ~/live555/testProgs $ afl-fuzz -Q -i $AFLNET/tutorials/live555/in-rtsp -o out-live555 -N tcp://127.0.0.1/8554 -x $AFLNET/tutorials/live555/rtsp.dict -P RTSP ./testOnDemandRTSPServer 8554
afl-fuzz 2.56b by <[email protected]>
[+] You have 4 CPU cores and 2 runnable tasks (utilization: 50%).
[+] Try parallel jobs - see docs/parallel_fuzzing.txt.
[*] Checking CPU core loadout...
[+] Found a free CPU core, binding to #0.
[*] Checking core_pattern...
[*] Setting up output directories...
[+] Output directory exists but deemed OK to reuse.
[*] Deleting old session data...
[+] Output dir cleanup successful.
[*] Scanning '/home/andrew/aflnet/tutorials/live555/in-rtsp'...
[+] No auto-generated dictionary tokens to reuse.
[*] Creating hard links for all input files...
[*] Loading extra dictionary from '/home/andrew/aflnet/tutorials/live555/rtsp.dict' (level 0)...
[+] Loaded 24 extra tokens, size range 3 B to 16 B.
[*] Validating target binary...
[*] Attempting dry run with 'id:000000,orig:rtsp_requests_aac.raw'...
[*] Spinning up the fork server...
[+] All right - fork server is up.
^C
[+] Here are some useful stats:

    Test case count : 0 favored, 0 variable, 7 total
       Bitmap range : 0 to 0 bits (average: 0.00 bits)
        Exec timing : 0 to 0 us (average: 0 us)

[*] No -t option specified, so I'll use exec timeout of 20 ms.
[+] All set and ready to roll!


+++ Testing aborted by user +++
[+] We're done here. Have a nice day!

I also tried messing around with various options and environment variables (e.g. AFL_NO_FORKSRV) but to no avail. The afl-showmap command does show that the program can be run under QEMU:

andrew ~/live555/testProgs $ afl-showmap -o /dev/null -Q ./testOnDemandRTSPServer 8554
afl-showmap 2.56b by <[email protected]>
[*] Executing './testOnDemandRTSPServer'...

-- Program output begins --
Unsupported setsockopt level=1 optname=15

"mpeg4ESVideoTest" stream, from the file "test.m4e"
Play this stream using the URL "rtsp://127.0.1.1:8554/mpeg4ESVideoTest"

...

(We use port 8000 for optional RTSP-over-HTTP tunneling.)
^C-- Program output ends --

+++ Program aborted by user +++
[+] Captured 2128 tuples in '/dev/null'.

So I used strace to see what's going on:

andrew ~/live555/testProgs $ strace afl-fuzz -Q -i $AFLNET/tutorials/live555/in-rtsp -o out-live555 -N tcp://127.0.1.1/8554 -P RTSP ./testOnDemandRTSPServer 8554

...

write(1, "\33[1;94m[*] \33[0mAttempting dry ru"..., 85[*] Attempting dry run with 'id:000000,orig:rtsp_requests_aac.raw'...
) = 85
openat(AT_FDCWD, "out-live555/queue/id:000000,orig:rtsp_requests_aac.raw", O_RDONLY) = 8
read(8, "DESCRIBE rtsp://127.0.0.1:8554/a"..., 515) = 515
close(8)                                = 0
openat(AT_FDCWD, "out-live555/queue/id:000000,orig:rtsp_requests_aac.raw", O_RDONLY) = 8
fstat(8, {st_mode=S_IFREG|0644, st_size=515, ...}) = 0
read(8, "DESCRIBE rtsp://127.0.0.1:8554/a"..., 4096) = 515
close(8)                                = 0
write(1, "\33[1;94m[*] \33[0mSpinning up the f"..., 50[*] Spinning up the fork server...
) = 50
pipe([8, 9])                            = 0
pipe([10, 11])                          = 0
clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fdbe359c290) = 1931
close(10)                               = 0
close(9)                                = 0
setitimer(ITIMER_REAL, {it_interval={tv_sec=0, tv_usec=0}, it_value={tv_sec=10, tv_usec=0}}, NULL) = 0
read(8, "\0\0\0\0", 4)                  = 4
setitimer(ITIMER_REAL, {it_interval={tv_sec=0, tv_usec=0}, it_value={tv_sec=0, tv_usec=0}}, NULL) = 0
write(1, "\33[1;92m[+] \33[0mAll right - fork "..., 50[+] All right - fork server is up.
) = 50
lseek(7, 0, SEEK_SET)                   = 0
write(7, "DESCRIBE rtsp://127.0.0.1:8554/a"..., 515) = 515
ftruncate(7, 515)                       = 0
lseek(7, 0, SEEK_SET)                   = 0
write(11, "\0\0\0\0", 4)                = 4
read(8, "\215\7\0\0", 4)                = 4
setitimer(ITIMER_REAL, {it_interval={tv_sec=0, tv_usec=0}, it_value={tv_sec=1, tv_usec=0}}, NULL) = 0
nanosleep({tv_sec=0, tv_nsec=10000000}, NULL) = 0
socket(AF_INET, SOCK_STREAM, IPPROTO_IP) = 9
setsockopt(9, SOL_SOCKET, SO_SNDTIMEO_OLD, "\0\0\0\0\0\0\0\0\350\3\0\0\0\0\0\0", 16) = 0
connect(9, {sa_family=AF_INET, sin_port=htons(8554), sin_addr=inet_addr("127.0.1.1")}, 16) = 0
poll([{fd=9, events=POLLIN}], 1, 1)     = 0 (Timeout)
setsockopt(9, SOL_SOCKET, SO_RCVTIMEO_OLD, "\0\0\0\0\0\0\0\0\350\3\0\0\0\0\0\0", 16) = 0
poll([{fd=9, events=POLLOUT}], 1, 1)    = 1 ([{fd=9, revents=POLLOUT}])
setsockopt(9, SOL_SOCKET, SO_SNDTIMEO_OLD, "\0\0\0\0\0\0\0\0\350\3\0\0\0\0\0\0", 16) = 0
nanosleep({tv_sec=0, tv_nsec=10000}, NULL) = 0
sendto(9, "DESCRIBE rtsp://127.0.0.1:8554/a"..., 158, MSG_NOSIGNAL, NULL, 0) = 158
poll([{fd=9, events=POLLIN}], 1, 1)     = 0 (Timeout)
setsockopt(9, SOL_SOCKET, SO_RCVTIMEO_OLD, "\0\0\0\0\0\0\0\0\350\3\0\0\0\0\0\0", 16) = 0
poll([{fd=9, events=POLLOUT}], 1, 1)    = 1 ([{fd=9, revents=POLLOUT}])
setsockopt(9, SOL_SOCKET, SO_SNDTIMEO_OLD, "\0\0\0\0\0\0\0\0\350\3\0\0\0\0\0\0", 16) = 0
nanosleep({tv_sec=0, tv_nsec=10000}, NULL) = 0
sendto(9, "SETUP rtsp://127.0.0.1:8554/aacA"..., 189, MSG_NOSIGNAL, NULL, 0) = 189
poll([{fd=9, events=POLLIN}], 1, 1)     = 0 (Timeout)
setsockopt(9, SOL_SOCKET, SO_RCVTIMEO_OLD, "\0\0\0\0\0\0\0\0\350\3\0\0\0\0\0\0", 16) = 0
poll([{fd=9, events=POLLOUT}], 1, 1)    = 1 ([{fd=9, revents=POLLOUT}])
setsockopt(9, SOL_SOCKET, SO_SNDTIMEO_OLD, "\0\0\0\0\0\0\0\0\350\3\0\0\0\0\0\0", 16) = 0
nanosleep({tv_sec=0, tv_nsec=10000}, NULL) = 0
sendto(9, "PLAY rtsp://127.0.0.1:8554/aacAu"..., 168, MSG_NOSIGNAL, NULL, 0) = 168
poll([{fd=9, events=POLLIN}], 1, 1)     = 0 (Timeout)
setsockopt(9, SOL_SOCKET, SO_RCVTIMEO_OLD, "\0\0\0\0\0\0\0\0\350\3\0\0\0\0\0\0", 16) = 0
poll([{fd=9, events=POLLIN}], 1, 1)     = 0 (Timeout)
setsockopt(9, SOL_SOCKET, SO_RCVTIMEO_OLD, "\0\0\0\0\0\0\0\0\350\3\0\0\0\0\0\0", 16) = 0
close(9)                                = 0
kill(1933, 0)                           = 0
kill(1933, 0)                           = 0
kill(1933, 0)                           = 0
kill(1933, 0)                           = 0
kill(1933, 0)                           = 0
kill(1933, 0)                           = 0
kill(1933, 0)                           = 0
kill(1933, 0)                           = 0
...

It just keeps trying to kill that PID 1933, which is the PID for the [afl-qemu-trace] <defunct> process. When I try to kill that manually in another terminal with sudo kill -9 1933 it doesn't go away. I have to kill the parent process, which is /home/andrew/aflnet/afl-qemu-trace -- ./testOnDemandRTSPServer 8554.

Problem with the commit b7a3d1c

I receive the following error with the current master, for openssl protocol:

SYSTEM ERROR : No server states have been detected. Server responses are likely empty!

Which I have detected will be resolved if I revert to the older version, before disabling write_to_testcase.

Install doesn't work on Ubuntu 18.04

The readme says to run the following command to install:

export PATH=$AFLNET:$PATH
export AFL_PATH=$AFLNET

For me, this results in this error when I run try to run this command:

gcc -fprofile-arcs -ftest-coverage -g -o fotbot-gcov fotbot.c

The error is show here:
image

Changing the export to this:

export PATH=$PATH:$AFLNET

Fixes the issue.

Enabling instrumentation

Hello,
How can I enable instrumentation for a binary im trying to test aflnet on, I tried with the -finstrument-functions but im still getting a binary not instrumented warning. Any particular flags i can use during compilation ?

persistent mode don't work

It doesn't seem to work when I use persistent mode. AFL-fuzz stops at the location shown below and doesn't continue running.
图片
If don't use persistent mode, it runs too slowly.

there is something wrong when fuzzing, perhaps a bug exists in your code?

when it works about 12h, it will abort unexpectedly, as follows:
lq process timing qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqwq overall results qqqqqk
x run time : 0 days, 12 hrs, 50 min, 11 sec x cycles done : 97 x
x last new path : 0 days, 0 hrs, 10 min, 0 sec x total paths : 270 x
x last uniq crash : 0 days, 1 hrs, 52 min, 5 sec x uniq crashes : 36 x
x last uniq hang : none seen yet x uniq hangs : 0 x
tq cycle progress qqqqqqqqqqqqqqqqqqqqwq map coverage qvqqqqqqqqqqqqqqqqqqqqqqqu
x now processing : 265 (98.15%) x map density : 1.02% / 1.30% x
x paths timed out : 0 (0.00%) x count coverage : 4.73 bits/tuple x
tq stage progress qqqqqqqqqqqqqqqqqqqqnq findings in depth qqqqqqqqqqqqqqqqqqqqu
x now trying : havoc x favored paths : 21 (7.78%) x
x stage execs : 61/409 (14.91%) x new edges on : 48 (17.78%) x
x total execs : 117k x total crashes : 1436 (36 unique) x
x exec speed : 2.25/sec (zzzz...) x total tmouts : 35.7k (61 unique) x
tq fuzzing strategy yields qqqqqqqqqqqvqqqqqqqqqqqqqqqwq path geometry qqqqqqqqu
x bit flips : n/a, n/a, n/a x levels : 11 x
x byte flips : n/a, n/a, n/a x pending : 142 x
x arithmetics : n/a, n/a, n/a x pend fav : 0 x
x known ints : n/a, n/a, n/a x own finds : 266 x
x dictionary : n/a, n/a, n/a x imported : n/a x
x havoc : 171/40.3k, 131/71.1k x stability : 100.00% x
x trim : n/a, n/a tqqqqqqqqqqqqqqqqqqqqqqqqj
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj [cpu000: 53%]
[-] PROGRAM ABORT : Bad alloc request: 1073741828 bytes
Stop location : DFL_ck_realloc(), alloc-inl.h:197

Aborted

M2_start_region_ID wrong?

Hi there,

by reading the paper I understand that, for mutation, the original sequence M is split into 3:

  • M1 is the prefix needed to reach the target state s (i.e. transitions a->b->s;
  • M2 is the sub-sequence that remains in s (i.e. transitions like s->s);
  • M3 is the leftover (i.e. s->x->y).

Mutation is then applied only on M2 so that M' (the mutated sequence) still reaches s (e.g. if M=<m1,m2,m3> exercises a->s->b, M'=<m1,m2',m3> should still result in a sequence of states starting in a->s).

Instead,

aflnet/afl-fuzz.c

Lines 5892 to 5903 in e2a6b2d

for(i = 0; i < queue_cur->region_count; i++) {
u32 regionalStateCount = queue_cur->regions[i].state_count;
if (regionalStateCount > 0) {
//reachableStateID is the last ID in the state_sequence
u32 reachableStateID = queue_cur->regions[i].state_sequence[regionalStateCount - 1];
if (reachableStateID == target_state_id) break;
M2_start_region_ID++;
} else {
//No annotation for this region
return 1;
}
}
seems to set M2_start_region_ID to the index of the region that reaches the target state, instead of the one right after; in other words, it looks like M2_start_region_ID is set to the index of the last region of M1.

Possibility of adding support of HTTP protocol

Hello, I recently became quite engaged in fuzzing and I luckily stumbled onto your project. I've already learned quite a lot from your work :)
I was wondering if you could share your thoughts on possibility (and practicality) of adapting aflnet to work with http protocol (by means of adding extract_* functions). My end goal is to fuzz cups (or rather cupsd) which communicates, if I understand correctly, thorugh http (and ipp, obviosuly). I rather hoped that you might comment whether there are any obvious significant challenges to this idea (that I myself missed due to lack of experience with aflnet tool).

Thanks a lot!

PROGRAM ABORT : Short write to (null)

Hi.

Sometimes afl-fuz creates a conflict.

What's the reason?

Error log

[-] PROGRAM ABORT : Short write to (null)
         Location : write_to_testcase(), afl-fuzz.c:3347
                  american fuzzy lop 2.56b (dns)

┌─ process timing ─────────────────────────────────────┬─ overall results ─────┐
│        run time : 0 days, 0 hrs, 4 min, 53 sec       │  cycles done : 0      │
│   last new path : 0 days, 0 hrs, 0 min, 8 sec        │  total paths : 216    │
│ last uniq crash : none seen yet                      │ uniq crashes : 0      │
│  last uniq hang : none seen yet                      │   uniq hangs : 0      │
├─ cycle progress ────────────────────┬─ map coverage ─┴───────────────────────┤
│  now processing : 211 (97.69%)      │    map density : 1.28% / 1.48%         │
│ paths timed out : 0 (0.00%)         │ count coverage : 2.23 bits/tuple       │
├─ stage progress ────────────────────┼─ findings in depth ────────────────────┤
│  now trying : havoc                 │ favored paths : 9 (4.17%)              │
│ stage execs : 308/408 (75.49%)      │  new edges on : 36 (16.67%)            │
│ total execs : 8777                  │ total crashes : 0 (0 unique)           │
│  exec speed : 27.89/sec (slow!)     │  total tmouts : 0 (0 unique)           │
├─ fuzzing strategy yields ───────────┴───────────────┬─ path geometry ────────┤
│   bit flips : n/a, n/a, n/a                         │    levels : 5          │
│  byte flips : n/a, n/a, n/a                         │   pending : 197        │
│ arithmetics : n/a, n/a, n/a                         │  pend fav : 0          │
│  known ints : n/a, n/a, n/a                         │ own finds : 19         │
│  dictionary : n/a, n/a, n/a                         │  imported : n/a        │
│       havoc : 7/1364, 10/4704                       │ stability : 77.77%     │
│        trim : n/a, n/a                              ├────────────────────────┘
└─────────────────────────────────────────────────────┘             [cpu:100%]
[-] PROGRAM ABORT : Short write to (null)
         Location : write_to_testcase(), afl-fuzz.c:3347

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.