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

Last change on this file since 1560 was 1560, checked in by Sam Hocevar, 14 years ago
  • Network support.
File size: 10.1 KB
Line 
1.TH zzuf 1 "2006-12-22" "zzuf"
2.SH NAME
3zzuf \- multiple purpose fuzzer
4.SH SYNOPSIS
5\fBzzuf\fR [\fB\-cdiNqS\fR] [\fB\-r\fR \fIratio\fR] [\fB\-s\fR \fIseed\fR | \fB\-s\fR \fIstart:stop\fR]
6.br
7               [\fB\-F\fR \fIchildren\fR] [\fB\-B\fR \fIbytes\fR] [\fB\-T\fR \fIseconds\fR]
8.br
9               [\fB\-P\fR \fIlist\fR] [\fB\-R\fR \fIlist\fR]
10.br
11               [\fB\-I\fR \fIinclude\fR] [\fB\-E\fR \fIexclude\fR] \fIPROGRAM\fR [\fIARGS\fR]...
12.br
13\fBzzuf \-h\fR | \fB\-\-help\fR
14.br
15\fBzzuf \-v\fR | \fB\-\-version\fR
16.SH DESCRIPTION
17.PP
18\fBZzuf\fR is a transparent application input fuzzer. It works by intercepting
19file operations and changing random bits in the program's input. \fBZzuf\fR's
20behaviour is deterministic, making it easy to reproduce bugs.
21.SH USAGE
22.PP
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
25relevant behaviour on the standard output, eg:
26.PP
27\fB    zzuf cat /dev/zero\fR
28.PP
29If you want to specify flags for your application, put a \(oq\fB\-\-\fR\(cq
30marker before them on the command line (otherwise \fBzzuf\fR will try to
31interpret them as arguments for itself), eg:
32.PP
33\fB    zzuf \-B 1000 cat \-\- \-v /dev/zero\fR
34.SH OPTIONS
35.TP
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.
40.TP
41\fB\-c\fR, \fB\-\-cmdline\fR
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:
44
45\fB    zzuf \-c cat file.txt\fR
46
47has the same effect as
48
49\fB    zzuf \-I \(aq^file\\.txt$\(aq cat file.txt\fR
50
51See the \fB\-I\fR flag for more information.
52.TP
53\fB\-d\fR, \fB\-\-debug\fR
54Activate the display of debug messages.
55.TP
56\fB\-E\fR, \fB\-\-exclude\fR=\fIregex\fR
57Do not fuzz files whose name matches the \fIregex\fR regular expression. This
58option supersedes anything that is specified by the \fB\-I\fR flag. Use this
59for instance if you are unsure of what files your application is going to read
60and do not want it to fuzz files in the \fB/etc\fR directory.
61
62Multiple \fB\-E\fR flags can be specified, in which case files matching any one
63of the regular expressions will be ignored.
64.TP
65\fB\-F\fR, \fB\-\-fork\fR=\fIchildren\fR
66Specify the number of simultaneous children that can be run. This option is
67only useful if the \fB\-s\fR flag is used with an interval argument.
68.TP
69\fB\-i\fR, \fB\-\-stdin\fR
70Fuzz the application's standard input. By default \fBzzuf\fR only fuzzes files.
71.TP
72\fB\-I\fR, \fB\-\-include\fR=\fIregex\fR
73Only fuzz files whose name matches the \fIregex\fR regular expression. Use
74this for instance if your application reads configuration files at startup
75and you only want specific files to be fuzzed.
76
77Multiple \fB\-I\fR flags can be specified, in which case files matching any one
78of the regular expressions will be fuzzed. See also the \fB\-c\fR flag.
79.TP
80\fB\-N\fR, \fB\-\-network\fR
81Fuzz the application's network input. By default \fBzzuf\fR only fuzzes files.
82.TP
83\fB\-P\fR, \fB\-\-protect\fR=\fIlist\fR
84Protect a list of characters so that if they appear in input data that would
85normally be fuzzed, they are left unmodified instead.
86
87Characters in \fIlist\fR can be expressed verbatim or through escape sequences.
88The sequences interpreted by \fBzzuf\fR are:
89.RS
90.TP
91\fB\\0\fR
92null byte
93.TP
94\fB\\n\fR
95new line
96.TP
97\fB\\r\fR
98return
99.TP
100\fB\\t\fR
101tabulation
102.TP
103\fB\\x\fR\fINN\fR
104the byte whose hexadecimal value is \fINN\fR
105.TP
106\fB\\\\\fR
107backslash (\(oq\\\(cq)
108.RE
109.IP
110You can use \(oq\fB-\fR\(cq to specify ranges. For instance, to protect all
111bytes from \(oq\fB\\x01\fR\(cq to \(oq \(cq, use
112\(oq\fB\-P\ \(aq\\x01-\ \(aq\fR\(cq.
113
114The statistical outcome of this option should not be overlooked. Because
115\fBzzuf\fR cannot know the nature of the input data beforehands and must
116fuzz it even if only one byte of data was received, protecting characters
117may change the meaning of the \fB\-r\fR flag depending on the data being
118fuzzed. For instance, asking to fuzz 1% of input bits (\fB\-r\ 0.01\fR)
119and to protect lowercase characters (\fB\-P\ a-z\fR) will result in
120an actual average fuzzing ratio of 0.9% with truly random data, 0.3% with
121random ASCII data and 0.2% with a standard English text.
122
123See also the \fB\-R\fR flag.
124.TP
125\fB\-q\fR, \fB\-\-quiet\fR
126Hide the output of the fuzzed application. This is useful if the application
127is very verbose but only its exit code or signaled status is really useful to
128you.
129.TP
130\fB\-r\fR, \fB\-\-ratio\fR=\fIratio\fR
131Specify the proportion of bits that will be randomly fuzzed. A value of 0
132will not fuzz anything. A value of 0.05 will fuzz 5% of the open files'
133bits. A value of 1.0 or more will fuzz all the bytes, theoretically making
134the input files undiscernible from random data. The default fuzzing ratio
135is 0.004 (fuzz 0.4% of the files' bits).
136.TP
137\fB\-R\fR, \fB\-\-refuse\fR=\fIlist\fR
138Refuse a list of characters by not fuzzing bytes that would otherwise be
139changed to a character that is in \fIlist\fR. If the original byte is already
140in \fIlist\fR, it is left unchanged.
141
142See the \fB\-P\fR option for a description of \fIlist\fR.
143.TP
144\fB\-s\fR, \fB\-\-seed\fR=\fIseed\fR
145.PD 0
146.TP
147\fB\-s\fR, \fB\-\-seed\fR=\fIstart:stop\fR
148.PD
149Specify the random seed to use for fuzzing, or an interval of random seeds.
150Running \fBzzuf\fR twice with the same random seed will fuzz the files exactly
151the same way, even with a different target application. The purpose of this is
152to use simple utilities such as \fBcat\fR or \fBcp\fR to generate a file that
153causes the target application to crash.
154
155If an interval is specified, \fBzzuf\fR will run the application several times,
156each time with a different seed, and report the behaviour of each run.
157.TP
158\fB\-S\fR, \fB\-\-signal\fR
159Prevent children from installing signal handlers for signals that usually
160cause coredumps. These signals are \fBSIGABRT\fR, \fBSIGFPE\fR, \fBSIGILL\fR,
161\fBSIGQUIT\fR, \fBSIGSEGV\fR, \fBSIGTRAP\fR and, if available on the running
162platform, \fBSIGSYS\fR, \fBSIGEMT\fR, \fBSIGBUS\fR, \fBSIGXCPU\fR and
163\fBSIGXFSZ\fR. Instead of calling the signal handler, the application will
164simply crash. If you do not want core dumps, you should set appropriate limits
165with the \fBlimit coredumpsize\fR command. See your shell's documentation on
166how to set such limits.
167.TP
168\fB\-T\fR, \fB\-\-max\-time\fR=\fIn\fR
169Automatically terminate child processes that run for more than \fIn\fR
170seconds. This is useful to detect infinite loops or processes stuck in other
171situations. See also the \fB\-B\fR flag.
172.TP
173\fB\-h\fR, \fB\-\-help\fR
174Display a short help message and exit.
175.TP
176\fB\-v\fR, \fB\-\-version\fR
177Output version information and exit.
178.SH EXAMPLES
179.PP
180Fuzz the input of the \fBcat\fR program using default settings:
181.PP
182\fB    zzuf cat /etc/motd\fR
183.PP
184Fuzz 1% of the input bits of the \fBcat\fR program using seed 94324:
185.PP
186\fB    zzuf -s 94324 -r 0.01 cat /etc/motd\fR
187.PP
188Fuzz the input of the \fBcat\fR program but do not fuzz the newline character
189and prevent non-ASCII characters from appearing in the output:
190.PP
191\fB    zzuf -P \(aq\\n\(aq -R \(aq\\0-\\x1f\\x7f-\\xff\(aq cat /etc/motd\fR
192.PP
193Fuzz the input of the \fBconvert\fR program, using file \fBfoo.jpeg\fR as the
194original input and excluding \fB.xml\fR files from fuzzing (because
195\fBconvert\fR will also open its own XML configuration files and we do not
196want \fBzzuf\fR to fuzz them):
197.PP
198\fB    zzuf -E \(aq\\.xml$\(aq convert -- foo.jpeg -format tga /dev/null\fR
199.PP
200Fuzz the input of \fBvlc\fR, using file \fBmovie.avi\fR as the original input
201and restricting fuzzing to filenames that appear on the command line
202(\fB\-c\fR), then generate \fBfuzzy-movie.avi\fR which is a file that
203can be read by \fBvlc\fR to reproduce the same behaviour without using
204\fBzzuf\fR:
205.PP
206\fB    zzuf -c -s 87423 -r 0.01 vlc movie.avi\fR
207\fB    zzuf -c -s 87423 -r 0.01 cp movie.avi fuzzy-movie.avi\fR
208\fB    vlc fuzzy-movie.avi\fR
209.PP
210Fuzz 2% of \fBmplayer\fR's input bits (\fB\-r\ 0.02\fR) with seeds 0 to 9999
211(\fB\-s\ 0:10000\fR), disabling its standard output messages (\fB\-q\fR),
212launching up to three simultaneous child processes (\fB\-F\ 3\fR), killing
213\fBmplayer\fR if it takes more than one minute to read the file (\fB\-T\ 60\fR)
214and disabling its \fBSIGSEGV\fR signal handler (\fB\-S\fR):
215.PP
216\fB    zzuf -c -q -s 0:10000 -F 3 -T 60 -r 0.02 \\\fR
217\fB      mplayer -- -benchmark -vo null -fps 1000 movie.avi\fR
218.SH BUGS
219.PP
220Due to \fBzzuf\fR using shared object preloading (\fBLD_PRELOAD\fR on most
221Unix systems, \fBDYLD_INSERT_LIBRARIES\fR on Mac OS X) to run its child
222processes, it will fail in the presence of any mechanism that disables
223preloading. For instance setuid root binaries will not be fuzzed when run
224as an unprivileged user. This limitation will probably not be addressed.
225.PP
226It is not yet possible to insert or drop bytes from the input, to fuzz
227according to the file format, or to do all these complicated operations. These
228features are planned.
229.PP
230Only the most common file operations are implemented: \fBopen\fR(),
231\fBread\fR(), \fBfopen\fR(), \fBfseek\fR(), etc. One important unimplemented
232function is \fBfscanf\fR(). These features will be implemented based on user
233request.
234.PP
235As of now, \fBzzuf\fR does not really support multithreaded applications. The
236behaviour with multithreaded applications where more than one thread does file
237descriptor operations is undefined. This bug will be fixed.
238.PP
239Though best efforts are made, the reproducibility of \fBzzuf\fR's behaviour
240is guaranteed for subsequent calls with the same settings on different
241operating systems, with different target programs, but not for calls with
242different versions of \fBzzuf\fR.
243.SH AUTHOR
244.PP
245Copyright \(co 2006, 2007 Sam Hocevar <sam@zoy.org>.
246.PP
247\fBZzuf\fR and this manual page are free software. They come without any
248warranty, to the extent permitted by applicable law. You can redistribute
249them and/or modify them under the terms of the Do What The Fuck You Want
250To Public License, Version 2, as published by Sam Hocevar. See
251\fBhttp://sam.zoy.org/wtfpl/COPYING\fR for more details.
252.PP
253\fBZzuf\fR's webpage can be found at \fBhttp://sam.zoy.org/zzuf/\fR.
Note: See TracBrowser for help on using the repository browser.