Skip to content

Commit df52157

Browse files
Merge pull request AFLplusplus#352 from AFLplusplus/dev
Pull to master because of crash in string compare transform
2 parents c7de368 + a13958b commit df52157

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+3084
-319
lines changed

GNUmakefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ test_python:
307307
else
308308

309309
test_python:
310-
@echo "[-] You seem to need to install the package python3-dev or python2-dev (and perhaps python[23]-apt), but it is optional so we continue"
310+
@echo "[-] You seem to need to install the package python3-dev, python2-dev or python-dev (and perhaps python[23]-apt), but it is optional so we continue"
311311

312312
endif
313313

@@ -445,6 +445,7 @@ clean:
445445
-$(MAKE) -C gcc_plugin clean
446446
$(MAKE) -C libdislocator clean
447447
$(MAKE) -C libtokencap clean
448+
$(MAKE) -C examples/afl_network_proxy clean
448449
$(MAKE) -C examples/socket_fuzzing clean
449450
$(MAKE) -C examples/argv_fuzzing clean
450451
$(MAKE) -C qemu_mode/unsigaction clean
@@ -468,6 +469,7 @@ distrib: all radamsa
468469
-$(MAKE) -C gcc_plugin
469470
$(MAKE) -C libdislocator
470471
$(MAKE) -C libtokencap
472+
$(MAKE) -C examples/afl_network_proxy
471473
$(MAKE) -C examples/socket_fuzzing
472474
$(MAKE) -C examples/argv_fuzzing
473475
cd qemu_mode && sh ./build_qemu_support.sh
@@ -476,6 +478,7 @@ distrib: all radamsa
476478
binary-only: all radamsa
477479
$(MAKE) -C libdislocator
478480
$(MAKE) -C libtokencap
481+
$(MAKE) -C examples/afl_network_proxy
479482
$(MAKE) -C examples/socket_fuzzing
480483
$(MAKE) -C examples/argv_fuzzing
481484
cd qemu_mode && sh ./build_qemu_support.sh
@@ -486,6 +489,9 @@ source-only: all radamsa
486489
-$(MAKE) -C gcc_plugin
487490
$(MAKE) -C libdislocator
488491
$(MAKE) -C libtokencap
492+
#$(MAKE) -C examples/afl_network_proxy
493+
#$(MAKE) -C examples/socket_fuzzing
494+
#$(MAKE) -C examples/argv_fuzzing
489495

490496
%.8: %
491497
@echo .TH $* 8 $(BUILD_DATE) "afl++" > $@
@@ -521,6 +527,7 @@ install: all $(MANPAGES)
521527
if [ -f afl-fuzz-document ]; then set -e; install -m 755 afl-fuzz-document $${DESTDIR}$(BIN_PATH); fi
522528
if [ -f socketfuzz32.so -o -f socketfuzz64.so ]; then $(MAKE) -C examples/socket_fuzzing install; fi
523529
if [ -f argvfuzz32.so -o -f argvfuzz64.so ]; then $(MAKE) -C examples/argv_fuzzing install; fi
530+
if [ -f examples/afl_network_proxy/afl-network-server ]; then $(MAKE) -C examples/afl_network_proxy install; fi
524531

525532
set -e; ln -sf afl-gcc $${DESTDIR}$(BIN_PATH)/afl-g++
526533
set -e; if [ -f afl-clang-fast ] ; then ln -sf afl-clang-fast $${DESTDIR}$(BIN_PATH)/afl-clang ; ln -sf afl-clang-fast $${DESTDIR}$(BIN_PATH)/afl-clang++ ; else ln -sf afl-gcc $${DESTDIR}$(BIN_PATH)/afl-clang ; ln -sf afl-gcc $${DESTDIR}$(BIN_PATH)/afl-clang++; fi

TODO.md

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# TODO list for AFL++
22

3-
## Roadmap 2.65
3+
## Roadmap 2.65+
44

5-
- AFL_MAP_SIZE for afl-llvm-pass, qemu_mode and unicorn_mode
6-
- fix stability calculation bug
5+
- InsTrim mode for LTO solution
6+
- AFL_MAP_SIZE for qemu_mode and unicorn_mode
77
- random crc32 HASH_CONST per run? because with 65536 paths we have collisions
88
- namespace for targets? e.g. network
99
- libradamsa as a custom module?
@@ -13,31 +13,22 @@
1313
afl-fuzz:
1414
- sync_fuzzers(): only masters sync from all, slaves only sync from master
1515
(@andrea: be careful, often people run all slaves)
16-
- ascii_only mode for mutation output
16+
- ascii_only mode for mutation output - or use a custom mutator for this?
1717
- setting min_len/max_len/start_offset/end_offset limits for mutation output
1818

1919
llvm_mode:
20-
- added context sensitive branch coverage
21-
- add CT cov and ngram cov to LTO and InsTrim
2220
- better whitelist solution for LTO
2321

2422
gcc_plugin:
2523
- laf-intel
2624
- better instrumentation (seems to be better with gcc-9+)
2725

2826
qemu_mode:
29-
- update to 4.x (probably this will be skipped :( )
27+
- update to 5.x (if the performance bug if gone)
3028
- non colliding instrumentation
31-
- instrim for QEMU mode via static analysis (with r2pipe? or angr?)
32-
Idea: The static analyzer outputs a map in which each edge that must be
33-
skipped is marked with 1. QEMU loads it at startup in the parent process.
3429
- rename qemu specific envs to AFL_QEMU (AFL_ENTRYPOINT, AFL_CODE_START/END,
3530
AFL_COMPCOV_LEVEL?)
3631
- add AFL_QEMU_EXITPOINT (maybe multiple?), maybe pointless as we have
3732
persistent mode
3833
- add/implement AFL_QEMU_INST_LIBLIST and AFL_QEMU_NOINST_PROGRAM
3934
- add/implement AFL_QEMU_INST_REGIONS as a list of _START/_END addresses
40-
41-
custom_mutators:
42-
- rip what Superion is doing into custom mutators for js, php, etc.
43-

docs/Changelog.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ sending a mail to <[email protected]>.
2020
address for the shared memory map is used as this increases the
2121
fuzzing speed
2222
- fixes to LTO mode if instrumented edges > MAP_SIZE
23+
- CTX and NGRAM can now be used together
24+
- CTX and NGRAM are now also supported in CFG/INSTRIM mode
25+
- AFL_LLVM_LAF_TRANSFORM_COMPARES could crash, fixed
26+
- added AFL_LLVM_SKIP_NEVERZERO to skip the never zero coverage counter
27+
implementation. For targets with few or no loops or heavily called
28+
functions. Gives a small performance boost.
2329
- qemu_mode:
2430
- add information on PIE/PIC load addresses for 32 bit
2531
- better dependency checks
@@ -28,6 +34,13 @@ sending a mail to <[email protected]>.
2834
- unicorn_mode:
2935
- better submodule handling
3036
- afl-showmap: fix for -Q mode
37+
- added examples/afl_network_proxy which allows to fuzz a target over the
38+
network (not fuzzing tcp/ip services but running afl-fuzz on one system
39+
and the target being on an embedded device)
40+
- added examples/afl_untracer which does a binary-only fuzzing with the
41+
modifications done in memory
42+
- added examples/afl_proxy which can be easily used to fuzz and instrument
43+
non-standard things
3144
- all:
3245
- forkserver communication now also used for error reporting
3346
- fix 32 bit build options

docs/env_variables.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,15 @@ Then there are a few specific features that are only available in llvm_mode:
9797

9898
- AFL_LLVM_INSTRUMENT - this configures the instrumentation mode.
9999
Available options:
100-
DEFAULT - classic AFL (map[cur_loc ^ prev_loc >> 1]++)
100+
CLASSIC - classic AFL (map[cur_loc ^ prev_loc >> 1]++) (default)
101101
CFG - InsTrim instrumentation (see below)
102102
LTO - LTO instrumentation (see below)
103103
CTX - context sensitive instrumentation (see below)
104104
NGRAM-x - deeper previous location coverage (from NGRAM-2 up to NGRAM-16)
105-
Only one can be used.
105+
In CLASSIC (default) and CFG/INSTRIM you can also specify CTX and/or
106+
NGRAM, seperate the options with a comma "," then, e.g.:
107+
AFL_LLVM_INSTRUMENT=CFG,CTX,NGRAM-4
108+
Not that this is a good idea to use both CTX and NGRAM :)
106109

107110
### LTO
108111

@@ -204,6 +207,10 @@ Then there are a few specific features that are only available in llvm_mode:
204207
slowdown due a performance issue that is only fixed in llvm 9+.
205208
This feature increases path discovery by a little bit.
206209

210+
- Setting AFL_LLVM_SKIP_NEVERZERO=1 will not implement the skip zero
211+
test. If the target performs only few loops then this will give a
212+
small performance boost.
213+
207214
See llvm_mode/README.neverzero.md
208215

209216
### CMPLOG
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
PREFIX ?= /usr/local
2+
BIN_PATH = $(PREFIX)/bin
3+
DOC_PATH = $(PREFIX)/share/doc/afl
4+
5+
PROGRAMS = afl-network-client afl-network-server
6+
7+
HASH=\#
8+
9+
ifdef STATIC
10+
CFLAGS += -static
11+
endif
12+
13+
ifeq "$(shell echo '$(HASH)include <libdeflate.h>@int main() { struct libdeflate_compressor *d = libdeflate_alloc_compressor(1); return 0;}' | tr @ '\n' | $(CC) $(CFLAGS) -x c - -o .test2 -ldeflate 2>/dev/null && echo 1 || echo 0 ; rm -f .test2 )" "1"
14+
CFLAGS += -DUSE_DEFLATE=1
15+
LDFLAGS += -ldeflate
16+
$(info libdeflate-dev was detected, using compression)
17+
else
18+
$(warn did not find libdeflate-dev, cannot use compression)
19+
endif
20+
21+
all: $(PROGRAMS)
22+
23+
help:
24+
@echo make options:
25+
@echo STATIC - build as static binaries
26+
@echo COMPRESS_TESTCASES - compress test cases
27+
28+
afl-network-client: afl-network-client.c
29+
$(CC) $(CFLAGS) -I../../include -o afl-network-client afl-network-client.c $(LDFLAGS)
30+
31+
afl-network-server: afl-network-server.c
32+
$(CC) $(CFLAGS) -I../../include -o afl-network-server afl-network-server.c ../../src/afl-forkserver.c ../../src/afl-sharedmem.c ../../src/afl-common.c -DBIN_PATH=\"$(BIN_PATH)\" $(LDFLAGS)
33+
34+
clean:
35+
rm -f $(PROGRAMS) *~ core
36+
37+
install: all
38+
install -d -m 755 $${DESTDIR}$(BIN_PATH) $${DESTDIR}$(DOC_PATH)
39+
install -m 755 $(PROGRAMS) $${DESTDIR}$(BIN_PATH)
40+
install -T -m 644 README.md $${DESTDIR}$(DOC_PATH)/README.network_proxy.md
41+

examples/afl_network_proxy/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
all:
2+
@echo please use GNU make, thanks!

examples/afl_network_proxy/README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# afl-network-proxy
2+
3+
If you want to run afl-fuzz over the network than this is what you need :)
4+
Note that the impact on fuzzing speed will be huge, expect a loss of 90%.
5+
6+
## When to use this
7+
8+
1. when you have to fuzz a target that has to run on a system that cannot
9+
contain the fuzzing output (e.g. /tmp too small and file system is read-only)
10+
2. when the target instantly reboots on crashes
11+
3. ... any other reason you would need this
12+
13+
## how to get it running
14+
15+
### Compiling
16+
17+
Just type `make` and let the autodetection do everything for you.
18+
19+
Note that you will get a 40-50% performance increase if you have libdeflate-dev
20+
installed. The GNUmakefile will autodetect it if present.
21+
22+
If your target has large test cases (10+kb) that are ascii only or large chunks
23+
of zero blocks then set `CFLAGS=-DCOMPRESS_TESTCASES=1` to compress them.
24+
For most targets this hurts performance though so it is disabled by default.
25+
26+
### on the target
27+
28+
Run `afl-network-server` with your target with the -m and -t values you need.
29+
Important is the -i parameter which is the TCP port to listen on.
30+
e.g.:
31+
```
32+
$ afl-network-server -i 1111 -m 25M -t 1000 -- /bin/target -f @@
33+
```
34+
35+
### on the (afl-fuzz) master
36+
37+
Just run afl-fuzz with your normal options, however the target should be
38+
`afl-network-client` with the IP and PORT of the `afl-network-server` and
39+
increase the -t value:
40+
```
41+
$ afl-fuzz -i in -o out -t 2000+ -- afl-network-client TARGET-IP 1111
42+
```
43+
Note the '+' on the -t parameter value. The afl-network-server will take
44+
care of proper timeouts hence afl-fuzz should not. The '+' increases the
45+
timeout and the value itself should be 500-1000 higher than the one on
46+
afl-network-server.
47+
48+
### networking
49+
50+
The TARGET can be an IPv4 or IPv6 address, or a host name that resolves to
51+
either. Note that also the outgoing interface can be specified with a '%' for
52+
`afl-network-client`, e.g. `fe80::1234%eth0`.
53+
54+
Also make sure your default TCP window size is larger than your MAP_SIZE
55+
(130kb is a good value).
56+
On Linux that is the middle value of `/proc/sys/net/ipv4/tcp_rmem`
57+
58+
## how to compile and install
59+
60+
`make && sudo make install`
61+

0 commit comments

Comments
 (0)