-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fuzzing: Add uri_parser setup #19057
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ CFLAGS += -ggdb # Make ASAN output more useful error messages | |
CFLAGS += -D_FORTIFY_SOURCE=2 # Compiler hardening | ||
|
||
# Various utilitiy modules | ||
USEMODULE += gnrc_ipv6 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change was done due to gnrc_ipv6 being mandatory (for all harness types) at the moment because |
||
USEMODULE += fuzzing | ||
USEMODULE += ssp | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
include ../Makefile.fuzzing_common | ||
|
||
USEMODULE += gnrc_ipv6 | ||
USEMODULE += gcoap | ||
|
||
include $(RIOTBASE)/Makefile.include |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
include ../Makefile.fuzzing_common | ||
|
||
USEMODULE += uri_parser | ||
|
||
include $(RIOTBASE)/Makefile.include |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
coap:///R@[2008::1]:5own//R@[2008::1]:5own/?v=1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
coap://user@[2001:db8::1]:12345 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ftp://riot-os.org:99/bar/foo |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
http://riot-os.org:99/bar/foo |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
coap://user@[2001:db8::1%eth0]:12345 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright (C) 2022 HAW Hamburg | ||
* | ||
* This file is subject to the terms and conditions of the GNU Lesser | ||
* General Public License v2.1. See the file LICENSE in the top level | ||
* directory for more details. | ||
*/ | ||
|
||
#include <err.h> | ||
#include <unistd.h> | ||
|
||
#include "uri_parser.h" | ||
#include "fuzzing.h" | ||
|
||
int main(void) | ||
{ | ||
size_t input_len; | ||
char *input_buf = (char *)fuzzing_read_bytes(STDIN_FILENO, &input_len); | ||
|
||
if (input_buf == NULL) { | ||
errx(EXIT_FAILURE, "fuzzing_read_bytes failed"); | ||
} | ||
|
||
uri_parser_result_t uri_res; | ||
|
||
uri_parser_process(&uri_res, input_buf, input_len); | ||
|
||
exit(EXIT_SUCCESS); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why would one prefer one over the other? |
||
return EXIT_SUCCESS; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you elaborate why renaming the environment variable is necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure!
If you try to compile using AFL++ (instead of the old AFL) you will encounter this warning:
This was introduced in Version ++3.10c of AFL++:
printing suggestions for mistyped AFL_ env variables
Check the changelog of AFL++ here.
I am aware that RIOTs fuzzing documentation states to use the old AFL 2.52b - where this warning isn't present. However, AFL is no longer maintained. Tho, we should move on towards AFL++. So far all my fuzzing with AFL++ is without issues and the backwards compatibility is nice. This warning being the only issue.
Edit:
Just realised: This can be turned of by setting
AFL_IGNORE_UNKNOWN_ENVS
.I believe changing our name is the better approach as this way we still get hints if we do have typo in some of the AFL envs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving to AFL++ is definitely a good idea! Maybe it also makes sense to update the documentation in this regard. However, I also wouldn't mind doing that in a separate merge request.