Skip to content

Commit

Permalink
Integrate Ecofuzz and test it (google#1764)
Browse files Browse the repository at this point in the history
With this PR EcoFuzz
(https://www.usenix.org/conference/usenixsecurity20/presentation/yue)
can be tested on FuzzBench.
I'm requesting also an experiment to compare it to AFL and AFLFast as
AFL is the baseline and AFLFast is a previous fuzzer (2/3 years?) trying
to address the same problem.

---------

Co-authored-by: jonathanmetzman <[email protected]>
  • Loading branch information
andreafioraldi and jonathanmetzman authored Mar 17, 2023
1 parent f0509cf commit 6291809
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 0 deletions.
31 changes: 31 additions & 0 deletions fuzzers/ecofuzz/builder.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

ARG parent_image
FROM $parent_image

# Download and compile EcoFuzz.
# Set AFL_NO_X86 to skip flaky tests.
RUN git clone https://github.com/MoonLight-SteinsGate/EcoFuzz /EcoFuzz && \
mv /EcoFuzz/EcoFuzz /afl && \
cd /afl && \
AFL_NO_X86=1 make

# Use afl_driver.cpp from LLVM as our fuzzing library.
RUN apt-get update && \
apt-get install wget -y && \
wget https://raw.githubusercontent.com/llvm/llvm-project/5feb80e748924606531ba28c97fe65145c65372e/compiler-rt/lib/fuzzer/afl/afl_driver.cpp -O /afl/afl_driver.cpp && \
clang -Wno-pointer-sign -c /afl/llvm_mode/afl-llvm-rt.o.c -I/afl && \
clang++ -stdlib=libc++ -std=c++11 -O2 -c /afl/afl_driver.cpp && \
ar r /libAFL.a *.o
34 changes: 34 additions & 0 deletions fuzzers/ecofuzz/fuzzer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Integration code for EcoFuzz fuzzer."""

from fuzzers.afl import fuzzer as afl_fuzzer


def build():
"""Build benchmark."""
afl_fuzzer.build()


def fuzz(input_corpus, output_corpus, target_binary):
"""Run fuzzer."""
afl_fuzzer.prepare_fuzz_environment(input_corpus)

# Write AFL's output to /dev/null to avoid filling up disk by writing too
# much to log file. This is a problem in general with AFLFast but
# particularly with the lcms benchmark.
afl_fuzzer.run_afl_fuzz(input_corpus,
output_corpus,
target_binary,
hide_output=True)
15 changes: 15 additions & 0 deletions fuzzers/ecofuzz/runner.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM gcr.io/fuzzbench/base-image
7 changes: 7 additions & 0 deletions service/experiment-requests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
# Please add new experiment requests towards the top of this file.
#

- experiment: 2023-02-28-ecofuzz
description: "Test EcoFuzz."
fuzzers:
- afl
- aflfast
- ecofuzz

- experiment: 2023-03-15-aflpp
description: "afl++ identify regressions."
trials: 10
Expand Down

0 comments on commit 6291809

Please sign in to comment.