source: zzuf/trunk/doc/zzuf.1 @ 1577

Last change on this file since 1577 was 1577, checked in by Sam Hocevar, 14 years ago
  • Documentation tuning.
File size: 11.5 KB
[1507]1.TH zzuf 1 "2006-12-22" "zzuf"
3zzuf \- multiple purpose fuzzer
[1562]5\fBzzuf\fR [\fB\-cdinqS\fR] [\fB\-r\fR \fIratio\fR] [\fB\-s\fR \fIseed\fR | \fB\-s\fR \fIstart:stop\fR]
[1573]7               [\fB\-F\fR \fIforks\fR] [\fB\-C\fR \fIcrashes\fR] [\fB\-B\fR \fIbytes\fR] [\fB\-T\fR \fIseconds\fR]
[1577]9               [\fB\-P\fR \fIprotect\fR] [\fB\-R\fR \fIrefuse\fR]
[1560]11               [\fB\-I\fR \fIinclude\fR] [\fB\-E\fR \fIexclude\fR] \fIPROGRAM\fR [\fIARGS\fR]...
13\fBzzuf \-h\fR | \fB\-\-help\fR
15\fBzzuf \-v\fR | \fB\-\-version\fR
18\fBZzuf\fR is a transparent application input fuzzer. It works by intercepting
[1569]19file and network operations and changing random bits in the program's input.
20\fBZzuf\fR's behaviour is deterministic, making it easy to reproduce bugs.
[1507]21.SH USAGE
23\fBZzuf\fR will run an application specified on its command line, one or
24several times, with optional arguments, and will report the application's
[1557]25relevant behaviour on the standard output, eg:
[1559]27\fB    zzuf cat /dev/zero\fR
[1559]29If you want to specify flags for your application, put a \(oq\fB\-\-\fR\(cq
[1557]30marker before them on the command line (otherwise \fBzzuf\fR will try to
31interpret them as arguments for itself), eg:
[1559]33\fB    zzuf \-B 1000 cat \-\- \-v /dev/zero\fR
[1507]34.SH OPTIONS
[1539]36\fB\-B\fR, \fB\-\-max\-bytes\fR=\fIn\fR
37Automatically terminate child processes that output more than \fIn\fR bytes
38on the standard output and standard error channels. This is useful to detect
39infinite loops. See also the \fB\-T\fR flag.
[1539]41\fB\-c\fR, \fB\-\-cmdline\fR
[1529]42Only fuzz files whose name is specified in the target application's command
43line. This is mostly a shortcut to avoid specifiying twice the argument:
45\fB    zzuf \-c cat file.txt\fR
47has the same effect as
49\fB    zzuf \-I \(aq^file\\.txt$\(aq cat file.txt\fR
[1569]51See the \fB\-I\fR flag for more information on restricting fuzzing to
52specific files.
[1573]54\fB\-C\fR, \fB\-\-max\-crashes\fR=\fIn\fR
55Stop forking when at least \fIn\fR children have crashed. The default value
56is 1, meaning \fBzzuf\fR will stop as soon as one child has crashed. A process
57is considered to have crashed if any signal (such as, but not limited to,
58\fBSIGSEGV\fR) caused it to exit.
60This option is only relevant if the \fB\-s\fR flag is used with an interval
[1539]63\fB\-d\fR, \fB\-\-debug\fR
[1531]64Activate the display of debug messages.
[1539]66\fB\-E\fR, \fB\-\-exclude\fR=\fIregex\fR
67Do not fuzz files whose name matches the \fIregex\fR regular expression. This
68option supersedes anything that is specified by the \fB\-I\fR flag. Use this
69for instance if you are unsure of what files your application is going to read
70and do not want it to fuzz files in the \fB/etc\fR directory.
[1539]72Multiple \fB\-E\fR flags can be specified, in which case files matching any one
73of the regular expressions will be ignored.
[1573]75\fB\-F\fR, \fB\-\-max-forks\fR=\fIforks\fR
76Specify the number of simultaneous children that can be run.
78This option is only relevant if the \fB\-s\fR flag is used with an interval
[1539]81\fB\-i\fR, \fB\-\-stdin\fR
82Fuzz the application's standard input. By default \fBzzuf\fR only fuzzes files.
[1539]84\fB\-I\fR, \fB\-\-include\fR=\fIregex\fR
85Only fuzz files whose name matches the \fIregex\fR regular expression. Use
86this for instance if your application reads configuration files at startup
87and you only want specific files to be fuzzed.
[1539]89Multiple \fB\-I\fR flags can be specified, in which case files matching any one
90of the regular expressions will be fuzzed. See also the \fB\-c\fR flag.
[1562]92\fB\-n\fR, \fB\-\-network\fR
[1560]93Fuzz the application's network input. By default \fBzzuf\fR only fuzzes files.
[1554]95\fB\-P\fR, \fB\-\-protect\fR=\fIlist\fR
96Protect a list of characters so that if they appear in input data that would
97normally be fuzzed, they are left unmodified instead.
99Characters in \fIlist\fR can be expressed verbatim or through escape sequences.
100The sequences interpreted by \fBzzuf\fR are:
104new line
113the byte whose octal value is \fINNN\fR
116the byte whose hexadecimal value is \fINN\fR
[1559]119backslash (\(oq\\\(cq)
[1559]122You can use \(oq\fB-\fR\(cq to specify ranges. For instance, to protect all
[1577]123bytes from \(oq\\001\(cq to \(oq/\(cq, use \(oq\fB\-P\ \(dq\\001-/\(dq\fR\(cq.
[1563]125The statistical outcome of this option should not be overlooked: if characters
126are protected, the effect of the \(oq\fB\-r\fR\(cq flag will vary depending
127on the data being fuzzed. For instance, asking to fuzz 1% of input bits
128(\fB\-r\ 0.01\fR) and to protect lowercase characters (\fB\-P\ a-z\fR) will
129result in an actual average fuzzing ratio of 0.9% with truly random data,
1300.3% with random ASCII data and 0.2% with standard English text.
[1555]132See also the \fB\-R\fR flag.
[1539]134\fB\-q\fR, \fB\-\-quiet\fR
[1531]135Hide the output of the fuzzed application. This is useful if the application
[1532]136is very verbose but only its exit code or signaled status is really useful to
[1539]139\fB\-r\fR, \fB\-\-ratio\fR=\fIratio\fR
[1557]140Specify the proportion of bits that will be randomly fuzzed. A value of 0
[1531]141will not fuzz anything. A value of 0.05 will fuzz 5% of the open files'
142bits. A value of 1.0 or more will fuzz all the bytes, theoretically making
143the input files undiscernible from random data. The default fuzzing ratio
144is 0.004 (fuzz 0.4% of the files' bits).
[1555]146\fB\-R\fR, \fB\-\-refuse\fR=\fIlist\fR
147Refuse a list of characters by not fuzzing bytes that would otherwise be
148changed to a character that is in \fIlist\fR. If the original byte is already
149in \fIlist\fR, it is left unchanged.
151See the \fB\-P\fR option for a description of \fIlist\fR.
[1539]153\fB\-s\fR, \fB\-\-seed\fR=\fIseed\fR
[1531]154.PD 0
[1539]156\fB\-s\fR, \fB\-\-seed\fR=\fIstart:stop\fR
158Specify the random seed to use for fuzzing, or an interval of random seeds.
[1539]159Running \fBzzuf\fR twice with the same random seed will fuzz the files exactly
160the same way, even with a different target application. The purpose of this is
161to use simple utilities such as \fBcat\fR or \fBcp\fR to generate a file that
162causes the target application to crash.
[1539]164If an interval is specified, \fBzzuf\fR will run the application several times,
165each time with a different seed, and report the behaviour of each run.
[1539]167\fB\-S\fR, \fB\-\-signal\fR
[1532]168Prevent children from installing signal handlers for signals that usually
[1539]169cause coredumps. These signals are \fBSIGABRT\fR, \fBSIGFPE\fR, \fBSIGILL\fR,
170\fBSIGQUIT\fR, \fBSIGSEGV\fR, \fBSIGTRAP\fR and, if available on the running
171platform, \fBSIGSYS\fR, \fBSIGEMT\fR, \fBSIGBUS\fR, \fBSIGXCPU\fR and
172\fBSIGXFSZ\fR. Instead of calling the signal handler, the application will
173simply crash. If you do not want core dumps, you should set appropriate limits
174with the \fBlimit coredumpsize\fR command. See your shell's documentation on
175how to set such limits.
[1539]177\fB\-T\fR, \fB\-\-max\-time\fR=\fIn\fR
178Automatically terminate child processes that run for more than \fIn\fR
[1531]179seconds. This is useful to detect infinite loops or processes stuck in other
[1539]180situations. See also the \fB\-B\fR flag.
[1554]182\fB\-h\fR, \fB\-\-help\fR
183Display a short help message and exit.
[1539]185\fB\-v\fR, \fB\-\-version\fR
[1507]186Output version information and exit.
189Fuzz the input of the \fBcat\fR program using default settings:
[1559]191\fB    zzuf cat /etc/motd\fR
193Fuzz 1% of the input bits of the \fBcat\fR program using seed 94324:
[1559]195\fB    zzuf -s 94324 -r 0.01 cat /etc/motd\fR
[1569]197Fuzz the input of the \fBcat\fR program but do not fuzz newline characters
[1555]198and prevent non-ASCII characters from appearing in the output:
[1563]200\fB    zzuf -P \(aq\\n\(aq -R \(aq\\x00-\\x1f\\x7f-\\xff\(aq cat /etc/motd\fR
[1539]202Fuzz the input of the \fBconvert\fR program, using file \fBfoo.jpeg\fR as the
203original input and excluding \fB.xml\fR files from fuzzing (because
204\fBconvert\fR will also open its own XML configuration files and we do not
205want \fBzzuf\fR to fuzz them):
[1559]207\fB    zzuf -E \(aq\\.xml$\(aq convert -- foo.jpeg -format tga /dev/null\fR
[1563]209Fuzz the input of \fBVLC\fR, using file \fBmovie.avi\fR as the original input
[1539]210and restricting fuzzing to filenames that appear on the command line
[1559]211(\fB\-c\fR), then generate \fBfuzzy-movie.avi\fR which is a file that
[1563]212can be read by \fBVLC\fR to reproduce the same behaviour without using
[1559]215\fB    zzuf -c -s 87423 -r 0.01 vlc movie.avi\fR
216\fB    zzuf -c -s 87423 -r 0.01 cp movie.avi fuzzy-movie.avi\fR
217\fB    vlc fuzzy-movie.avi\fR
[1563]219Fuzz 2% of \fBMPlayer\fR's input bits (\fB\-r\ 0.02\fR) with seeds 0 to 9999
[1559]220(\fB\-s\ 0:10000\fR), disabling its standard output messages (\fB\-q\fR),
221launching up to three simultaneous child processes (\fB\-F\ 3\fR), killing
[1563]222\fBMPlayer\fR if it takes more than one minute to read the file (\fB\-T\ 60\fR)
[1539]223and disabling its \fBSIGSEGV\fR signal handler (\fB\-S\fR):
[1573]225\fB    zzuf -c -r 0.02 -q -s 0:10000 -F 3 -T 60 -S \\\fR
[1559]226\fB      mplayer -- -benchmark -vo null -fps 1000 movie.avi\fR
[1557]229Due to \fBzzuf\fR using shared object preloading (\fBLD_PRELOAD\fR on most
230Unix systems, \fBDYLD_INSERT_LIBRARIES\fR on Mac OS X) to run its child
231processes, it will fail in the presence of any mechanism that disables
232preloading. For instance setuid root binaries will not be fuzzed when run
[1569]233as an unprivileged user.
[1569]235Though best efforts are made, identical behaviour for different versions of
236\fBzzuf\fR is not guaranteed. The reproducibility for subsequent calls on
237different operating systems and with different target programs is only
238guaranteed when the same version of \fBzzuf\fR is being used.
[1557]241It is not yet possible to insert or drop bytes from the input, to fuzz
[1569]242according to the file format, to swap bytes, etc. More advanced fuzzing
243methods are planned.
245As of now, \fBzzuf\fR does not really support multithreaded applications. The
[1557]246behaviour with multithreaded applications where more than one thread does file
[1569]247descriptor operations is undefined.
[1570]249In order to intercept file and network operations and signal handlers,
250\fBzzuf\fR diverts and reimplements the following functions:
252Unix low-level file and socket handling:
253\fBopen\fR(), \fBlseek\fR(), \fBread\fR(), \fBaccept\fR(), \fBsocket\fR(),
256Standard IO streams:
257\fBfopen\fR(), \fBfseek\fR(), \fBfread\fR(), \fBgetc\fR(), \fBfgetc\fR(),
258\fBfgets\fR(), \fBungetc\fR(), \fBfclose\fR()
260GNU libc specific:
261\fBopen64\fR(), \fBlseek64\fR(), \fBgetline\fR(), \fBgetdelim\fR(),
264BSD specific:
267Signal handling:
268\fBsignal\fR(), \fBsigaction\fR()
[1575]270If an application manipulates file descriptors (reading data, seeking around)
271using functions that are not in that list, \fBzzuf\fR will not fuzz its
272input consistently and the results should not be trusted. You can use a tool
273such as \fBltrace(1)\fR on Linux to know the missing functions.
[1570]275One important unimplemented function is \fBfscanf\fR(), mostly because of its
276complexity. Missing functions will be implemented based upon user request.
[1563]277.SH HISTORY
279\fBZzuf\fR started its life in 2002 as the \fBstreamfucker\fR tool, a small
280multimedia stream corrupter used to find bugs in the \fBVLC\fR media player.
[1507]281.SH AUTHOR
[1570]283Copyright \(co 2002, 2007 Sam Hocevar <>.
285\fBZzuf\fR and this manual page are free software. They come without any
286warranty, to the extent permitted by applicable law. You can redistribute
287them and/or modify them under the terms of the Do What The Fuck You Want
288To Public License, Version 2, as published by Sam Hocevar. See
289\fB\fR for more details.
291\fBZzuf\fR's webpage can be found at \fB\fR.
Note: See TracBrowser for help on using the repository browser.