-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Server-side request forgery (SSRF) detection operator (#268)
- Loading branch information
Showing
215 changed files
with
2,108 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
MACRO(GET_DIRS subdirs parent) | ||
FILE(GLOB children RELATIVE ${parent} ${parent}/*) | ||
SET(subdirs "") | ||
FOREACH(child ${children}) | ||
IF(IS_DIRECTORY ${parent}/${child}) | ||
LIST(APPEND subdirs ${child}) | ||
ENDIF() | ||
ENDFOREACH() | ||
ENDMACRO() | ||
|
||
GET_DIRS(subdirs ${CMAKE_CURRENT_SOURCE_DIR}) | ||
|
||
set(LINK_COMPILE_FLAGS "-fsanitize=fuzzer,address,undefined,leak -fprofile-instr-generate -fcoverage-mapping") | ||
|
||
add_library(fuzzer-common OBJECT ${LIBDDWAF_SOURCE}) | ||
set_target_properties(fuzzer-common PROPERTIES | ||
CXX_STANDARD 20 | ||
CXX_STANDARD_REQUIRED YES | ||
CXX_EXTENSIONS NO | ||
COMPILE_FLAGS ${LINK_COMPILE_FLAGS} | ||
LINK_FLAGS ${LINK_COMPILE_FLAGS}) | ||
target_include_directories(fuzzer-common PRIVATE ${LIBDDWAF_PUBLIC_INCLUDES} ${LIBDDWAF_PRIVATE_INCLUDES}) | ||
|
||
foreach(dir ${subdirs}) | ||
set(FUZZER_NAME "${dir}_fuzzer") | ||
file(GLOB_RECURSE FUZZER_SOURCE ${dir}/src/*.cpp) | ||
add_executable(${FUZZER_NAME} ${FUZZER_SOURCE}) | ||
|
||
set_target_properties(${FUZZER_NAME} PROPERTIES | ||
CXX_STANDARD 20 | ||
CXX_STANDARD_REQUIRED YES | ||
CXX_EXTENSIONS NO | ||
COMPILE_FLAGS ${LINK_COMPILE_FLAGS} | ||
LINK_FLAGS ${LINK_COMPILE_FLAGS}) | ||
|
||
target_include_directories(${FUZZER_NAME} PRIVATE ${LIBDDWAF_PUBLIC_INCLUDES} ${LIBDDWAF_PRIVATE_INCLUDES}) | ||
target_link_libraries(${FUZZER_NAME} PRIVATE fuzzer-common lib_yamlcpp) | ||
endforeach() | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
set -eu | ||
|
||
cp build/fuzzer/global_fuzzer fuzzer/global/global_fuzzer | ||
python3 fuzzer/global/scripts/build_corpus.py | ||
|
||
cd fuzzer/global | ||
|
||
export ASAN_OPTIONS=detect_leaks=1 | ||
|
||
rm -f fuzz-*.log | ||
|
||
echo "Run global fuzzer for ${1:-60} seconds" | ||
./global_fuzzer -timeout=0.1 -report_slow_units=0.01 -max_total_time=${1:-60} -max_len=1000 -rss_limit_mb=4096 -use_value_profile=1 -dict=sample_dict.txt -artifact_prefix=results/ -jobs=4 -workers=4 -reload=0 corpus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
#!/bin/bash | ||
set -eu | ||
|
||
cd fuzzing | ||
cd fuzzer/global | ||
|
||
rm -rf corpus/ | ||
rm -f fuzz-*.log | ||
rm -f sample_dict.txt sample_rules.yml | ||
rm -f default.profdata default.profraw coverage.html | ||
rm -rf fuzzer.dSYM | ||
rm -rf fuzzer | ||
rm -rf global_fuzzer.dSYM | ||
rm -rf global_fuzzer |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
set -eu | ||
|
||
cd fuzzer/global | ||
|
||
llvm-profdata-17 merge -sparse *.profraw -o default.profdata | ||
llvm-cov-17 show global_fuzzer -instr-profile=default.profdata -ignore-filename-regex="(vendor|fuzzer|third_party)" -format=html > coverage.html | ||
llvm-cov-17 report -instr-profile default.profdata global_fuzzer -ignore-filename-regex="(vendor|fuzzer|third_party)" -show-region-summary=false | ||
|
||
if [ ! -z ${1:-} ]; then | ||
THRESHOLD=$1 | ||
TOTAL=$(llvm-cov-17 report -instr-profile default.profdata global_fuzzer -ignore-filename-regex="(vendor|fuzzer|third_party)" -show-region-summary=false | grep TOTAL) | ||
ARRAY=($TOTAL) | ||
COVERAGE=$(echo ${ARRAY[3]} | sed -e "s/\.[[:digit:]]*%//g") | ||
|
||
if (( $COVERAGE < $THRESHOLD )); then | ||
echo "Sorry, the fuzzer found no bug, but the coverage is below $THRESHOLD%. Can't call it a success." 1>&2 | ||
exit 1 | ||
fi | ||
fi |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.