Add NTLM fuzzer

* configure.ac: Create WITH_NTLM conditional.
* fuzz/Makefile.am: Add wget_ntlm_fuzzer.
* fuzz/wget_ntlm_fuzzer.c: New file.
* fuzz/wget_ntlm_fuzzer.in/*: Initial fuzz corpora.
This commit is contained in:
Tim Rühsen
2020-03-06 11:49:42 +01:00
parent 4221b5656a
commit 103aaf7740
129 changed files with 520 additions and 0 deletions

View File

@@ -990,6 +990,7 @@ AM_CONDITIONAL([IRI_IS_ENABLED], [test "X$iri" != "Xno"])
AM_CONDITIONAL([WITH_SSL], [test "X$with_ssl" != "Xno"])
AM_CONDITIONAL([METALINK_IS_ENABLED], [test "X$with_metalink" != "Xno"])
AM_CONDITIONAL([WITH_XATTR], [test "X$ENABLE_XATTR" != "Xno"])
AM_CONDITIONAL([WITH_NTLM], [test "X$ENABLE_NTLM" == "Xyes"])
dnl
dnl Create output

View File

@@ -21,6 +21,10 @@ WGET_TESTS = \
wget_robots_fuzzer$(EXEEXT) \
wget_url_fuzzer$(EXEEXT)
if WITH_NTLM
WGET_TESTS += wget_ntlm_fuzzer$(EXEEXT)
endif
if FUZZING
bin_PROGRAMS = $(WGET_TESTS)
LDADD += $(LIB_FUZZING_ENGINE)
@@ -54,6 +58,9 @@ wget_html_fuzzer_LDADD = ../src/libunittest.a $(LDADD)
wget_netrc_fuzzer_SOURCES = wget_netrc_fuzzer.c $(MAIN)
wget_netrc_fuzzer_LDADD = ../src/libunittest.a $(LDADD)
wget_ntlm_fuzzer_SOURCES = wget_ntlm_fuzzer.c $(MAIN)
wget_ntlm_fuzzer_LDADD = ../src/libunittest.a $(LDADD)
wget_options_fuzzer_SOURCES = wget_options_fuzzer.c $(MAIN)
wget_options_fuzzer_LDADD = ../src/libunittest.a $(LDADD)

102
fuzz/wget_ntlm_fuzzer.c Normal file
View File

@@ -0,0 +1,102 @@
/*
* Copyright (c) 2017-2019 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 <assert.h> // assert
#include "wget.h"
#undef fopen_wgetrc
#ifdef __cplusplus
extern "C" {
#endif
#include "http-ntlm.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)
{
(void) pathname;
return fopen("/dev/null", mode);
}
FILE *fopen_wgetrc(const char *pathname, const char *mode)
{
(void) pathname;
(void) mode;
return NULL;
}
#ifdef FUZZING
void exit_wget(int status)
{
(void) status;
}
#endif
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
if (size > 128) // same as max_len = ... in .options file
return 0;
// CLOSE_STDERR
struct ntlmdata *ntlm = calloc(1, sizeof(struct ntlmdata));
char *data0 = malloc(size + 4 + 1);
char *val;
bool ready;
assert(ntlm && data0);
memcpy(data0, "NTLM", 4);
memcpy(data0 + 4, data, size);
data0[size + 4] = 0;
if (ntlm_input(ntlm, data0))
free(ntlm_output(ntlm, data0 + 4, data0 + 4, &ready));
free(data0);
free(ntlm);
// RESTORE_STDERR
return 0;
}

View File

@@ -0,0 +1,6 @@
666

View File

@@ -0,0 +1 @@
KKKKKKKKKKKKKKXNNNNNNNNNNNNNNNNNNNNNNNNNKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK

View File

@@ -0,0 +1 @@
QQQQQMQQ

View File

@@ -0,0 +1 @@
AA(

View File

@@ -0,0 +1 @@
CC==CC==CC==CC==CC==CA==CC==CC==CC==CC==CC==CC==L1==+8==L1==L1==CC==CC==CC==CC==CC==CC==CC==CC==CC==CC==CC==CC==L1==+8==L1==L1==

View File

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

View File

@@ -0,0 +1,7 @@


View File

@@ -0,0 +1 @@
0112bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb

View File

@@ -0,0 +1 @@
oUQUQo4444444444444444444444444444444444444444444444444444444444444444444o

View File

@@ -0,0 +1 @@
EE

View File

@@ -0,0 +1 @@
z1=

View File

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

View File

@@ -0,0 +1 @@
02

View File

@@ -0,0 +1 @@
o0ooo0aaooooooooooooooooooooooo

View File

@@ -0,0 +1 @@
Vzz0

View File

@@ -0,0 +1 @@
R88R

View File

@@ -0,0 +1 @@
CeGa/eG

View File

@@ -0,0 +1 @@
eddddddddddddddddfffddddddddddddddddddddddddddddddddddddddddddddjej

View File

@@ -0,0 +1 @@
E/0

View File

@@ -0,0 +1 @@
C=

View File

@@ -0,0 +1 @@
77k

View File

@@ -0,0 +1 @@
/0ooooooooX

View File

@@ -0,0 +1 @@
o5mmmQWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWQmmQQU

View File

@@ -0,0 +1 @@
/L1=gL/=1L1=gL/=/L1=gL/=1L1=gL/=/L1=gL/=1L1=gL/=/L1=gL/=1L1=gL/=

View File

@@ -0,0 +1,3 @@
k1=

View File

@@ -0,0 +1 @@
oUQUQo444444444444455QUQQe444444444444444444444444444444444444444444

View File

@@ -0,0 +1 @@
+GGGGGGGGAGeeeeGGGGGGAGeeeeGGGGGGGGGGGGGeeeeeeeeeeeeeeeeeeehhhhz

View File

@@ -0,0 +1 @@
aCa=

View File

@@ -0,0 +1 @@
AAv=zAv=zAA=GAv=zAv=zAv=zAA=GAv=

View File

@@ -0,0 +1 @@
KKKKKKKKKKKKKKK1KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKAAAAAKKKKKKKKKKKKKK2KKKK

View File

@@ -0,0 +1 @@
kGE

View File

@@ -0,0 +1 @@
AAv=zjA=

View File

@@ -0,0 +1,25 @@
337d

View File

@@ -0,0 +1 @@
JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJCJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJCJJJJJJJJJ

View File

@@ -0,0 +1 @@
wwohoh+AQAQqoW+qoWohAQqoW+oAQA

View File

@@ -0,0 +1,12 @@
l/=

View File

@@ -0,0 +1 @@
+L=

View File

@@ -0,0 +1 @@
CC==CC==CC==CC==CC==CC==CC==CC==CC==CC==CC==CC==CC==CC==CC==CC==CC==CC==CC==CC==CC==CC==CC==CC==CC==CC==CC==CC==CC==CC==CC==CC

View File

@@ -0,0 +1 @@
00=

View File

@@ -0,0 +1,10 @@
+0hh

View File

@@ -0,0 +1 @@
/L1=gL/=1L1=gL/=/L1=gL/=1L1=gL/=/L1=gL/=1L1=/L1=gL/=1L1=gL/=/L1=gL/=1L1=gL/=/L1=gL/=1L1=gL/=/L1=gL/=1L1=gL/=gL/=/L1=gL/=1L1=gL/=

View File

@@ -0,0 +1 @@
oQPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPUQQUoUoo

View File

@@ -0,0 +1,16 @@
J

View File

@@ -0,0 +1 @@
z1

View File

@@ -0,0 +1,5 @@
Q Qaa

View File

@@ -0,0 +1 @@
zz

View File

@@ -0,0 +1 @@
kkkk

View File

@@ -0,0 +1 @@
AAv=zAv=zAA=zAv=

View File

@@ -0,0 +1 @@
o0ooo0aaoooooooooooooooooQUQQooo

View File

@@ -0,0 +1 @@
r000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

View File

@@ -0,0 +1,8 @@
aa

View File

@@ -0,0 +1 @@
oUQUQoohhhihUzUUUUZZZZZoUQUQoohhhhhhhZZZZZZVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVZUQ

View File

@@ -0,0 +1,13 @@

View File

@@ -0,0 +1,8 @@
eR=

View File

@@ -0,0 +1 @@
W/oo

View File

@@ -0,0 +1,17 @@
a

View File

@@ -0,0 +1 @@
2zzzzz

View File

@@ -0,0 +1,8 @@
QQaa

View File

@@ -0,0 +1,2 @@


View File

@@ -0,0 +1 @@
oUQUQoohhhhhhhh

View File

@@ -0,0 +1 @@
mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm2mmmmm2mmm

View File

@@ -0,0 +1 @@
VzVV

View File

@@ -0,0 +1 @@
0+=0

View File

@@ -0,0 +1 @@
ohhohhoo

View File

@@ -0,0 +1 @@
CC==CC==CC==CC==CC==CC==CC==CC==CC==CC==CC==CC==L1==+8==L1==L1==

View File

@@ -0,0 +1 @@
CC==CC==CC==CC==CC==CC==CC==CC==

View File

@@ -0,0 +1 @@
oUQUQo44444444644444444444444444444Z4444444444444444444444UQo444444444444444444444444444464444o

View File

@@ -0,0 +1 @@
CC==

View File

@@ -0,0 +1 @@
o555QUQQoUoo

View File

@@ -0,0 +1 @@
bbbbbbbbbbbbbbbbbbbbbbbbbMMMMMMMMMMMMMMMMMMMMbbbbbbbbbubbbbbbbbbbb

View File

@@ -0,0 +1,9 @@
aa

View File

@@ -0,0 +1,3 @@
ww7A

View File

@@ -0,0 +1 @@
L1==L1==+1==vP=

View File

@@ -0,0 +1,2 @@
A

View File

@@ -0,0 +1,112 @@

View File

@@ -0,0 +1 @@
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAjP6

View File

@@ -0,0 +1,2 @@
kk1

View File

@@ -0,0 +1,2 @@


View File

@@ -0,0 +1 @@
7,

View File

@@ -0,0 +1,4 @@
62

View File

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

View File

@@ -0,0 +1 @@
2R77

View File

@@ -0,0 +1 @@
zv=

View File

@@ -0,0 +1,2 @@
00+

View File

@@ -0,0 +1,2 @@
r00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000A

View File

@@ -0,0 +1 @@
+/8R

View File

@@ -0,0 +1,5 @@


View File

@@ -0,0 +1,3 @@
A

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