1 | .TH zzuf 1 "2006-12-22" "zzuf" |
---|
2 | .SH NAME |
---|
3 | zzuf \- multiple purpose fuzzer |
---|
4 | .SH SYNOPSIS |
---|
5 | \fBzzuf\fR [\fB\-cdiMnqS\fR] [\fB\-r\fR \fIratio\fR] [\fB\-s\fR \fIseed\fR | \fB\-s\fR \fIstart:stop\fR] |
---|
6 | .br |
---|
7 | [\fB\-F\fR \fIforks\fR] [\fB\-C\fR \fIcrashes\fR] [\fB\-B\fR \fIbytes\fR] [\fB\-T\fR \fIseconds\fR] |
---|
8 | .br |
---|
9 | [\fB\-P\fR \fIprotect\fR] [\fB\-R\fR \fIrefuse\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 |
---|
19 | file 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. |
---|
21 | .SH USAGE |
---|
22 | .PP |
---|
23 | \fBZzuf\fR will run an application specified on its command line, one or |
---|
24 | several times, with optional arguments, and will report the application's |
---|
25 | relevant behaviour on the standard output, eg: |
---|
26 | .PP |
---|
27 | \fB zzuf cat /dev/zero\fR |
---|
28 | .PP |
---|
29 | If you want to specify flags for your application, put a \(oq\fB\-\-\fR\(cq |
---|
30 | marker before them on the command line (otherwise \fBzzuf\fR will try to |
---|
31 | interpret them as arguments for itself), eg: |
---|
32 | .PP |
---|
33 | \fB zzuf \-B 1000 cat \-\- \-v /dev/zero\fR |
---|
34 | .PP |
---|
35 | When no program is specified, \fBzzuf\fR simply fuzzes the standard input, as |
---|
36 | if the \fBcat\fR utility had been called: |
---|
37 | .PP |
---|
38 | \fB zzuf < /dev/zero\fR |
---|
39 | .SH OPTIONS |
---|
40 | .TP |
---|
41 | \fB\-B\fR, \fB\-\-max\-bytes\fR=\fIn\fR |
---|
42 | Automatically terminate child processes that output more than \fIn\fR bytes |
---|
43 | on the standard output and standard error channels. This is useful to detect |
---|
44 | infinite loops. See also the \fB\-T\fR flag. |
---|
45 | .TP |
---|
46 | \fB\-c\fR, \fB\-\-cmdline\fR |
---|
47 | Only fuzz files whose name is specified in the target application's command |
---|
48 | line. This is mostly a shortcut to avoid specifiying twice the argument: |
---|
49 | |
---|
50 | \fB zzuf \-c cat file.txt\fR |
---|
51 | |
---|
52 | has the same effect as |
---|
53 | |
---|
54 | \fB zzuf \-I \(aq^file\\.txt$\(aq cat file.txt\fR |
---|
55 | |
---|
56 | See the \fB\-I\fR flag for more information on restricting fuzzing to |
---|
57 | specific files. |
---|
58 | .TP |
---|
59 | \fB\-C\fR, \fB\-\-max\-crashes\fR=\fIn\fR |
---|
60 | Stop forking when at least \fIn\fR children have crashed. The default value |
---|
61 | is 1, meaning \fBzzuf\fR will stop as soon as one child has crashed. A process |
---|
62 | is considered to have crashed if any signal (such as, but not limited to, |
---|
63 | \fBSIGSEGV\fR) caused it to exit. |
---|
64 | |
---|
65 | This option is only relevant if the \fB\-s\fR flag is used with an interval |
---|
66 | argument. |
---|
67 | .TP |
---|
68 | \fB\-d\fR, \fB\-\-debug\fR |
---|
69 | Activate the display of debug messages. |
---|
70 | .TP |
---|
71 | \fB\-E\fR, \fB\-\-exclude\fR=\fIregex\fR |
---|
72 | Do not fuzz files whose name matches the \fIregex\fR regular expression. This |
---|
73 | option supersedes anything that is specified by the \fB\-I\fR flag. Use this |
---|
74 | for instance if you are unsure of what files your application is going to read |
---|
75 | and do not want it to fuzz files in the \fB/etc\fR directory. |
---|
76 | |
---|
77 | Multiple \fB\-E\fR flags can be specified, in which case files matching any one |
---|
78 | of the regular expressions will be ignored. |
---|
79 | .TP |
---|
80 | \fB\-F\fR, \fB\-\-max\-forks\fR=\fIforks\fR |
---|
81 | Specify the number of simultaneous children that can be run. |
---|
82 | |
---|
83 | This option is only relevant if the \fB\-s\fR flag is used with an interval |
---|
84 | argument. |
---|
85 | .TP |
---|
86 | \fB\-i\fR, \fB\-\-stdin\fR |
---|
87 | Fuzz the application's standard input. By default \fBzzuf\fR only fuzzes files. |
---|
88 | .TP |
---|
89 | \fB\-I\fR, \fB\-\-include\fR=\fIregex\fR |
---|
90 | Only fuzz files whose name matches the \fIregex\fR regular expression. Use |
---|
91 | this for instance if your application reads configuration files at startup |
---|
92 | and you only want specific files to be fuzzed. |
---|
93 | |
---|
94 | Multiple \fB\-I\fR flags can be specified, in which case files matching any one |
---|
95 | of the regular expressions will be fuzzed. See also the \fB\-c\fR flag. |
---|
96 | .TP |
---|
97 | \fB\-M\fR, \fB\-\-md5\fR |
---|
98 | Instead of displaying the program's output, just print the MD5 digest of that |
---|
99 | output. |
---|
100 | .TP |
---|
101 | \fB\-n\fR, \fB\-\-network\fR |
---|
102 | Fuzz the application's network input. By default \fBzzuf\fR only fuzzes files. |
---|
103 | .TP |
---|
104 | \fB\-P\fR, \fB\-\-protect\fR=\fIlist\fR |
---|
105 | Protect a list of characters so that if they appear in input data that would |
---|
106 | normally be fuzzed, they are left unmodified instead. |
---|
107 | |
---|
108 | Characters in \fIlist\fR can be expressed verbatim or through escape sequences. |
---|
109 | The sequences interpreted by \fBzzuf\fR are: |
---|
110 | .RS |
---|
111 | .TP |
---|
112 | \fB\\n\fR |
---|
113 | new line |
---|
114 | .TP |
---|
115 | \fB\\r\fR |
---|
116 | return |
---|
117 | .TP |
---|
118 | \fB\\t\fR |
---|
119 | tabulation |
---|
120 | .TP |
---|
121 | \fB\\\fR\fINNN\fR |
---|
122 | the byte whose octal value is \fINNN\fR |
---|
123 | .TP |
---|
124 | \fB\\x\fR\fINN\fR |
---|
125 | the byte whose hexadecimal value is \fINN\fR |
---|
126 | .TP |
---|
127 | \fB\\\\\fR |
---|
128 | backslash (\(oq\\\(cq) |
---|
129 | .RE |
---|
130 | .IP |
---|
131 | You can use \(oq\fB\-\fR\(cq to specify ranges. For instance, to protect all |
---|
132 | bytes from \(oq\\001\(cq to \(oq/\(cq, use \(oq\fB\-P\ \(dq\\001\-/\(dq\fR\(cq. |
---|
133 | |
---|
134 | The statistical outcome of this option should not be overlooked: if characters |
---|
135 | are protected, the effect of the \(oq\fB\-r\fR\(cq flag will vary depending |
---|
136 | on the data being fuzzed. For instance, asking to fuzz 1% of input bits |
---|
137 | (\fB\-r\ 0.01\fR) and to protect lowercase characters (\fB\-P\ a\-z\fR) will |
---|
138 | result in an actual average fuzzing ratio of 0.9% with truly random data, |
---|
139 | 0.3% with random ASCII data and 0.2% with standard English text. |
---|
140 | |
---|
141 | See also the \fB\-R\fR flag. |
---|
142 | .TP |
---|
143 | \fB\-q\fR, \fB\-\-quiet\fR |
---|
144 | Hide the output of the fuzzed application. This is useful if the application |
---|
145 | is very verbose but only its exit code or signaled status is really useful to |
---|
146 | you. |
---|
147 | .TP |
---|
148 | \fB\-r\fR, \fB\-\-ratio\fR=\fIratio\fR |
---|
149 | Specify the proportion of bits that will be randomly fuzzed. A value of 0 |
---|
150 | will not fuzz anything. A value of 0.05 will fuzz 5% of the open files' |
---|
151 | bits. A value of 1.0 or more will fuzz all the bytes, theoretically making |
---|
152 | the input files undiscernible from random data. The default fuzzing ratio |
---|
153 | is 0.004 (fuzz 0.4% of the files' bits). |
---|
154 | .TP |
---|
155 | \fB\-R\fR, \fB\-\-refuse\fR=\fIlist\fR |
---|
156 | Refuse a list of characters by not fuzzing bytes that would otherwise be |
---|
157 | changed to a character that is in \fIlist\fR. If the original byte is already |
---|
158 | in \fIlist\fR, it is left unchanged. |
---|
159 | |
---|
160 | See the \fB\-P\fR option for a description of \fIlist\fR. |
---|
161 | .TP |
---|
162 | \fB\-s\fR, \fB\-\-seed\fR=\fIseed\fR |
---|
163 | .PD 0 |
---|
164 | .TP |
---|
165 | \fB\-s\fR, \fB\-\-seed\fR=\fIstart:stop\fR |
---|
166 | .PD |
---|
167 | Specify the random seed to use for fuzzing, or an interval of random seeds. |
---|
168 | Running \fBzzuf\fR twice with the same random seed will fuzz the files exactly |
---|
169 | the same way, even with a different target application. The purpose of this is |
---|
170 | to use simple utilities such as \fBcat\fR or \fBcp\fR to generate a file that |
---|
171 | causes the target application to crash. |
---|
172 | |
---|
173 | If an interval is specified, \fBzzuf\fR will run the application several times, |
---|
174 | each time with a different seed, and report the behaviour of each run. |
---|
175 | .TP |
---|
176 | \fB\-S\fR, \fB\-\-signal\fR |
---|
177 | Prevent children from installing signal handlers for signals that usually |
---|
178 | cause coredumps. These signals are \fBSIGABRT\fR, \fBSIGFPE\fR, \fBSIGILL\fR, |
---|
179 | \fBSIGQUIT\fR, \fBSIGSEGV\fR, \fBSIGTRAP\fR and, if available on the running |
---|
180 | platform, \fBSIGSYS\fR, \fBSIGEMT\fR, \fBSIGBUS\fR, \fBSIGXCPU\fR and |
---|
181 | \fBSIGXFSZ\fR. Instead of calling the signal handler, the application will |
---|
182 | simply crash. If you do not want core dumps, you should set appropriate limits |
---|
183 | with the \fBlimit coredumpsize\fR command. See your shell's documentation on |
---|
184 | how to set such limits. |
---|
185 | .TP |
---|
186 | \fB\-T\fR, \fB\-\-max\-time\fR=\fIn\fR |
---|
187 | Automatically terminate child processes that run for more than \fIn\fR |
---|
188 | seconds. This is useful to detect infinite loops or processes stuck in other |
---|
189 | situations. See also the \fB\-B\fR flag. |
---|
190 | .TP |
---|
191 | \fB\-h\fR, \fB\-\-help\fR |
---|
192 | Display a short help message and exit. |
---|
193 | .TP |
---|
194 | \fB\-v\fR, \fB\-\-version\fR |
---|
195 | Output version information and exit. |
---|
196 | .SH EXAMPLES |
---|
197 | .PP |
---|
198 | Fuzz the input of the \fBcat\fR program using default settings: |
---|
199 | .PP |
---|
200 | \fB zzuf cat /etc/motd\fR |
---|
201 | .PP |
---|
202 | Fuzz 1% of the input bits of the \fBcat\fR program using seed 94324: |
---|
203 | .PP |
---|
204 | \fB zzuf \-s 94324 \-r 0.01 cat /etc/motd\fR |
---|
205 | .PP |
---|
206 | Fuzz the input of the \fBcat\fR program but do not fuzz newline characters |
---|
207 | and prevent non-ASCII characters from appearing in the output: |
---|
208 | .PP |
---|
209 | \fB zzuf \-P \(aq\\n\(aq \-R \(aq\\x00\-\\x1f\\x7f\-\\xff\(aq cat /etc/motd\fR |
---|
210 | .PP |
---|
211 | Fuzz the input of the \fBconvert\fR program, using file \fBfoo.jpeg\fR as the |
---|
212 | original input and excluding \fB.xml\fR files from fuzzing (because |
---|
213 | \fBconvert\fR will also open its own XML configuration files and we do not |
---|
214 | want \fBzzuf\fR to fuzz them): |
---|
215 | .PP |
---|
216 | \fB zzuf \-E \(aq\\.xml$\(aq convert \-\- foo.jpeg \-format tga /dev/null\fR |
---|
217 | .PP |
---|
218 | Fuzz the input of \fBVLC\fR, using file \fBmovie.avi\fR as the original input |
---|
219 | and restricting fuzzing to filenames that appear on the command line |
---|
220 | (\fB\-c\fR), then generate \fBfuzzy\-movie.avi\fR which is a file that |
---|
221 | can be read by \fBVLC\fR to reproduce the same behaviour without using |
---|
222 | \fBzzuf\fR: |
---|
223 | .PP |
---|
224 | \fB zzuf \-c \-s 87423 \-r 0.01 vlc movie.avi\fR |
---|
225 | \fB zzuf \-c \-s 87423 \-r 0.01 cp movie.avi fuzzy\-movie.avi\fR |
---|
226 | \fB vlc fuzzy\-movie.avi\fR |
---|
227 | .PP |
---|
228 | Fuzz 2% of \fBMPlayer\fR's input bits (\fB\-r\ 0.02\fR) with seeds 0 to 9999 |
---|
229 | (\fB\-s\ 0:10000\fR), disabling its standard output messages (\fB\-q\fR), |
---|
230 | launching up to three simultaneous child processes (\fB\-F\ 3\fR), killing |
---|
231 | \fBMPlayer\fR if it takes more than one minute to read the file (\fB\-T\ 60\fR) |
---|
232 | and disabling its \fBSIGSEGV\fR signal handler (\fB\-S\fR): |
---|
233 | .PP |
---|
234 | \fB zzuf \-c \-r 0.02 \-q \-s 0:10000 \-F 3 \-T 60 \-S \\\fR |
---|
235 | \fB mplayer \-\- \-benchmark \-vo null \-fps 1000 movie.avi\fR |
---|
236 | .SH RESTRICTIONS |
---|
237 | .PP |
---|
238 | Due to \fBzzuf\fR using shared object preloading (\fBLD_PRELOAD\fR on most |
---|
239 | Unix systems, \fBDYLD_INSERT_LIBRARIES\fR on Mac OS X) to run its child |
---|
240 | processes, it will fail in the presence of any mechanism that disables |
---|
241 | preloading. For instance setuid root binaries will not be fuzzed when run |
---|
242 | as an unprivileged user. |
---|
243 | .PP |
---|
244 | For the same reasons, \fBzzuf\fR will also not work with statically linked |
---|
245 | binaries. Bear this in mind when using \fBzzuf\fR on the OpenBSD platform, |
---|
246 | where \fBcat\fR, \fBcp\fR and \fBdd\fR are static binaries. |
---|
247 | .PP |
---|
248 | Though best efforts are made, identical behaviour for different versions of |
---|
249 | \fBzzuf\fR is not guaranteed. The reproducibility for subsequent calls on |
---|
250 | different operating systems and with different target programs is only |
---|
251 | guaranteed when the same version of \fBzzuf\fR is being used. |
---|
252 | .SH BUGS |
---|
253 | .PP |
---|
254 | \fBZzuf\fR probably does not behave correctly with 64-bit offsets. |
---|
255 | .PP |
---|
256 | It is not yet possible to insert or drop bytes from the input, to fuzz |
---|
257 | according to the file format, to swap bytes, etc. More advanced fuzzing |
---|
258 | methods are planned. |
---|
259 | .PP |
---|
260 | As of now, \fBzzuf\fR does not really support multithreaded applications. The |
---|
261 | behaviour with multithreaded applications where more than one thread does file |
---|
262 | descriptor operations is undefined. |
---|
263 | .SH NOTES |
---|
264 | In order to intercept file and network operations and signal handlers, |
---|
265 | \fBzzuf\fR diverts and reimplements the following functions, which can |
---|
266 | be private libc symbols, too: |
---|
267 | .TP |
---|
268 | Unix file descriptor handling: |
---|
269 | \fBopen\fR(), \fBlseek\fR(), \fBread\fR(), \fBaccept\fR(), \fBsocket\fR(), |
---|
270 | \fBmmap\fR(), \fBmunmap\fR(), \fBclose\fR() |
---|
271 | .TP |
---|
272 | Standard IO streams: |
---|
273 | \fBfopen\fR(), \fBfreopen\fR(), \fBfseek\fR(), \fBfseeko\fR(), \fBrewind\fR(), |
---|
274 | \fBfread\fR(), \fBgetc\fR(), \fBfgetc\fR(), \fBfgets\fR(), \fBungetc\fR(), |
---|
275 | \fBfclose\fR() |
---|
276 | .TP |
---|
277 | Linux-specific: |
---|
278 | \fBopen64\fR(), \fBlseek64\fR(), \fBmmap64\fR(), \fB_IO_getc\fR(), |
---|
279 | \fBgetline\fR(), \fBgetdelim\fR(), \fB__getdelim\fR() |
---|
280 | .TP |
---|
281 | BSD-specific: |
---|
282 | \fBfgetln\fR(), \fB__srefill\fR() |
---|
283 | .TP |
---|
284 | Signal handling: |
---|
285 | \fBsignal\fR(), \fBsigaction\fR() |
---|
286 | .PP |
---|
287 | If an application manipulates file descriptors (reading data, seeking around) |
---|
288 | using functions that are not in that list, \fBzzuf\fR will not fuzz its |
---|
289 | input consistently and the results should not be trusted. You can use a tool |
---|
290 | such as \fBltrace(1)\fR on Linux to know the missing functions. |
---|
291 | .PP |
---|
292 | On BSD systems, such as FreeBSD or Mac OS X, \fB__srefill\fR() is enough to |
---|
293 | monitor all standard IO streams functions. On other systems, such as Linux, |
---|
294 | each function is reimplemented on a case by case basis. One important |
---|
295 | unimplemented function is \fBfscanf\fR(), because of its complexity. Missing |
---|
296 | functions will be added upon user request. |
---|
297 | .SH HISTORY |
---|
298 | .PP |
---|
299 | \fBZzuf\fR started its life in 2002 as the \fBstreamfucker\fR tool, a small |
---|
300 | multimedia stream corrupter used to find bugs in the \fBVLC\fR media player. |
---|
301 | .SH AUTHOR |
---|
302 | .PP |
---|
303 | Copyright \(co 2002, 2007 Sam Hocevar <sam@zoy.org>. |
---|
304 | .PP |
---|
305 | \fBZzuf\fR and this manual page are free software. They come without any |
---|
306 | warranty, to the extent permitted by applicable law. You can redistribute |
---|
307 | them and/or modify them under the terms of the Do What The Fuck You Want |
---|
308 | To Public License, Version 2, as published by Sam Hocevar. See |
---|
309 | \fBhttp://sam.zoy.org/wtfpl/COPYING\fR for more details. |
---|
310 | .PP |
---|
311 | \fBZzuf\fR's webpage can be found at \fBhttp://sam.zoy.org/zzuf/\fR. |
---|