Add new fuzzer for robots.txt parsing

* fuzz/Makefile.am: Add wget_robots_fuzzer
* fuzz/wget_robots_fuzzer.c: New fuzzer
* fuzz/wget_robots_fuzzer.in: Initial corpora
This commit is contained in:
Tim Rühsen 2018-04-24 11:47:49 +02:00
parent 36482a21ea
commit 93e5a97f25
744 changed files with 3501 additions and 1 deletions

View File

@ -12,7 +12,8 @@ WGET_TESTS = \
wget_css_fuzzer$(EXEEXT) \
wget_ftpls_fuzzer$(EXEEXT) \
wget_html_fuzzer$(EXEEXT) \
wget_options_fuzzer$(EXEEXT)
wget_options_fuzzer$(EXEEXT) \
wget_robots_fuzzer$(EXEEXT)
if FUZZING
bin_PROGRAMS = $(WGET_TESTS)
@ -44,6 +45,9 @@ wget_html_fuzzer_LDADD = ../src/libunittest.a $(LDADD)
wget_options_fuzzer_SOURCES = wget_options_fuzzer.c $(MAIN)
wget_options_fuzzer_LDADD = ../src/libunittest.a $(LDADD)
wget_robots_fuzzer_SOURCES = wget_robots_fuzzer.c $(MAIN)
wget_robots_fuzzer_LDADD = ../src/libunittest.a $(LDADD)
#EXTRA_DIST = $(wildcard *.options) $(wildcard *.dict) \
# $(wildcard *.in) $(wildcard *.repro)

97
fuzz/wget_robots_fuzzer.c Normal file
View File

@ -0,0 +1,97 @@
/*
* Copyright(c) 2017-2018 Free Software Foundation, Inc.
*
* This file is part of GNU Wget.
*
* GNU Wget is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* GNU Wget is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Wget. If not, see <https://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <sys/types.h>
#include <dirent.h> // opendir, readdir
#include <stdint.h> // uint8_t
#include <stdio.h> // fmemopen
#include <string.h> // strncmp
#include <stdlib.h> // free
#include <fcntl.h> // open flags
#include <unistd.h> // close
#include <setjmp.h> // longjmp, setjmp
#include "wget.h"
#undef fopen_wgetrc
#ifdef __cplusplus
extern "C" {
#endif
#include "res.h"
// declarations for wget internal functions
int main_wget(int argc, const char **argv);
void cleanup(void);
FILE *fopen_wget(const char *pathname, const char *mode);
FILE *fopen_wgetrc(const char *pathname, const char *mode);
void exit_wget(int status);
#ifdef __cplusplus
}
#endif
#include "fuzzer.h"
FILE *fopen_wget(const char *pathname, const char *mode)
{
return fopen("/dev/null", mode);
}
FILE *fopen_wgetrc(const char *pathname, const char *mode)
{
return NULL;
}
#ifdef FUZZING
void exit_wget(int status)
{
}
#else
void exit(int status)
{
}
#endif
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
FILE *fp, *bak;
struct robot_specs *specs;
if (size > 4096) // same as max_len = ... in .options file
return 0;
bak = stderr;
stderr = fopen("/dev/null", "w");
specs = res_parse((char *) data, (int) size);
if (!specs)
return 0;
res_match_path(specs, "a%ff%a");
res_register_specs("host", 80, specs);
res_cleanup();
fclose(stderr);
stderr = bak;
return 0;
}

View File

@ -0,0 +1 @@
GGGG

View File

@ -0,0 +1,77 @@
User-Agent:*
DisaDil'oser-Agent:*
DisaDil'ownt:*
DisaDil'ow: *
Disallow: %1D(ÿÿÿÿÿÿÿÿent:*
DisaDil'ow: *
Disallow: %1D(x-Agten:*
1111ZKnnnnenV: *
Disallow: %1D(ÿÿÿÿÿÿÿÿent:*
DisaDiser-Agent:*
DisaDil'ownt:*
DÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿisaDil'ow: *
Disallow: %1D(ÿÿÿÿÿÿÿÿent:*
DisaDil'ow: *
Disallow: %1D(x-Agten:*
1111ZKnnnnenV: *
Disallow: %1D(ÿÿÿÿÿÿÿÿent:*
DisaDil'ow: *
Disallow: %1D(x-Agten:*
1111ZKnnnnenVVVVV'VVl'ow: *
Disallow: %1D(x-Agten:*
1111ZKnnwnt:*
DisaDil'ow: *
Disallow: %0D(ÿÿÿÿÿÿÿÿent:*
DisaDil'ow: *
Disallow: %1D(x-Agten:*
1111ZKnnnnenV: *
Disallow: %1D(ÿÿÿÿÿÿÿÿent:*
DisaDiser-Agent:*
DisaDil'ownt:*
DisaDil'ow: *
Disallow: %1D(ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿent:*
DisaDil'ow: *
Disallow: %1D(x-Agten:*
1111ZKnnnnenV: *
Disallow: %1D(ÿÿÿÿÿÿÿÿent:*
DisaDil'owUser-Agent:*
DisaDil'oser-Agent:*
DisaDil'ownt:*
DisaDil'ow: *
Disallow: %1D(ÿÿÿÿÿÿÿÿent:*
DisaDil'ow: *
Disallow: %1D(x-Agten:*
1111ZKnnnnenV: *
Disallow: %1D(ÿÿÿÿÿÿÿÿent:*
DisaDisÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿisaDil'ow: *
Disallow: %1D(ÿÿÿÿÿÿÿÿent:*
DisaDil'ow: *
Disallow: %1D(x-Agten:*
1111ZKnnnnenV: *
Disallow: %1D(ÿÿÿÿÿÿÿÿent:*
DisaDil'ow: *
Disallow: %1D(x-Agten:*
1111ZKnnnnenVVVVV'VVl'ow: *
Disallow: %1D(x-Agten:*
1111ZKnnwnGt:*
DisaDil'ow: *
Disallow: %0D(ÿÿÿÿÿÿÿÿent:*
DisaDil'ow: *
Disallow: %1D(x-Agten:*
1111ZKnnnnenV: *
Disallow: %1D(ÿÿÿÿÿÿÿÿent:*
DDiisaser-Agent:*
DisaDil'ownt:*
DisaDil'ow: *
Disallow: %1D(ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿent:*
DisaDil'ow: *
Disallow: %1D(x-Agten:*
1111ZKnnnnenV: *
Disallow: %1D(ÿÿÿÿÿÿÿÿent:*
DisaDil'ow: *
Disallow: %1D(x-Agten:*
1111ZKnnnnenVVVVV'VVl'ow: *
Disallow: %1D(x-Agtenÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ: *
Disallow: %1D(x-Agten:*
1111ZKnnnnenVVVVV'VVl'ow: *
Disallow: %1D(x-AgtenÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿVVVV

View File

@ -0,0 +1 @@
dddd

View File

@ -0,0 +1 @@
jKjKKK

View File

@ -0,0 +1,2 @@
User-Agent:
User-Agent:

View File

@ -0,0 +1,134 @@
I:::::44
I88
'
'

View File

@ -0,0 +1 @@
Lct-St0cL

View File

@ -0,0 +1 @@
44444444

View File

@ -0,0 +1,2 @@
User-Agent: *
Disallow:ap: .gz

View File

@ -0,0 +1 @@
LLLL2LLLL

View File

@ -0,0 +1 @@
LNz66666666

View File

@ -0,0 +1 @@
TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT9P

View File

@ -0,0 +1,18 @@
リ゙
サササ

View File

@ -0,0 +1 @@
GGGGGGGGGGGGGGGG

View File

@ -0,0 +1 @@
NStSttSttcl3a

View File

@ -0,0 +1 @@
444444444444444444444444444o44444444444444444444444444444444444444444444444444444444oo444444444444444444444444444444444444444444444444oo

View File

@ -0,0 +1 @@
JhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhKKKJ

View File

@ -0,0 +1 @@
8888

View File

@ -0,0 +1,131 @@
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:p:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitema:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:
Sitemap:p

View File

@ -0,0 +1 @@
TTTT

View File

@ -0,0 +1,2 @@
6llllmlmlm
llmll

View File

@ -0,0 +1 @@
CCCCCCCCCCCCCCCC

View File

@ -0,0 +1 @@
JSSOOOOOOOOOOjOOOOOOOO

View File

@ -0,0 +1 @@
---<2D>

View File

@ -0,0 +1,2 @@
User-Agent: *
Disallow: %1D(-AÿllowVV

View File

@ -0,0 +1 @@
H333-333s334ニ

View File

@ -0,0 +1 @@
JJ11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111O111111111111111111111111110

View File

@ -0,0 +1 @@
JKKKKKKKKKKKKKKKKJ

View File

@ -0,0 +1 @@
:<3A>

View File

@ -0,0 +1 @@
UUUU

View File

@ -0,0 +1,266 @@
User-Agent: *
Dn|
Disallow: /x
Disallow:*
Dn
Disallow: /x
Disallow: /x
Disallow:*
Dr-Agent: *
Dn|
Disallow: /x
Disallow:*
Dn
Disallow: /x
Disallow: /x
Disallow:*
Dn
DisalloDn
Disallow: /x
Di3allow: Sge*
Dn
Disallow: /x
Disallow:i<>ž““<E2809C>ˆÅß/x
Disallow: w: *
Dn
Disallow: /x
Dixallowsallow: /:
Disallow:*
Dn
Disallow: /x
Eisallow: w: *
Dn
DIsallow: /x
Di2allow: Sge*
Disn
Disallon
Disallow: /x
Disallow: w: *ŠDn
Diw: /xllow: /x
Disallow:*
Dn
Disallow: /x
Disallow: x
Di /x
Eisallow: w: *
Dn
Disallow: /x
Di3allow: Sge*
Dn
Disallow: /x
Disallow: /x
Disallow: Si gz
Disn
Disallon
Disallow: /x
Disallow
Disallow:*
Dn
Disallow: /x
Eisallow: w: *
Dn
Disallow: /x
Di3allow: Sge*
Dn
Disallow: /x
Disallow: /x
Disallow: Si gz
Disn
DisaQllon
Di<EFBFBD>Å<EFBFBD>ˆßž““/x
Disallow: w: *
Dn
Disallow: /x
Disallowsallow: /:
Disallow:*
Dn
Disallow: /x
Eisallow: w: *
Dn
Disallow: /x
Di3allow: Sge*
Dn
Disallow: /x
Disallow: /x
Disallisallon
Di3allow: Sge*
Dn
Disallow: /x
Disallow: /x
Disallow: Si gz
Disn
Disallon
Di<EFBFBD>ž““<EFBFBD>ˆÅß/x
Disallow: w: *
Dn
Disallow: /x
Disallowsallow: /:
Disallow:*
Dn
Disallow: /x
Eisallow: w2 *
Dn
Disallow: /x
Di6allow: Sge*
Disn
Disallon
Disallow: /x
Di
Disallow: /x
Di3allow: Sge*
Dn
Disallow: /x
Disallow: /x
Disallow: Si gz
Disn
Disallon
Disallow: /x
DisaSi gz
Disn
Disallon
Disallow: /x
Disa)llow
Disallow:*
Dn
Disallow: /x
Eisallow: w: *
Dn
Disaisallowallowsallow: /:
Disallow:*
Dn
Disallow: /x
Eisallow: w: *
Dn
Disallow: /x
Di6allow: Sge*
Dn
Disallow: /x
Disallow: /x
Disallow: Si gz
Disn
Disallon
Disallow: /x
Disallow
Disallow:*
Dn
Disallow: /x
Eisallow: w: *
Dn
Disallow: /x
Di3allow: Sge*
Dn
Disallow: /x
Disallow: /x
Disallow: Si gz
Disn
Disallon
Disallow: /x
Disallow: w: *
Dn
Disallow: /x
Disallow: Sge*
Dn
Divallow: /x
Disallow: !/x
Dksallow: Si gz
Di*
Dn
Disallow: /x
Disallow: /x
Dksallow: Si gz
Disalls:ll: /x
Disallowsallow: /:
Disallow:*
Dn
Disallow: /x
Eisallow: w: *
Dn
Disallowùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùù: /x
Di6allow: Sge*
Dn
Disallow: /x
Disallow: /x
Disallow: Si gz
Disn
Disallon
Disallow: /x
Disallow
Disallow:*
Dn
Disallow: /x
Eisallow: w: *
Dn
Disallow: /x
Di3allow: Sge*
Dn
Disallow: /x
Disallow: /x
Disallowisallow: Sge*
Dn
Divallow: /x
Disallow: /x
Dksallow: Si gz
Di*
Dn
Disallow: /x
Disallow: /x
Dksallow: Si gz
Disalls:llow: w: *
Dn
Disa”ow: /x
Di3allow: Sge*
Dn
Disallow: /x
Disallow: /x
Disallow: Si gz
Disn
Disallon
Disallow: /x
Disallow: w: *
Dn
Disallow: /x
Disallow: Sge*
Dn
Disallow: /x
Disallow: /x
Dksallow: Si gz
Di*
Dn
Disallow: /x
Disallow: /x
Dksallow: Si gz
Disallow:gz

View File

@ -0,0 +1 @@
sssssssssssssssss

View File

@ -0,0 +1 @@
CCCCCCCCCHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHCC<EFBFBD>

View File

@ -0,0 +1,145 @@
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
Usegent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Ageeâ<65>§n:t:*
Uset:*
User-Agent:
User-Agent:
User-Agr-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
U<EFBFBD>§n:t:*
Uset:*
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agentʵ:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
ent:
User-Agent:
Useser-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-AgentUser-Agent:
User-Agent:
User-Agent:
ent:
User-Agent:
User-Agent:
User-Agentʵ:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-gent:
User-Agent:
User-Agent:
User-Agent:
User-Agenr-Agent:
User-Agentʵ:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:
User-Agent:*
Us

View File

@ -0,0 +1 @@
JKKKKFKKKKKKKKKKwKKKkKKKKKKKKKKKzKkKKKJ

View File

@ -0,0 +1,2 @@
kkkkskkkkkkkkkk
qkkk試

View File

@ -0,0 +1,3 @@
8:И
WzИ
EW

View File

@ -0,0 +1 @@
0000000000000000F

View File

@ -0,0 +1 @@
FFFF<EFBFBD>

View File

@ -0,0 +1 @@
XXXX<EFBFBD>R

View File

@ -0,0 +1 @@
9999999999999998xxxxx!<21><>:

View File

@ -0,0 +1 @@
oN1111

View File

@ -0,0 +1,2 @@
VC
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaR

Some files were not shown because too many files have changed in this diff Show More