1
0
mirror of https://github.com/mirror/wget.git synced 2025-04-08 18:40:35 +08:00

Add new fuzzer for the URL parser

* fuzz/Makefile.am: Add wget_url_fuzzer
* fuzz/wget_url_fuzzer.c: New fuzzer
* fuzz/wget_url_fuzzer.in: Initial corpora
This commit is contained in:
Tim Rühsen 2018-04-23 23:03:43 +02:00
parent 93e5a97f25
commit 02325168ca
775 changed files with 814 additions and 1 deletions
fuzz
Makefile.amwget_url_fuzzer.c
wget_url_fuzzer.in
0007f35fbd9c8a668200385cd444253cf5513a74000db03a09289f7e43fcf9e8d60a071d6b37dd19002cda5c8c41ed17e1c3ab8b08c620566333b6700061ff9cd456a7980237dbc850b1b6e82bd2ff4f0085fdcfca68801c387906f94ea0705828cb710600b435f46a4afeae9fd79d76a852b2882a72269601464e1616e3fdd5c60c0cc5516c1d1454cc41850180d95872d8d563942403fb3effaa3c6df01a1f018ec8cd93f9aecfab45589f60b5b8a2947c9d3701cc5a7ae113f4768c8ff8ad94c78a7c2858be4f020bb7113180843714099e856fe727f0ab6f7682024d5281adcec2ea5ccb70cd1ddeea8f0a8d11a202ca8ac70d909c58c8e16217b12a69c88207996e034705f29b1f193b816c18db114d54cea2bbdff203e541fd3e99bfccdee04f01735fa2502221f1ad03eb7aafb3817f76ff3ba3c27ecf4ee4d8acf0710478c8a8d319478a5e94baebf40f09765719dd5f04dd2c84c207fa90c38e873fd1d39397640761780519398297ffd485a5e30c733278636448867ce8056b15a9f300aa5c729dde85a329548adf7d7e04067caba2f838e79c15b5ae1cef877ab03598c89206869afe0313a900d9cb0d8b5a8f0ccd49e353530690fa6618f9830a2e0e867a4b6cf49962dc9eb006bc27b7c4efd1af5455a59646988b2b1b6e6244074c362cc1c6de455c2e5464a9a730e4c536445a0797d42e7e5d4bf8df658aa62c998b139b989c7a07b11e68ac790699893cd2acd739a2e8566b1efa085396c4365bc18f65940dfeb451caa9f2feea4b089c35e40f45844ff39c95d143d152dcc8b0852b08eccc823cd85901a2051245dc81f2a26f25caf60973d11ec5722a9b6741d0a8c33be95698bf0907098e8705a8e38c9479bad69af7c9e4464f0ec19c09b1190ba8100d159b3459457ce53dd1bc263a1409bc45534812a7c04b60ce19418f87f1a27245b709d0de9259b1f62f1f4ec73ae818bd0ad5f5d1260b07e41eebbc9c4ce27c6d8d96f0774956b442bc0b275e46961aa8e44cc90daf2e20c9025e0259b20b7e9c3807dc011f2d2cc5408497e8559d7e56270c041a2ee8f7a742e5bfeda6b120544756170aff0c18e1d9847e8042dd836d0a94372bbeda42ba570c6a5b3a6ba56b9d970ed1eace6bd9af11c271680cb0fd49fc625200f7f4c58efe8e48d5dfa6b2070d107025acf4277c8cca043175505fdc9426cd4d0d55bf7947a08021de7274137bc764b6c92b179f0de3fc64b821c39bc699e6fe6253b667cc71ad700e18e2093c18b84534298e1022ec53c28a1eb4af0e7a53615b948fa81d1cd9c6945f80edca75c3ee0eba343dd0e46ee7c81dc0bab0d9825d2132cf370f423a9338e3eda7b10677c4478a93cb37f9d9280fba1d3ae70fc2669e34eef3a2604143288303770fe808817d7ed52c1c1ddf774412db6b3dca5a9e0ffba4154340a09c207685e5657657fc6cef1e67102b9dcd4e869d794190c54fb3a4f9e1c425905310b0a4744a33c9f8fa9af39ceabc439eba0de90d11399d7342abc4cc38395f07123f94b7dd2c141611aa6e50736b9430f0996c3c550b9592bb5cd40f11b2e583b25f6e289b1335750f0407eca5d4b20b121be3b2822d7f69e01950e3c0961c1aeb6b829412bff6b6c8a63e54e8bfeec2376bbf382a0252cf13301931da9c45139dde376bdc405f9eee915bb81381e4610fa5d86d6210a049d14c99ed9c7f159414c435db096bd49ea6dfd8e155d3284c6d89b3ee14fa646c03c6f390e8641a3a3888c38cb4c478a115aaa09dc7f5a5161e5bf010b79fbea31158f96e15c4a47bc0d844093f177e304154a1cac538b41c164d9cdd6ea19be417caf6111d517c323299b81d165110327292f562214ccae6565a66c8466c833e16732f404445eff65fd2c7f7b4c2520337034621167e921d7357289bf302691e07e64f6bd35258501688bf601987765263c2eedb76edce660151aba1177be5d977e22f9721abd16d99364f5cd7ee23ee182da1d18565a978c87499701ea0a98c2f6d1f5a18866b9f74743b9b16cb73c9a12445c329f9e183189b96306a000eb75dd8f4d75dbfd85101112f8118a1bfd1ac0eb7a1814eb05bc431d0c0522b5d7218c17cbac6779f1f7224225b2331d132a07991181940f706d880bc1f114662e6e3252190378c162d19e696a558167899329bdcbdc10173fcdfe16c861a3eaf0d0049da9dc2f1330ceed48055c40034a01ad2410a15be5b4db4af77f9200170e99c63301a1c4f0c6eb8bf8bbf11cc2ae1cdcc5c5d1f3a3c161c6c0c5a85f70b6dcfc942a0269a81e05c397f971cf33ef9a4b53fb596aafaef69906b8419630e881d05e2db1cca32a7aeba01d4f84882a51422ad561d3e1253dd703b5601a8b4b0f0f34eda9fa58fc11e211cabceaf519da0cba6ed3919bf418d4d6df31e83b7dfd171ed9a9d5a1626c783ec57f149dcd51e8b5d855d861469e2cde15a7a64dc8e3ac96cd41ed6d4a0e183074479d98df64473b203d85fded61ee5ec44b18696d174a41a6cf7af9c2a75c6d1021fc1e02aed8f5b559a4baf790e03bfb0e5884b591feccc11fb153742ade85e47b59ccf5c8e378ee820ebdd925923f905246637b34bd3b69bfe1635d4214a8077cfb25fd1d8076a8378e0d8f0f350ae342175d673e185b694a300450dcadfad0d4ff7dda9218b010c14e9c2ac32cfaf09931e46dc29f28b06224622024135d1cfd7a726b94f91a3d168059f522268dbf1242217187c94fa077676c3c5ed2a13a1

View File

@ -13,7 +13,8 @@ WGET_TESTS = \
wget_ftpls_fuzzer$(EXEEXT) \
wget_html_fuzzer$(EXEEXT) \
wget_options_fuzzer$(EXEEXT) \
wget_robots_fuzzer$(EXEEXT)
wget_robots_fuzzer$(EXEEXT) \
wget_url_fuzzer$(EXEEXT)
if FUZZING
bin_PROGRAMS = $(WGET_TESTS)
@ -48,6 +49,9 @@ 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)
wget_url_fuzzer_SOURCES = wget_url_fuzzer.c $(MAIN)
wget_url_fuzzer_LDADD = ../src/libunittest.a $(LDADD)
#EXTRA_DIST = $(wildcard *.options) $(wildcard *.dict) \
# $(wildcard *.in) $(wildcard *.repro)

110
fuzz/wget_url_fuzzer.c Normal file
View File

@ -0,0 +1,110 @@
/*
* 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 <stdint.h> // uint8_t
#include <stdio.h> // fmemopen
#include <string.h> // strncmp
#include <stdlib.h> // free
#include <unistd.h> // close
#include "wget.h"
#undef fopen_wgetrc
#ifdef __cplusplus
extern "C" {
#endif
#include "url.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 *bak;
struct url *url;
struct iri iri;
char *in;
if (size > 4096) // same as max_len = ... in .options file
return 0;
bak = stderr;
stderr = fopen("/dev/null", "w");
in = (char *) malloc(size + 1);
memcpy(in, data, size);
in[size] = 0;
iri.uri_encoding = (char *) "iso-8859-1";
iri.orig_url = NULL;
iri.utf8_encode = 0;
url = url_parse(in, NULL, &iri, 0);
url_free(url);
url = url_parse(in, NULL, &iri, 1);
url_free(url);
iri.utf8_encode = 1;
url = url_parse(in, NULL, &iri, 0);
url_free(url);
url = url_parse(in, NULL, &iri, 1);
url_free(url);
free(iri.orig_url);
free(in);
fclose(stderr);
stderr = bak;
return 0;
}

View File

@ -0,0 +1 @@
httpS://ц<><D186><EFBFBD>

View File

@ -0,0 +1 @@
http://aXX

View File

@ -0,0 +1 @@
hxiyelNNFNNNNNCyelNNFº±NNNNN666

View File

@ -0,0 +1 @@
hWWWWWWWWWWW

View File

@ -0,0 +1 @@
Waliaトf

View File

@ -0,0 +1 @@
http://<2F>%<<<<<%<04>

View File

@ -0,0 +1 @@
dddd

View File

@ -0,0 +1 @@
http://a8b@x.yzÌ0/di&&&&&ir/f

View File

@ -0,0 +1 @@
httgtphtgh

View File

@ -0,0 +1 @@
http://a>://a:b@:b@x.y:2%%de««SS.%e§=°¹val'f¡

View File

@ -0,0 +1 @@
ccccccccc/di

View File

@ -0,0 +1 @@
http://iehl

View File

@ -0,0 +1,3 @@
http://http:/¯a:b@x.%%%%%%66%6%66666600000#f
r/3f
r/fval'f

View File

@ -0,0 +1 @@
ftp://[b::]p

View File

@ -0,0 +1 @@
LpJ

View File

@ -0,0 +1 @@
hI22222222222222222222222222222222

View File

@ -0,0 +1 @@
Hhe686>

View File

@ -0,0 +1 @@
hSt5ctypeIcESt5ctypIcE.yz#f

View File

@ -0,0 +1 @@
http://http://a:b@x.yz80/diÂ<69>ÂÂÂ<C382><C382><EFBFBD>%00000000000000000000000000000000...%%%%%%%%%%%%%%%%00000;00000000000000000val&keSSSl'f

View File

@ -0,0 +1 @@
RRf

View File

@ -0,0 +1 @@
http://aェェェttttttttttttttt%%%%%%%%nnnnnnnnnnnnnn

View File

@ -0,0 +1 @@
http://aX%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View File

@ -0,0 +1 @@
http://a:b@

View File

@ -0,0 +1 @@
iQ

View File

@ -0,0 +1 @@
http://<<<<<<<<<<<k

View File

@ -0,0 +1 @@
333232

View File

@ -0,0 +1 @@
http://[0.]

View File

@ -0,0 +1 @@
hF0

View File

@ -0,0 +1 @@
rrrdrrd:

View File

@ -0,0 +1 @@
gBggggggggyyyyyyyyg尨

View File

@ -0,0 +1 @@
hxiek7yel116842684

View File

@ -0,0 +1 @@
http://a8:b@0</dir‰‰‰‰‰‰‰‰‰‰‰‰‰:/1=val

View File

@ -0,0 +1,2 @@
http://http:/:b@ВЌ%%%%%%%Ь%%%%%%%%%%%%%http://aЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄЄ(ЄЄЄЄЄЄЄЄЄ66666667;000000000000В%%%%%%%%%%%%%%%%%%%%%%66666666666666'f
7;000000000000В%%%%%%%%%%%%%%%%%%%%%6%6666666666666'f

View File

@ -0,0 +1 @@
http://a://a:b@x.y:80/di8....../.../.././0/dir/fh

View File

@ -0,0 +1 @@
hxel00000NNNooooÆN66

View File

@ -0,0 +1 @@
htkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk/Fil

View File

@ -0,0 +1 @@
http://[BBB:BBBBB]

View File

@ -0,0 +1 @@
http://acbキャャャャャ;ャb<EFBDAC>キャム<EFBDAC>ャャャャャャャャャャャャャャャ'

View File

@ -0,0 +1 @@
http://ÿee=j

View File

@ -0,0 +1 @@
http://<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><15><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>

View File

@ -0,0 +1 @@
3332BBBB

View File

@ -0,0 +1 @@
http://Õ./.0/d//../.......0/d..........0/d//../.......0/di8.....il..e.x?keir/file.x?key=ee=kxval&key2=val#f

View File

@ -0,0 +1 @@
ftp://ホ:%33;

View File

@ -0,0 +1 @@
http://[5555b]

View File

@ -0,0 +1 @@
http://a:b@uŠŠÿÿÿÿÿÿÿ%%%.ŠŠ3=val#f

View File

@ -0,0 +1 @@
hEEEEEEEE

View File

@ -0,0 +1 @@
http://a:bÓ@цÅǶr/f.6

View File

@ -0,0 +1 @@
http://a:b@x.ŠŠŠŠŠŠŠŠŠŠŠŠŠht://../.....<2E>Š..ŠŠŠŠŠŠ

View File

@ -0,0 +1 @@
http://öap://::::::!:::::::::::::Ú:::˙˙˙˙::::.ebbbbbb&key2=val#f

View File

@ -0,0 +1 @@
hIIII7777777777777777777777777777777777777777777777777htQQQQQQQQ#f

View File

@ -0,0 +1 @@
http://a<>:b@x.<2E><> <0A><><EFBFBD><EFBFBD><EFBFBD>%%

View File

@ -0,0 +1 @@
http://[%301.]

View File

@ -0,0 +1 @@
http://a:b@x%%%%<<<<<k 1=val#f

View File

@ -0,0 +1 @@
OO

View File

@ -0,0 +1 @@
Kbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb郹<13>

View File

@ -0,0 +1 @@
http://h/

View File

@ -0,0 +1 @@
http://<18>

View File

@ -0,0 +1 @@
http://[%33::]ス

View File

@ -0,0 +1 @@
http://a:b@xal&k\\\\\\\\\\\\\\\\\\\¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾\\\\\\\\ey2http://a:bx@.yz80/di80/dhttp://ap:)//a:b@x.y:80

View File

@ -0,0 +1 @@
ftp://<2F>;

View File

@ -0,0 +1 @@
http://ape~~)eeeeeeeee%eeeeege

View File

@ -0,0 +1 @@
httpS://.

View File

@ -0,0 +1 @@
http://a:/............/.././...../.././....dir=

View File

@ -0,0 +1 @@
Hh

View File

@ -0,0 +1 @@
ftp://%3a:%32

View File

@ -0,0 +1 @@
Irzrrrrrz」tp:/ャャ;

View File

@ -0,0 +1 @@
ww

View File

@ -0,0 +1 @@
hMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMy0=

View File

@ -0,0 +1 @@
ht6666000000000000000000060000000000000106:2341val#f

View File

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

View File

@ -0,0 +1 @@
hTtTt

View File

@ -0,0 +1 @@
htklLllllllli

View File

@ -0,0 +1 @@
http://httpyyyyyyyy˙:0000000000000000000000000000000000

View File

@ -0,0 +1 @@
http://key=vax

View File

@ -0,0 +1 @@
http://ム末末;蘭

View File

@ -0,0 +1 @@
http://a:b@=val#ÿÿÿÿy3=va:l#ÿÿÿÿf

View File

@ -0,0 +1 @@
hVmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmml

View File

@ -0,0 +1 @@
77777777III#f

View File

@ -0,0 +1 @@
httKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKp:/q#f

View File

@ -0,0 +1 @@
httLLxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#f

View File

@ -0,0 +1 @@
http://ÿÿÿÿpa:960/al

View File

@ -0,0 +1 @@
http://%3a

View File

@ -0,0 +1,2 @@
http://a:b@x.yz80ÈÇÏÐìf
r/file.x?key=val&key2=va:l#f

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