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