| 1 | .TH zzuf 1 "2006-12-22" "zzuf" |
|---|
| 2 | .SH NAME |
|---|
| 3 | zzuf \- multiple purpose fuzzer |
|---|
| 4 | .SH SYNOPSIS |
|---|
| 5 | \fBzzuf\fR [\fB\-AcdimnqSvx\fR] [\fB\-s\fR \fIseed\fR|\fB\-s\fR \fIstart:stop\fR] [\fB\-r\fR \fIratio\fR|\fB\-r\fR \fImin:max\fR] |
|---|
| 6 | .br |
|---|
| 7 | [\fB\-f\fR \fIfuzzing\fR] [\fB\-D\fR \fIdelay\fR] [\fB\-F\fR \fIforks\fR] [\fB\-C\fR \fIcrashes\fR] [\fB\-B\fR \fIbytes\fR] |
|---|
| 8 | .br |
|---|
| 9 | [\fB\-t\fR \fIseconds\fR] [\fB\-T\fR \fIseconds\fR] [\fB\-M\fR \fImegabytes\fR] [\fB\-b\fR \fIranges\fR] [\fB\-p\fR \fIports\fR] |
|---|
| 10 | .br |
|---|
| 11 | [\fB\-P\fR \fIprotect\fR] [\fB\-R\fR \fIrefuse\fR] [\fB\-l\fR \fIlist\fR] [\fB\-I\fR \fIinclude\fR] [\fB\-E\fR \fIexclude\fR] |
|---|
| 12 | .br |
|---|
| 13 | [\fIPROGRAM\fR [\fIARGS\fR]...] |
|---|
| 14 | .br |
|---|
| 15 | \fBzzuf \-h\fR | \fB\-\-help\fR |
|---|
| 16 | .br |
|---|
| 17 | \fBzzuf \-V\fR | \fB\-\-version\fR |
|---|
| 18 | .SH DESCRIPTION |
|---|
| 19 | .PP |
|---|
| 20 | \fBzzuf\fR is a transparent application input fuzzer. It works by intercepting |
|---|
| 21 | file and network operations and changing random bits in the program's input. |
|---|
| 22 | \fBzzuf\fR's behaviour is deterministic, making it easy to reproduce bugs. |
|---|
| 23 | .SH USAGE |
|---|
| 24 | .PP |
|---|
| 25 | \fBzzuf\fR will run an application specified on its command line, one or |
|---|
| 26 | several times, with optional arguments, and will report the application's |
|---|
| 27 | relevant behaviour on the standard error channel, eg: |
|---|
| 28 | .PP |
|---|
| 29 | \fB zzuf cat /dev/zero\fR |
|---|
| 30 | .PP |
|---|
| 31 | Flags found after the application name are considered arguments for the |
|---|
| 32 | application, not for \fBzzuf\fR. For instance, \fB\-v\fR below is an |
|---|
| 33 | argument for \fBcat\fR: |
|---|
| 34 | .PP |
|---|
| 35 | \fB zzuf \-B 1000 cat \-v /dev/zero\fR |
|---|
| 36 | .PP |
|---|
| 37 | When no program is specified, \fBzzuf\fR simply fuzzes the standard input, as |
|---|
| 38 | if the \fBcat\fR utility had been called: |
|---|
| 39 | .PP |
|---|
| 40 | \fB zzuf < /dev/zero\fR |
|---|
| 41 | .SH OPTIONS |
|---|
| 42 | .TP |
|---|
| 43 | \fB\-A\fR, \fB\-\-autoinc\fR |
|---|
| 44 | Increment random seed each time a new file is opened. This is only required |
|---|
| 45 | if one instance of the application is expected to open the same file several |
|---|
| 46 | times and you want to test a different seed each time. |
|---|
| 47 | .TP |
|---|
| 48 | \fB\-b\fR, \fB\-\-bytes\fR=\fIranges\fR |
|---|
| 49 | Restrict fuzzing to bytes whose offsets in the file are within \fIranges\fR. |
|---|
| 50 | |
|---|
| 51 | Range values start at zero and are inclusive. Use dashes between range values |
|---|
| 52 | and commas between ranges. If the right-hand part of a range is ommited, it |
|---|
| 53 | means end of file. For instance, to restrict fuzzing to bytes 0, 3, 4, 5 and |
|---|
| 54 | all bytes after offset 31, use \(oq\fB\-r0,3\-5,31\-\fR\(cq. |
|---|
| 55 | |
|---|
| 56 | This option is useful to preserve file headers or corrupt only a specific |
|---|
| 57 | portion of a file. |
|---|
| 58 | .TP |
|---|
| 59 | \fB\-B\fR, \fB\-\-max\-bytes\fR=\fIn\fR |
|---|
| 60 | Automatically terminate child processes that output more than \fIn\fR bytes |
|---|
| 61 | on the standard output and standard error channels. This is useful to detect |
|---|
| 62 | infinite loops. See also the \fB\-t\fR and \fB\-T\fR flags. |
|---|
| 63 | .TP |
|---|
| 64 | \fB\-c\fR, \fB\-\-cmdline\fR |
|---|
| 65 | Only fuzz files whose name is specified in the target application's command |
|---|
| 66 | line. This is mostly a shortcut to avoid specifying twice the argument: |
|---|
| 67 | |
|---|
| 68 | \fB zzuf \-c cat file.txt\fR |
|---|
| 69 | |
|---|
| 70 | has the same effect as |
|---|
| 71 | |
|---|
| 72 | \fB zzuf \-I \(aq^file\\.txt$\(aq cat file.txt\fR |
|---|
| 73 | |
|---|
| 74 | See the \fB\-I\fR flag for more information on restricting fuzzing to |
|---|
| 75 | specific files. |
|---|
| 76 | .TP |
|---|
| 77 | \fB\-C\fR, \fB\-\-max\-crashes\fR=\fIn\fR |
|---|
| 78 | Stop forking when at least \fIn\fR children have crashed. The default value |
|---|
| 79 | is 1, meaning \fBzzuf\fR will stop as soon as one child has crashed. A process |
|---|
| 80 | is considered to have crashed if any signal (such as, but not limited to, |
|---|
| 81 | \fBSIGSEGV\fR) caused it to exit. If the \fB\-x\fR flag is used, this will |
|---|
| 82 | also include processes that exit with a non-zero status. |
|---|
| 83 | |
|---|
| 84 | This option is only relevant if the \fB\-s\fR flag is used with a range |
|---|
| 85 | argument. |
|---|
| 86 | .TP |
|---|
| 87 | \fB\-d\fR, \fB\-\-debug\fR |
|---|
| 88 | Activate the display of debug messages. |
|---|
| 89 | .TP |
|---|
| 90 | \fB\-D\fR, \fB\-\-delay\fR=\fIdelay\fR |
|---|
| 91 | Do not launch more than one process every \fIdelay\fR seconds. This option |
|---|
| 92 | should be used together with \fB\-F\fR to avoid fork bombs. |
|---|
| 93 | .TP |
|---|
| 94 | \fB\-E\fR, \fB\-\-exclude\fR=\fIregex\fR |
|---|
| 95 | Do not fuzz files whose name matches the \fIregex\fR regular expression. This |
|---|
| 96 | option supersedes anything that is specified by the \fB\-I\fR flag. Use this |
|---|
| 97 | for instance if you are unsure of what files your application is going to read |
|---|
| 98 | and do not want it to fuzz files in the \fB/etc\fR directory. |
|---|
| 99 | |
|---|
| 100 | Multiple \fB\-E\fR flags can be specified, in which case files matching any one |
|---|
| 101 | of the regular expressions will be ignored. |
|---|
| 102 | .TP |
|---|
| 103 | \fB\-f\fR, \fB\-\-fuzzing\fR=\fImode\fR |
|---|
| 104 | Select how the input is fuzzed. Valid values for \fImode\fR are: |
|---|
| 105 | .RS |
|---|
| 106 | .TP |
|---|
| 107 | \fBxor\fR |
|---|
| 108 | randomly set and unset bits |
|---|
| 109 | .TP |
|---|
| 110 | \fBset\fR |
|---|
| 111 | only set bits |
|---|
| 112 | .TP |
|---|
| 113 | \fBunset\fR |
|---|
| 114 | only unset bits |
|---|
| 115 | .RE |
|---|
| 116 | .IP |
|---|
| 117 | The default value for \fImode\fR is \fBxor\fR. |
|---|
| 118 | .TP |
|---|
| 119 | \fB\-F\fR, \fB\-\-max\-forks\fR=\fIforks\fR |
|---|
| 120 | Specify the number of simultaneous children that can be run. By default, |
|---|
| 121 | \fBzzuf\fR only launches one process at a time. |
|---|
| 122 | |
|---|
| 123 | This option is only relevant if the \fB\-s\fR flag is used with a range |
|---|
| 124 | argument. See also the \fB\-D\fR flag. |
|---|
| 125 | .TP |
|---|
| 126 | \fB\-i\fR, \fB\-\-stdin\fR |
|---|
| 127 | Fuzz the application's standard input. By default \fBzzuf\fR only fuzzes files. |
|---|
| 128 | .TP |
|---|
| 129 | \fB\-I\fR, \fB\-\-include\fR=\fIregex\fR |
|---|
| 130 | Only fuzz files whose name matches the \fIregex\fR regular expression. Use |
|---|
| 131 | this for instance if your application reads configuration files at startup |
|---|
| 132 | and you only want specific files to be fuzzed. |
|---|
| 133 | |
|---|
| 134 | Multiple \fB\-I\fR flags can be specified, in which case files matching any one |
|---|
| 135 | of the regular expressions will be fuzzed. See also the \fB\-c\fR flag. |
|---|
| 136 | .TP |
|---|
| 137 | \fB\-l\fR, \fB\-\-list\fR=\fIlist\fR |
|---|
| 138 | Cherry-pick the list of file descriptors that get fuzzed. The Nth descriptor |
|---|
| 139 | will really be fuzzed only if N is in \fIlist\fR. |
|---|
| 140 | |
|---|
| 141 | Values start at 1 and ranges are inclusive. Use dashes between values and |
|---|
| 142 | commas between ranges. If the right-hand part of a range is ommited, it means |
|---|
| 143 | all subsequent file descriptors. For instance, to restrict fuzzing to the |
|---|
| 144 | first opened descriptor and all descriptors starting from the 10th, use |
|---|
| 145 | \(oq\fB\-l1,10\-\fR\(cq. |
|---|
| 146 | |
|---|
| 147 | Note that this option only affects file descriptors that would otherwise be |
|---|
| 148 | fuzzed. Even if 10 write-only descriptors are opened at the beginning of the |
|---|
| 149 | program, only the next descriptor with a read flag will be the first one |
|---|
| 150 | considered by the \fB\-l\fR flag. |
|---|
| 151 | .TP |
|---|
| 152 | \fB\-m\fR, \fB\-\-md5\fR |
|---|
| 153 | Instead of displaying the program's \fIstandard output\fR, just print its MD5 |
|---|
| 154 | digest to \fBzzuf\fR's standard output. The standard error channel is left |
|---|
| 155 | untouched. |
|---|
| 156 | .TP |
|---|
| 157 | \fB\-M\fR, \fB\-\-max\-memory\fR=\fImegabytes\fR |
|---|
| 158 | Specify the maximum amount of memory, in megabytes, that children are allowed |
|---|
| 159 | to allocate. This is useful to detect infinite loops that eat up a lot of |
|---|
| 160 | memory. The value should set reasonably high so as not to interfer with normal |
|---|
| 161 | program operation. |
|---|
| 162 | |
|---|
| 163 | \fBzzuf\fR uses the \fBsetrlimit\fR() call to set memory usage limitations and |
|---|
| 164 | relies on the operating system's ability to enforce such limitations. |
|---|
| 165 | .TP |
|---|
| 166 | \fB\-n\fR, \fB\-\-network\fR |
|---|
| 167 | Fuzz the application's network input. By default \fBzzuf\fR only fuzzes files. |
|---|
| 168 | |
|---|
| 169 | Only INET (IPv4) and INET6 (IPv6) connections are fuzzed. Other protocol |
|---|
| 170 | families are not yet supported. |
|---|
| 171 | .TP |
|---|
| 172 | \fB\-p\fR, \fB\-\-ports\fR=\fIranges\fR |
|---|
| 173 | Only fuzz network ports that are in \fIranges\fR. By default \fBzzuf\fR |
|---|
| 174 | fuzzes all ports. The port considered is the listening port if the socket |
|---|
| 175 | is listening and the destination port if the socket is connecting, because |
|---|
| 176 | most of the time the source port cannot be predicted. |
|---|
| 177 | |
|---|
| 178 | Range values start at zero and are inclusive. Use dashes between range values |
|---|
| 179 | and commas between ranges. If the right-hand part of a range is ommited, it |
|---|
| 180 | means end of file. For instance, to restrict fuzzing to the HTTP and HTTPS |
|---|
| 181 | ports and to all unprivileged ports, use \(oq\fB\-p80,443,1024\-\fR\(cq. |
|---|
| 182 | |
|---|
| 183 | This option requires network fuzzing to be activated using \fB\-n\fR. |
|---|
| 184 | .TP |
|---|
| 185 | \fB\-P\fR, \fB\-\-protect\fR=\fIlist\fR |
|---|
| 186 | Protect a list of characters so that if they appear in input data that would |
|---|
| 187 | normally be fuzzed, they are left unmodified instead. |
|---|
| 188 | |
|---|
| 189 | Characters in \fIlist\fR can be expressed verbatim or through escape sequences. |
|---|
| 190 | The sequences interpreted by \fBzzuf\fR are: |
|---|
| 191 | .RS |
|---|
| 192 | .TP |
|---|
| 193 | \fB\\n\fR |
|---|
| 194 | new line |
|---|
| 195 | .TP |
|---|
| 196 | \fB\\r\fR |
|---|
| 197 | return |
|---|
| 198 | .TP |
|---|
| 199 | \fB\\t\fR |
|---|
| 200 | tabulation |
|---|
| 201 | .TP |
|---|
| 202 | \fB\\\fR\fINNN\fR |
|---|
| 203 | the byte whose octal value is \fINNN\fR |
|---|
| 204 | .TP |
|---|
| 205 | \fB\\x\fR\fINN\fR |
|---|
| 206 | the byte whose hexadecimal value is \fINN\fR |
|---|
| 207 | .TP |
|---|
| 208 | \fB\\\\\fR |
|---|
| 209 | backslash (\(oq\\\(cq) |
|---|
| 210 | .RE |
|---|
| 211 | .IP |
|---|
| 212 | You can use \(oq\fB\-\fR\(cq to specify ranges. For instance, to protect all |
|---|
| 213 | bytes from \(oq\\001\(cq to \(oq/\(cq, use \(oq\fB\-P\ \(aq\\001\-/\(aq\fR\(cq. |
|---|
| 214 | |
|---|
| 215 | The statistical outcome of this option should not be overlooked: if characters |
|---|
| 216 | are protected, the effect of the \(oq\fB\-r\fR\(cq flag will vary depending |
|---|
| 217 | on the data being fuzzed. For instance, asking to fuzz 1% of input bits |
|---|
| 218 | (\fB\-r0.01\fR) and to protect lowercase characters (\fB\-P\ a\-z\fR) will |
|---|
| 219 | result in an actual average fuzzing ratio of 0.9% with truly random data, |
|---|
| 220 | 0.3% with random ASCII data and 0.2% with standard English text. |
|---|
| 221 | |
|---|
| 222 | See also the \fB\-R\fR flag. |
|---|
| 223 | .TP |
|---|
| 224 | \fB\-q\fR, \fB\-\-quiet\fR |
|---|
| 225 | Hide the output of the fuzzed application. This is useful if the application |
|---|
| 226 | is very verbose but only its exit code or signaled status is really useful to |
|---|
| 227 | you. |
|---|
| 228 | .TP |
|---|
| 229 | \fB\-r\fR, \fB\-\-ratio\fR=\fIratio\fR |
|---|
| 230 | .PD 0 |
|---|
| 231 | .TP |
|---|
| 232 | \fB\-r\fR, \fB\-\-ratio\fR=\fImin:max\fR |
|---|
| 233 | .PD |
|---|
| 234 | Specify the proportion of bits that will be randomly fuzzed. A value of 0 |
|---|
| 235 | will not fuzz anything. A value of 0.05 will fuzz 5% of the open files' |
|---|
| 236 | bits. A value of 1.0 or more will fuzz all the bytes, theoretically making |
|---|
| 237 | the input files undiscernible from random data. The default fuzzing ratio |
|---|
| 238 | is 0.004 (fuzz 0.4% of the files' bits). |
|---|
| 239 | |
|---|
| 240 | A range can also be specified. When doing so, \fBzzuf\fR will pick ratio |
|---|
| 241 | values from the interval. The choice is deterministic and only depends on |
|---|
| 242 | the interval bounds and the current seed. |
|---|
| 243 | .TP |
|---|
| 244 | \fB\-R\fR, \fB\-\-refuse\fR=\fIlist\fR |
|---|
| 245 | Refuse a list of characters by not fuzzing bytes that would otherwise be |
|---|
| 246 | changed to a character that is in \fIlist\fR. This does not prevent characters |
|---|
| 247 | from appearing in the output if the original byte was already in \fIlist\fR. |
|---|
| 248 | |
|---|
| 249 | See the \fB\-P\fR option for a description of \fIlist\fR. |
|---|
| 250 | .TP |
|---|
| 251 | \fB\-s\fR, \fB\-\-seed\fR=\fIseed\fR |
|---|
| 252 | .PD 0 |
|---|
| 253 | .TP |
|---|
| 254 | \fB\-s\fR, \fB\-\-seed\fR=\fIstart:stop\fR |
|---|
| 255 | .PD |
|---|
| 256 | Specify the random seed to use for fuzzing, or a range of random seeds. |
|---|
| 257 | Running \fBzzuf\fR twice with the same random seed will fuzz the files exactly |
|---|
| 258 | the same way, even with a different target application. The purpose of this is |
|---|
| 259 | to use simple utilities such as \fBcat\fR or \fBcp\fR to generate a file that |
|---|
| 260 | causes the target application to crash. |
|---|
| 261 | |
|---|
| 262 | If a range is specified, \fBzzuf\fR will run the application several times, |
|---|
| 263 | each time with a different seed, and report the behaviour of each run. |
|---|
| 264 | .TP |
|---|
| 265 | \fB\-S\fR, \fB\-\-signal\fR |
|---|
| 266 | Prevent children from installing signal handlers for signals that usually |
|---|
| 267 | cause coredumps. These signals are \fBSIGABRT\fR, \fBSIGFPE\fR, \fBSIGILL\fR, |
|---|
| 268 | \fBSIGQUIT\fR, \fBSIGSEGV\fR, \fBSIGTRAP\fR and, if available on the running |
|---|
| 269 | platform, \fBSIGSYS\fR, \fBSIGEMT\fR, \fBSIGBUS\fR, \fBSIGXCPU\fR and |
|---|
| 270 | \fBSIGXFSZ\fR. Instead of calling the signal handler, the application will |
|---|
| 271 | simply crash. If you do not want core dumps, you should set appropriate limits |
|---|
| 272 | with the \fBlimit coredumpsize\fR command. See your shell's documentation on |
|---|
| 273 | how to set such limits. |
|---|
| 274 | .TP |
|---|
| 275 | \fB\-t\fR, \fB\-\-max\-time\fR=\fIn\fR |
|---|
| 276 | Automatically terminate child processes that run for more than \fIn\fR |
|---|
| 277 | seconds. This is useful to detect infinite loops or processes stuck in other |
|---|
| 278 | situations. See also the \fB\-B\fR and \fB\-T\fR flags. |
|---|
| 279 | .TP |
|---|
| 280 | \fB\-T\fR, \fB\-\-max\-cpu\fR=\fIn\fR |
|---|
| 281 | Automatically terminate child processes that use more than \fIn\fR seconds |
|---|
| 282 | of CPU time. |
|---|
| 283 | |
|---|
| 284 | \fBzzuf\fR uses the \fBsetrlimit\fR() call to set CPU usage limitations and |
|---|
| 285 | relies on the operating system's ability to enforce such limitations. If the |
|---|
| 286 | system sends \fBSIGXCPU\fR signals and the application catches that signal, |
|---|
| 287 | it will receive a \fBSIGKILL\fR signal after 5 seconds. |
|---|
| 288 | |
|---|
| 289 | This is more accurate than \fB\-t\fR because the behaviour should be |
|---|
| 290 | independent from the system load, but it does not detect processes stuck into |
|---|
| 291 | infinite \fBselect\fR() calls because they use very little CPU time. See also |
|---|
| 292 | the \fB\-B\fR and \fB\-t\fR flags. |
|---|
| 293 | .TP |
|---|
| 294 | \fB\-v\fR, \fB\-\-verbose\fR |
|---|
| 295 | Print information during the run, such as the current seed, what processes |
|---|
| 296 | get run, their exit status, etc. |
|---|
| 297 | .TP |
|---|
| 298 | \fB\-x\fR, \fB\-\-check\-exit\fR |
|---|
| 299 | Report processes that exit with a non-zero status. By default only processes |
|---|
| 300 | that crash due to a signal are reported. |
|---|
| 301 | .TP |
|---|
| 302 | \fB\-h\fR, \fB\-\-help\fR |
|---|
| 303 | Display a short help message and exit. |
|---|
| 304 | .TP |
|---|
| 305 | \fB\-V\fR, \fB\-\-version\fR |
|---|
| 306 | Output version information and exit. |
|---|
| 307 | .SH DIAGNOSTICS |
|---|
| 308 | .PP |
|---|
| 309 | Exit status is zero if no child process crashed. If one or several children |
|---|
| 310 | crashed, \fBzzuf\fR exits with status 1. |
|---|
| 311 | .SH EXAMPLES |
|---|
| 312 | .PP |
|---|
| 313 | Fuzz the input of the \fBcat\fR program using default settings: |
|---|
| 314 | .PP |
|---|
| 315 | \fB zzuf cat /etc/motd\fR |
|---|
| 316 | .PP |
|---|
| 317 | Fuzz 1% of the input bits of the \fBcat\fR program using seed 94324: |
|---|
| 318 | .PP |
|---|
| 319 | \fB zzuf \-s94324 \-r0.01 cat /etc/motd\fR |
|---|
| 320 | .PP |
|---|
| 321 | Fuzz the input of the \fBcat\fR program but do not fuzz newline characters |
|---|
| 322 | and prevent non-ASCII characters from appearing in the output: |
|---|
| 323 | .PP |
|---|
| 324 | \fB zzuf \-P \(aq\\n\(aq \-R \(aq\\x00\-\\x1f\\x7f\-\\xff\(aq cat /etc/motd\fR |
|---|
| 325 | .PP |
|---|
| 326 | Fuzz the input of the \fBconvert\fR program, using file \fBfoo.jpeg\fR as the |
|---|
| 327 | original input and excluding \fB.xml\fR files from fuzzing (because |
|---|
| 328 | \fBconvert\fR will also open its own XML configuration files and we do not |
|---|
| 329 | want \fBzzuf\fR to fuzz them): |
|---|
| 330 | .PP |
|---|
| 331 | \fB zzuf \-E \(aq\\.xml$\(aq convert foo.jpeg \-format tga /dev/null\fR |
|---|
| 332 | .PP |
|---|
| 333 | Fuzz the input of VLC, using file \fBmovie.avi\fR as the original input |
|---|
| 334 | and restricting fuzzing to filenames that appear on the command line |
|---|
| 335 | (\fB\-c\fR), then generate \fBfuzzy\-movie.avi\fR which is a file that |
|---|
| 336 | can be read by VLC to reproduce the same behaviour without using |
|---|
| 337 | \fBzzuf\fR: |
|---|
| 338 | .PP |
|---|
| 339 | \fB zzuf \-c \-s87423 \-r0.01 vlc movie.avi\fR |
|---|
| 340 | .br |
|---|
| 341 | \fB zzuf \-c \-s87423 \-r0.01 <movie.avi >fuzzy\-movie.avi\fR |
|---|
| 342 | .br |
|---|
| 343 | \fB vlc fuzzy\-movie.avi\fR |
|---|
| 344 | .PP |
|---|
| 345 | Fuzz between 0.1% and 2% of MPlayer's input bits (\fB\-r0.001:0.02\fR) |
|---|
| 346 | with seeds 0 to 9999 (\fB\-s0:10000\fR), preserving the AVI 4-byte header |
|---|
| 347 | by restricting fuzzing to offsets after 4 (\fB\-b4\-\fR), disabling its |
|---|
| 348 | standard output messages (\fB\-q\fR), launching up to five simultaneous child |
|---|
| 349 | processes (\fB\-F5\fR) but waiting at least half a second between launches |
|---|
| 350 | (\fB\-D0.5\fR), killing MPlayer if it takes more than one minute to |
|---|
| 351 | read the file (\fB\-T60\fR) and disabling its \fBSIGSEGV\fR signal handler |
|---|
| 352 | (\fB\-S\fR): |
|---|
| 353 | .PP |
|---|
| 354 | \fB zzuf \-c \-r0.001:0.02 \-s0:10000 \-b4\- \-q \-F5 \-D0.5 \-T60 \-S \\\fR |
|---|
| 355 | .br |
|---|
| 356 | \fB mplayer \-benchmark \-vo null \-fps 1000 movie.avi\fR |
|---|
| 357 | .PP |
|---|
| 358 | Create an HTML-like file that loads 200 times the same \fBhello.jpg\fR image |
|---|
| 359 | and open it in Firefox\(tm in auto-increment mode (\fB\-A\fR): |
|---|
| 360 | .PP |
|---|
| 361 | \fB seq \-f \(aq<img src="hello.jpg#%g">\(aq 1 200 > hello.html\fR |
|---|
| 362 | .br |
|---|
| 363 | (or: \fBjot \-w \(aq<img src="hello.jpg#%d">\(aq 200 1 > hello.html\fR) |
|---|
| 364 | .br |
|---|
| 365 | \fB zzuf \-A \-I \(aqhello[.]jpg\(aq \-r0.001 firefox hello.html\fR |
|---|
| 366 | .PP |
|---|
| 367 | Run a simple HTTP redirector on the local host using \fBsocat\fR and |
|---|
| 368 | corrupt each network connection (\fB\-n\fR) in a different way (\fB\-A\fR) |
|---|
| 369 | after one megabyte of data was received on it (\fB\-b1000000\-\fR): |
|---|
| 370 | .PP |
|---|
| 371 | \fB zzuf \-n \-A \-b1000000\- \\\fR |
|---|
| 372 | \fB socat TCP4\-LISTEN:8080,reuseaddr,fork TCP4:192.168.1.42:80\fR |
|---|
| 373 | .PP |
|---|
| 374 | Browse the intarweb (\fB\-n\fR) using Firefox\(tm without fuzzing local files |
|---|
| 375 | (\fB\-E.\fR) or non-HTTP connections (\fB\-p80,8010,8080\fR), preserving |
|---|
| 376 | the beginning of the data sent with each HTTP response (\fB\-b4000\-\fR) |
|---|
| 377 | and using another seed on each connection (\fB\-A\fR): |
|---|
| 378 | .PP |
|---|
| 379 | \fB zzuf \-r 0.0001 \-n \-E. \-p80,8010,8080 \-b4000\- \-A firefox\fR |
|---|
| 380 | .SH RESTRICTIONS |
|---|
| 381 | .PP |
|---|
| 382 | Due to \fBzzuf\fR using shared object preloading (\fBLD_PRELOAD\fR, |
|---|
| 383 | \fB_RLD_LIST\fB, \fBDYLD_INSERT_LIBRARIES\fR, etc.) to run its child |
|---|
| 384 | processes, it will fail in the presence of any mechanism that disables |
|---|
| 385 | preloading. For instance setuid root binaries will not be fuzzed when run |
|---|
| 386 | as an unprivileged user. |
|---|
| 387 | .PP |
|---|
| 388 | For the same reasons, \fBzzuf\fR will also not work with statically linked |
|---|
| 389 | binaries. Bear this in mind when using \fBzzuf\fR on the OpenBSD platform, |
|---|
| 390 | where \fBcat\fR, \fBcp\fR and \fBdd\fR are static binaries. |
|---|
| 391 | .PP |
|---|
| 392 | Though best efforts are made, identical behaviour for different versions of |
|---|
| 393 | \fBzzuf\fR is not guaranteed. The reproducibility for subsequent calls on |
|---|
| 394 | different operating systems and with different target programs is only |
|---|
| 395 | guaranteed when the same version of \fBzzuf\fR is being used. |
|---|
| 396 | .SH BUGS |
|---|
| 397 | .PP |
|---|
| 398 | \fBzzuf\fR probably does not behave correctly with 64-bit offsets. |
|---|
| 399 | .PP |
|---|
| 400 | It is not yet possible to insert or drop bytes from the input, to fuzz |
|---|
| 401 | according to the file format, to swap bytes, etc. More advanced fuzzing |
|---|
| 402 | methods are planned. |
|---|
| 403 | .PP |
|---|
| 404 | As of now, \fBzzuf\fR does not really support multithreaded applications. The |
|---|
| 405 | behaviour with multithreaded applications where more than one thread does file |
|---|
| 406 | descriptor operations is undefined. |
|---|
| 407 | .SH NOTES |
|---|
| 408 | In order to intercept file and network operations, signal handlers and memory |
|---|
| 409 | allocations, \fBzzuf\fR diverts and reimplements the following functions, |
|---|
| 410 | which can be private libc symbols, too: |
|---|
| 411 | .TP |
|---|
| 412 | Unix file descriptor handling: |
|---|
| 413 | \fBopen\fR(), \fBdup\fR(), \fBdup2\fR(), \fBlseek\fR(), \fBread\fR(), |
|---|
| 414 | \fBreadv\fR(), \fBpread\fR(), \fBaccept\fR(), \fBsocket\fR(), \fBrecv\fR(), |
|---|
| 415 | \fBrecvfrom\fR(), \fBrecvmsg\fR(), \fBaio_read\fR(), \fBaio_return\fR(), |
|---|
| 416 | \fBclose\fR() |
|---|
| 417 | .TP |
|---|
| 418 | Standard IO streams: |
|---|
| 419 | \fBfopen\fR(), \fBfreopen\fR(), \fBfseek\fR(), \fBfseeko\fR(), \fBrewind\fR(), |
|---|
| 420 | \fBfread\fR(), \fBgetc\fR(), \fBfgetc\fR(), \fBfgets\fR(), \fBungetc\fR(), |
|---|
| 421 | \fBfclose\fR() |
|---|
| 422 | .TP |
|---|
| 423 | Memory management: |
|---|
| 424 | \fBmmap\fR(), \fBmunmap\fR(), \fBmalloc\fR(), \fBcalloc\fR(), \fBvalloc\fR(), |
|---|
| 425 | \fBfree\fR(), \fBmemalign\fR(), \fBposix_memalign\fR() |
|---|
| 426 | .TP |
|---|
| 427 | Linux-specific: |
|---|
| 428 | \fBopen64\fR(), \fBlseek64\fR(), \fBmmap64\fR(), \fB_IO_getc\fR(), |
|---|
| 429 | \fBgetline\fR(), \fBgetdelim\fR(), \fB__getdelim\fR() |
|---|
| 430 | .TP |
|---|
| 431 | BSD-specific: |
|---|
| 432 | \fBfgetln\fR(), \fB__srefill\fR() |
|---|
| 433 | .TP |
|---|
| 434 | Mac OS X-specific: |
|---|
| 435 | \fBmap_fd\fR() |
|---|
| 436 | .TP |
|---|
| 437 | Signal handling: |
|---|
| 438 | \fBsignal\fR(), \fBsigaction\fR() |
|---|
| 439 | .PP |
|---|
| 440 | If an application manipulates file descriptors (reading data, seeking around) |
|---|
| 441 | using functions that are not in that list, \fBzzuf\fR will not fuzz its |
|---|
| 442 | input consistently and the results should not be trusted. You can use a tool |
|---|
| 443 | such as \fBltrace(1)\fR on Linux to know the missing functions. |
|---|
| 444 | .PP |
|---|
| 445 | On BSD systems, such as FreeBSD or Mac OS X, \fB__srefill\fR() is enough to |
|---|
| 446 | monitor all standard IO streams functions. On other systems, such as Linux, |
|---|
| 447 | each function is reimplemented on a case by case basis. One important |
|---|
| 448 | unimplemented function is \fBfscanf\fR(), because of its complexity. Missing |
|---|
| 449 | functions will be added upon user request. |
|---|
| 450 | .SH HISTORY |
|---|
| 451 | .PP |
|---|
| 452 | \fBzzuf\fR started its life in 2002 as the \fBstreamfucker\fR tool, a small |
|---|
| 453 | multimedia stream corrupter used to find bugs in the VLC media player. |
|---|
| 454 | .SH AUTHOR |
|---|
| 455 | .PP |
|---|
| 456 | Copyright \(co 2002, 2007\-2008 Sam Hocevar <sam@zoy.org>. |
|---|
| 457 | .PP |
|---|
| 458 | \fBzzuf\fR and this manual page are free software. They come without any |
|---|
| 459 | warranty, to the extent permitted by applicable law. You can redistribute |
|---|
| 460 | them and/or modify them under the terms of the Do What The Fuck You Want |
|---|
| 461 | To Public License, Version 2, as published by Sam Hocevar. See |
|---|
| 462 | \fBhttp://sam.zoy.org/wtfpl/COPYING\fR for more details. |
|---|
| 463 | .PP |
|---|
| 464 | \fBzzuf\fR's webpage can be found at \fBhttp://libcaca.zoy.org/wiki/zzuf/\fR. |
|---|