Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Benjamin J. Thompson
Tor
Commits
44fa14c0
Commit
44fa14c0
authored
8 years ago
by
Nick Mathewson
Browse files
Options
Downloads
Patches
Plain Diff
Try to tweak fuzzing.md to correspond to my changes
parent
0fb1156e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/HACKING/Fuzzing.md
+19
-17
19 additions, 17 deletions
doc/HACKING/Fuzzing.md
src/test/fuzz/fuzz_multi.sh
+0
-0
0 additions, 0 deletions
src/test/fuzz/fuzz_multi.sh
with
19 additions
and
17 deletions
doc/HACKING/Fuzzing.md
+
19
−
17
View file @
44fa14c0
...
...
@@ -3,6 +3,11 @@
To run the fuzzing test cases in a deterministic fashion, use:
make fuzz
[I've turned this off for now. - NM]
To build the fuzzing harness binaries, use:
make fuzzers
== Guided Fuzzing with AFL
There is no HTTPS, hash, or signature for American Fuzzy Lop's source code, so
...
...
@@ -22,7 +27,7 @@ To Find The ASAN Memory Limit: (64-bit only)
On 64-bit platforms, afl needs to know how much memory ASAN uses.
Or, you can configure tor without --enable-expensive-hardening, then use
make fuzz
to run the generated test cases through an ASAN-enabled fuzz
_dir
.
to run the generated test cases through an ASAN-enabled fuzz
-http
.
Read afl/docs/notes_for_asan.txt for more details.
Download recidivm from http://jwilk.net/software/recidivm
...
...
@@ -36,10 +41,14 @@ Read afl/docs/notes_for_asan.txt for more details.
(Normally, recidivm would output a figure automatically, but in some cases,
the fuzzing harness will hang when the memory limit is too small.)
You could also just say "none" instead of the memory limit below, if you
don't care about memory limits.
To Run:
mkdir -p src/test/fuzz/fuzz_
dir_testcase src/test/fuzz/fuzz_dir
_findings
echo "dummy" > src/test/fuzz
/fuzz
_
di
r_testcase/minimal.case
../afl/afl-fuzz -i src/test/fuzz/fuzz_dir_testcase -o src/test/fuzz/fuzz_dir_findings -m
<asan-memory-limit>
-- src/test/fuzz_dir
mkdir -p src/test/fuzz/fuzz_
http
_findings
../afl/afl-fuzz -i src/test/fuzz/data/http -x src/test
/fuzz
/
di
ct/http -o src/test/fuzz/fuzz_http_findings -m
<asan-memory-limit>
-- src/test/fuzz_dir
AFL has a multi-core mode, check the documentation for details.
You might find the included fuzz-multi.sh script useful for this.
...
...
@@ -48,19 +57,12 @@ macOS (OS X) requires slightly more preparation, including:
*
using afl-clang (or afl-clang-fast from the llvm directory)
*
disabling external crash reporting (AFL will guide you through this step)
AFL may also benefit from using dictionary files for text-based inputs: these
can be placed in src/test/fuzz/fuzz_dir_dictionary/.
Multiple dictionaries can be used with AFL, you should choose a combination of
dictionaries that targets the code you are fuzzing.
== Writing Tor fuzzers
A tor fuzzing harness should:
*
read input from standard input (many fuzzing frameworks also accept file
names)
*
parse that input
*
produce results on standard output (this assists in diagnosing errors)
A tor fuzzing harness should have:
*
a fuzz_init() function to set up any necessary global state.
*
a fuzz_main() function to receive input and pass it to a parser.
*
a fuzz_cleanup() function to clear global state.
Most fuzzing frameworks will produce many invalid inputs - a tor fuzzing
harness should rejecting invalid inputs without crashing or behaving badly.
...
...
@@ -78,8 +80,8 @@ Check if a hang is reproducible before reporting it. Sometimes, processing
valid inputs may take a second or so, particularly with the fuzzer and
sanitizers enabled.
To see what fuzz
_dir
is doing with a test case, call it like this:
src/test/fuzz
_dir
--debug < /path/to/test.case
To see what fuzz
-http
is doing with a test case, call it like this:
src/test/fuzz
/fuzz-http
--debug < /path/to/test.case
(Logging is disabled while fuzzing to increase fuzzing speed.)
...
...
This diff is collapsed.
Click to expand it.
src/test/fuzz_multi.sh
→
src/test/fuzz
/fuzz
_multi.sh
+
0
−
0
View file @
44fa14c0
File moved
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment