Jazzer is a coverage-guided, in-process fuzzer for the JVM platform developed by Code Intelligence. It is based on libFuzzer and brings many of its instrumentation-powered mutation features to the JVM.
The JVM bytecode is executed inside the fuzzer process, which ensures fast execution speeds and allows seamless fuzzing of native libraries.
Jazzer currently supports the following platforms:
- Linux x86_64
- macOS 10.15+ x86_64 (experimental support for arm64)
- Windows x86_64
Code Intelligence and Google have teamed up to bring support for Java, Kotlin, and other JVM-based languages to OSS-Fuzz, Google's project for large-scale fuzzing of open-souce software. Read the blogpost over at the Google Security Blog.
If you want to learn more about Jazzer and OSS-Fuzz, watch the FuzzCon 2020 talk by Abhishek Arya and Fabian Meumertzheim.
The "distroless" Docker image cifuzz/jazzer includes Jazzer together with OpenJDK 11. Just mount a directory containing your compiled fuzz target into the container under /fuzzing
by running:
docker run -v path/containing/the/application:/fuzzing cifuzz/jazzer <arguments>
If Jazzer produces a finding, the input that triggered it will be available in the same directory.
Jazzer has the following dependencies when being built from source:
- Bazel 4 or later
- JDK 8 or later (e.g. OpenJDK)
- Clang and LLD 9.0 or later (using a recent version is strongly recommended)
It is recommended to use Bazelisk to automatically download and install Bazel.
Simply download the release binary for your OS and architecture and ensure that it is available in the PATH
.
The instructions below will assume that this binary is called bazel
- Bazelisk is a thin wrapper around the actual Bazel binary and can be used interchangeably.
Assuming the dependencies are installed, build Jazzer from source as follows:
$ git clone https://github.com/CodeIntelligenceTesting/jazzer
$ cd jazzer
# Note the double dash used to pass <arguments> to Jazzer rather than Bazel.
$ bazel run //:jazzer -- <arguments>
If you prefer to build binaries that can be run without Bazel, use the following command to build your own archive with release binaries:
$ bazel build //:jazzer_release
...
INFO: Found 1 target...
Target //:jazzer_release up-to-date:
bazel-bin/jazzer_release.tar.gz
...
This will print the path of a jazzer_release.tar.gz
archive that contains the same binaries that would be part of a release.
The build may fail with the clang shipped with Xcode. If you encounter issues during the build, add --config=toolchain
right after run
or build
in the bazelisk
commands above to use a checked-in toolchain that is known to work.
Alternatively, manually install LLVM and set CC
to the path of LLVM clang.
Support for Jazzer has recently been added to rules_fuzzing, the official Bazel rules for fuzzing. See their README for instructions on how to use Jazzer in a Java Bazel project.
Binary releases are available under Releases, but do not always include the latest changes.
The binary distributions of Jazzer consist of the following components:
jazzer
- main binaryjazzer_agent_deploy.jar
- Java agent that performs bytecode instrumentation and tracks coverage (automatically loaded byjazzer
)jazzer_api_deploy.jar
- contains convenience methods for creating fuzz targets and defining custom hooks
The additional release artifact examples_deploy.jar
contains most of the examples and can be used to run them without having to build them (see Examples below).
After unpacking the archive, run Jazzer via
./jazzer <arguments>
If this leads to an error message saying that libjvm.so
has not been found, the path to the local JRE needs to be
specified in the JAVA_HOME
environment variable.
Multiple examples for instructive and real-world Jazzer fuzz targets can be found in the examples/
directory.
A toy example can be run as follows:
# Using Bazel:
bazel run //examples:ExampleFuzzer
# Using the binary release and examples_deploy.jar:
./jazzer --cp=examples_deploy.jar
This should produce output similar to the following:
INFO: Loaded 1 hooks from com.example.ExampleFuzzerHooks
INFO: Instrumented com.example.ExampleFuzzer (took 81 ms, size +83%)
INFO: libFuzzer ignores flags that start with '--'
INFO: Seed: 2735196724
INFO: Loaded 1 modules (65536 inline 8-bit counters): 65536 [0xe387b0, 0xe487b0),
INFO: Loaded 1 PC tables (65536 PCs): 65536 [0x7f9353eff010,0x7f9353fff010),
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 4096 bytes
INFO: A corpus is not provided, starting from an empty corpus
#2 INITED cov: 2 ft: 2 corp: 1/1b exec/s: 0 rss: 94Mb
#1562 NEW cov: 4 ft: 4 corp: 2/14b lim: 17 exec/s: 0 rss: 98Mb L: 13/13 MS: 5 ShuffleBytes-CrossOver-InsertRepeatedBytes-ShuffleBytes-CMP- DE: "magicstring4"-
#1759 REDUCE cov: 4 ft: 4 corp: 2/13b lim: 17 exec/s: 0 rss: 99Mb L: 12/12 MS: 2 ChangeBit-EraseBytes-
#4048 NEW cov: 6 ft: 6 corp: 3/51b lim: 38 exec/s: 0 rss: 113Mb L: 38/38 MS: 4 ChangeBit-ChangeByte-CopyPart-CrossOver-
#4055 REDUCE cov: 6 ft: 6 corp: 3/49b lim: 38 exec/s: 0 rss: 113Mb L: 36/36 MS: 2 ShuffleBytes-EraseBytes-
#4266 REDUCE cov: 6 ft: 6 corp: 3/48b lim: 38 exec/s: 0 rss: 113Mb L: 35/35 MS: 1 EraseBytes-
#4498 REDUCE cov: 6 ft: 6 corp: 3/47b lim: 38 exec/s: 0 rss: 114Mb L: 34/34 MS: 2 EraseBytes-CopyPart-
#4764 REDUCE cov: 6 ft: 6 corp: 3/46b lim: 38 exec/s: 0 rss: 115Mb L: 33/33 MS: 1 EraseBytes-
#5481 REDUCE cov: 6 ft: 6 corp: 3/44b lim: 43 exec/s: 0 rss: 116Mb L: 31/31 MS: 2 InsertByte-EraseBytes-
#131072 pulse cov: 6 ft: 6 corp: 3/44b lim: 1290 exec/s: 65536 rss: 358Mb
== Java Exception: java.lang.IllegalStateException: mustNeverBeCalled has been called
at com.example.ExampleFuzzer.mustNeverBeCalled(ExampleFuzzer.java:38)
at com.example.ExampleFuzzer.fuzzerTestOneInput(ExampleFuzzer.java:32)
DEDUP_TOKEN: eb6ee7d9b256590d
== libFuzzer crashing input ==
MS: 1 CMP- DE: "\x00C"-; base unit: 04e0ccacb50424e06e45f6184ad45895b6b8df8f
0x6d,0x61,0x67,0x69,0x63,0x73,0x74,0x72,0x69,0x6e,0x67,0x34,0x74,0x72,0x69,0x6e,0x67,0x34,0x74,0x69,0x67,0x34,0x7b,0x0,0x0,0x43,0x34,0xa,0x0,0x0,0x0,
magicstring4tring4tig4{\x00\x00C4\x0a\x00\x00\x00
artifact_prefix='./'; Test unit written to crash-efea1e8fc83a15217d512e20d964040a68a968c3
Base64: bWFnaWNzdHJpbmc0dHJpbmc0dGlnNHsAAEM0CgAAAA==
reproducer_path='.'; Java reproducer written to Crash_efea1e8fc83a15217d512e20d964040a68a968c3.java
Here you can see the usual libFuzzer output in case of a crash, augmented with JVM-specific information. Instead of a native stack trace, the details of the uncaught Java exception that caused the crash are printed, followed by the fuzzer input that caused the exception to be thrown (if it is not too long). More information on what hooks and Java reproducers are can be found below.
See examples/BUILD.bazel
for the list of all possible example targets.
Jazzer requires a JVM class containing the entry point for the fuzzer. This is commonly referred to as a "fuzz target" and may be as simple as the following Java example:
package com.example.MyFirstFuzzTarget;
public class MyFirstFuzzTarget {
public static void fuzzerTestOneInput(byte[] input) {
...
// Call the function under test with arguments derived from input and
// throw an exception if something unwanted happens.
...
}
}
A Java fuzz target class needs to define exactly one of the following functions:
public static void fuzzerTestOneInput(byte[] input)
: Ideal for fuzz targets that naturally work on raw byte input (e.g. image parsers).public static void fuzzerTestOneInput(com.code_intelligence.api.FuzzedDataProvider data)
: A variety of types of "fuzzed data" is made available via theFuzzedDataProvider
interface (see below for more information on this interface).
The fuzzer will repeatedly call this function with generated inputs. All unhandled exceptions are caught and reported as errors.
The optional functions public static void fuzzerInitialize()
or public static void fuzzerInitialize(String[] args)
can be defined if initial setup is required. These functions will be called once before
the first call to fuzzerTestOneInput
.
The optional function public static void fuzzerTearDown()
will be run just before the JVM is shut down.
An example of a Kotlin fuzz target can be found in KlaxonFuzzer.kt.
The fuzz target needs to be compiled and packaged into a .jar
archive. Assuming that this archive is called
fuzz_target.jar
and depends on libraries available as lib1.jar
and lib2.jar
, fuzzing is started by
invoking Jazzer with the following arguments:
--cp=fuzz_target.jar:lib1.jar:lib2.jar --target_class=com.example.MyFirstFuzzTarget <optional_corpus_dir>
The fuzz target class can optionally be specified by adding it as the value of the Jazzer-Fuzz-Target-Class
attribute
in the JAR's manifest. If there is only a single such attribute among all manifests of JARs on the classpath, Jazzer will
use its value as the fuzz target class.
Bazel produces the correct type of .jar
from a java_binary
target with create_executable = False
and
deploy_manifest_lines = ["Jazzer-Fuzz-Target-Class: com.example.MyFirstFuzzTarget"]
by adding the suffix _deploy.jar
to the target name.
For most non-trivial fuzz targets it is necessary to further process the byte array passed from the fuzzer, for example
to extract multiple values or convert the input into a valid java.lang.String
. We provide functionality similar to
atheris' FuzzedDataProvider
and libFuzzer's FuzzedDataProvider.h
to simplify
the task of writing JVM fuzz targets.
If the function public static void fuzzerTestOneInput(FuzzedDataProvider data)
is defined in the fuzz target, it will
be passed an object implementing com.code_intelligence.jazzer.api.FuzzedDataProvider
that allows consuming the raw fuzzer
input as values of common types. This can look as follows:
package com.example.MySecondFuzzTarget;
import com.code_intelligence.jazzer.api.FuzzedDataProvider;
public class MySecondFuzzTarget {
public static void callApi(int val, String text) {
...
}
public static void fuzzerTestOneInput(FuzzedDataProvider data) {
callApi1(data.consumeInt(), data.consumeRemainingAsString());
}
}
The FuzzedDataProvider
interface definition is contained in jazzer_api_deploy.jar
in the binary release and can be
built by the Bazel target //agent:jazzer_api_deploy.jar
. It is also available from
Maven Central.
For additional information, see the
javadocs.
It is highly recommended to use FuzzedDataProvider
for generating java.lang.String
objects inside the fuzz target
instead of converting the raw byte array to directly via a String
constructor as the FuzzedDataProvider
implementation is
engineered to minimize copying and generate both valid and invalid ASCII-only and Unicode strings.
The Autofuzz mode enables fuzzing arbitrary methods without having to manually create fuzz targets. Instead, Jazzer will attempt to generate suitable and varied inputs to a specified methods using only public API functions available on the classpath.
To use Autofuzz, specify the --autofuzz
flag and provide a fully qualified method reference, e.g.:
--autofuzz=org.apache.commons.imaging.Imaging::getBufferedImage
To autofuzz a constructor the ClassType::new
format can be used.
If there are multiple overloads, and you want Jazzer to only fuzz one, you can optionally specify the signature of the method to fuzz:
--autofuzz=org.apache.commons.imaging.Imaging::getBufferedImage(java.io.InputStream,java.util.Map)
The format of the signature agrees with that obtained from the part after the #
of the link to the Javadocs for the particular method.
Under the hood, Jazzer tries various ways of creating objects from the fuzzer input. For example, if a parameter is an interface or an abstract class, it will look for all concrete implementing classes on the classpath. Jazzer can also create objects from classes that follow the builder design pattern or have a default constructor and use setters to set the fields.
Creating objects from fuzzer input can lead to many reported exceptions.
Jazzer addresses this issue by ignoring exceptions that the target method declares to throw.
In addition to that, you can provide a list of exceptions to be ignored during fuzzing via the --autofuzz_ignore
flag in the form of a comma-separated list.
You can specify concrete exceptions (e.g., java.lang.NullPointerException
), in which case also subclasses of these exception classes will be ignored, or glob patterns to ignore all exceptions in a specific package (e.g. java.lang.*
or com.company.**
).
When fuzzing with --autofuzz
, Jazzer automatically enables the --keep_going
mode to keep fuzzing indefinitely after the first finding.
Set --keep_going=N
explicitly to stop after the N
-th finding.
To facilitate using the Autofuzz mode, there is a docker image that you can use to fuzz libraries just by providing their Maven coordinates. The dependencies will then be downloaded and autofuzzed:
docker run cifuzz/jazzer-autofuzz <Maven coordinates> --autofuzz=<method reference> <further arguments>
As an example, you can autofuzz the json-sanitizer
library as follows:
docker run -it cifuzz/jazzer-autofuzz \
com.mikesamuel:json-sanitizer:1.2.0 \
com.google.json.JsonSanitizer::sanitize \
--autofuzz_ignore=java.lang.ArrayIndexOutOfBoundsException \
--keep_going=1
When Jazzer manages to find an input that causes an uncaught exception or a failed assertion, it prints a Java stack trace and creates two files that aid in reproducing the crash without Jazzer:
crash-<sha1_of_input>
contains the raw bytes passed to the fuzz target (just as with libFuzzer C/C++ fuzz targets). The crash can be reproduced with Jazzer by passing the path to the crash file as the only positional argument.Crash-<sha1_of_input>.java
contains a class with amain
function that invokes the fuzz target with the crashing input. This is especially useful if usingFuzzedDataProvider
as the raw bytes of the input do not directly correspond to the values consumed by the fuzz target. The.java
file can be compiled with just the fuzz target and its dependencies in the classpath (plusjazzer_api_deploy.jar
if using `FuzzedDataProvider).
Every crash stack trace is accompanied by a DEDUP_TOKEN
that uniquely identifies the relevant parts of the stack
trace. This value is used by libFuzzer while minimizing a crashing input to ensure that the smaller inputs reproduce
the "same" bug. To minimize a crashing input, execute Jazzer with the following arguments in addition to --cp
and
--target_class
:
-minimize_crash=1 <path/to/crashing_input>
libFuzzer offers the -fork=N
and -jobs=N
flags for parallel fuzzing, both of which are also supported by Jazzer.
Jazzer currently maintains coverage information in a global variable that is shared among threads. This means that while fuzzing multi-threaded fuzz targets is theoretically possible, the reported coverage information may be misleading.
Jazzer has so far uncovered the following vulnerabilities and bugs:
Project | Bug | Status | CVE | found by |
---|---|---|---|---|
OpenJDK | OutOfMemoryError via a small BMP image |
fixed | CVE-2022-21360 | Code Intelligence |
OpenJDK | OutOfMemoryError via a small TIFF image |
fixed | CVE-2022-21366 | Code Intelligence |
protocolbuffers/protobuf | Small protobuf messages can consume minutes of CPU time | fixed | CVE-2021-22569 | OSS-Fuzz |
jhy/jsoup | More than 19 Bugs found in HTML and XML parser | fixed | CVE-2021-37714 | Code Intelligence |
Apache/commons-compress | Infinite loop when loading a crafted 7z | fixed | CVE-2021-35515 | Code Intelligence |
Apache/commons-compress | OutOfMemoryError when loading a crafted 7z |
fixed | CVE-2021-35516 | Code Intelligence |
Apache/commons-compress | Infinite loop when loading a crafted TAR | fixed | CVE-2021-35517 | Code Intelligence |
Apache/commons-compress | OutOfMemoryError when loading a crafted ZIP |
fixed | CVE-2021-36090 | Code Intelligence |
Apache/PDFBox | Infinite loop when loading a crafted PDF | fixed | CVE-2021-27807 | Code Intelligence |
Apache/PDFBox | OutOfMemoryError when loading a crafted PDF | fixed | CVE-2021-27906 | Code Intelligence |
netplex/json-smart-v1 netplex/json-smart-v2 |
JSONParser#parse throws an undeclared exception |
fixed | CVE-2021-27568 | @GanbaruTobi |
OWASP/json-sanitizer | Output can contain</script> and ]]> , which allows XSS |
fixed | CVE-2021-23899 | Code Intelligence |
OWASP/json-sanitizer | Output can be invalid JSON and undeclared exceptions can be thrown | fixed | CVE-2021-23900 | Code Intelligence |
alibaba/fastjon | JSON#parse throws undeclared exceptions |
fixed | Code Intelligence | |
Apache/commons-compress | Infinite loop and OutOfMemoryError in TarFile |
fixed | Code Intelligence | |
Apache/commons-compress | NullPointerException in ZipFile |
fixed | Code Intelligence | |
Apache/commons-imaging | Parsers for multiple image formats throw undeclared exceptions | reported | Code Intelligence | |
Apache/PDFBox | Various undeclared exceptions | fixed | Code Intelligence | |
cbeust/klaxon | Default parser throws runtime exceptions | fixed | Code Intelligence | |
FasterXML/jackson-dataformats-binary | CBORParser throws an undeclared exception due to missing bounds checks when parsing Unicode |
fixed | Code Intelligence | |
FasterXML/jackson-dataformats-binary | CBORParser throws an undeclared exception on dangling arrays |
fixed | Code Intelligence | |
ngageoint/tiff-java | readTiff Index Out Of Bounds |
fixed | @raminfp | |
google/re2j | NullPointerException in Pattern.compile |
reported | @schirrmacher | |
google/gson | ArrayIndexOutOfBounds in ParseString |
fixed | @DavidKorczynski |
As Jazzer is used to fuzz JVM projects in OSS-Fuzz, an additional list of bugs can be found on the OSS-Fuzz issue tracker.
If you find bugs with Jazzer, we would like to hear from you! Feel free to open an issue or submit a pull request.
Various command line options are available to control the instrumentation and fuzzer execution. Since Jazzer is a
libFuzzer-compiled binary, all positional and single dash command-line options are parsed by libFuzzer. Therefore, all
Jazzer options are passed via double dash command-line flags, i.e., as --option=value
(note the =
instead of a space).
A full list of command-line flags can be printed with the --help
flag. For the available libFuzzer options please refer
to its documentation for a detailed description.
When Jazzer is launched, it starts a JVM in which it executes the fuzz target.
Arguments for this JVM can be provided via the JAVA_OPTS
environment variable.
Alternatively, arguments can also be supplied via the --jvm_args
argument.
Multiple arguments are delimited by the classpath separator, which is ;
on Windows and :
else.
For example, to enable preview features as well as set a maximum heap size, add the following to the Jazzer invocation:
# Windows
--jvm_args=--enable-preview;-Xmx1000m
# Linux & macOS
--jvm_args=--enable-preview:-Xmx1000m
Arguments specified with --jvm_args
take precendence over those in JAVA_OPTS
.
The Jazzer agent inserts coverage markers into the JVM bytecode during class loading. libFuzzer uses this information to guide its input mutations towards increased coverage.
It is possible to restrict instrumentation to only a subset of classes with the --instrumentation_includes
flag. This
is especially useful if coverage inside specific packages is of higher interest, e.g., the user library under test rather than an
external parsing library in which the fuzzer is likely to get lost. Similarly, there is --instrumentation_excludes
to
exclude specific classes from instrumentation. Both flags take a list of glob patterns for the java class name separated
by colon:
--instrumentation_includes=com.my_com.**:com.other_com.** --instrumentation_excludes=com.my_com.crypto.**
By default, JVM-internal classes and Java as well as Kotlin standard library classes are not instrumented, so these do not need to be excluded manually.
The agent adds additional hooks for tracing compares, integer divisions, switch statements and array indices.
These hooks correspond to clang's data flow hooks.
The particular instrumentation types to apply can be specified using the --trace
flag, which accepts the following values:
cov
: AFL-style edge coveragecmp
: compares (int, long, String) and switch casesdiv
: divisors in integer divisionsgep
: constant array indexesindir
: call throughMethod#invoke
all
: shorthand to apply all available instrumentations (exceptgep
)
Multiple instrumentation types can be combined with a colon.
The run-time flag -use_value_profile=1
enables libFuzzer's value profiling mode.
When running with this flag, the feedback about compares and constants received from Jazzer's trace instrumentation is
associated with the particular bytecode location and used to provide additional coverage instrumentation.
See ExampleValueProfileFuzzer.java
for a fuzz target that would be very hard to fuzz without value profile.
As passing the bytecode location back to libFuzzer requires inline assembly and may thus not be fully portable, it can be disabled
via the flag --nofake_pcs
.
In order to obtain information about data passed into functions such as String.equals
or String.startsWith
, Jazzer
hooks invocations to these methods. This functionality is also available to fuzz targets, where it can be used to implement
custom sanitizers or stub out methods that block the fuzzer from progressing (e.g. checksum verifications or random number generation).
See ExampleFuzzerHooks.java
for an example of such a hook. An example for a sanitizer can be found in
ExamplePathTraversalFuzzerHooks.java.
Method hooks can be declared using the @MethodHook
annotation defined in the com.code_intelligence.jazzer.api
package,
which is contained in jazzer_api_deploy.jar
(binary release) or built by the target //agent:jazzer_api_deploy.jar
(Bazel).
It is also available from
Maven Central.
See the javadocs of the @MethodHook
API
for more details.
To use the compiled method hooks they have to be available on the classpath provided by --cp
and can then be loaded by providing the
flag --custom_hooks
, which takes a colon-separated list of names of classes to load hooks from.
If a hook is meant to be applied to a class in the Java standard library, it has to be loaded from a JAR file so that Jazzer can add it to the bootstrap class loader search.
This list of custom hooks can alternatively be specified via the Jazzer-Hook-Classes
attribute in the fuzz target
JAR's manifest.
With the flag --keep_going=N
Jazzer continues fuzzing until N
unique stack traces have been encountered.
Particular stack traces can also be ignored based on their DEDUP_TOKEN
by passing a comma-separated list of tokens
via --ignore=<token_1>,<token2>
.
The internally gathered JaCoCo coverage information can be exported in human-readable and JaCoCo execution data format
(.exec
). These can help identify code areas that have not been covered by the fuzzer and thus may require more
comprehensive fuzz targets or a more extensive initial corpus to reach.
The human-readable report contains coverage information, like branch and line coverage, on file level. It's useful to
get a quick overview about the overall coverage. The flag --coverage_report=<file>
can be used to generate it.
Similar to the JaCoCo dump
command, the flag --coverage_dump=<file>
specifies a coverage dump file, often called
jacoco.exec
, that is generated after the fuzzing run. It contains a binary representation of the gathered coverage
data in the JaCoCo format.
The JaCoCo report
command can be used to generate reports based on this coverage dump. Note: The version of the
JaCoCo agent used by Jazzer internally differs slightly from the official one. As a result, a similarly modified version
of the JaCoCo CLI tool has to be used to generate correct reports. The correct version is available at its
release page as zip
file. The report tool is located in
the lib
folder and can be used as described in the JaCoCo
CLI documentation. For example the following command generates an
HTML report in the folder report
containing all classes available in classes.jar
and their coverage as captured in
the export coverage.exec
. Source code to include in the report is searched for in some/path/to/sources
.
After execution the index.html
file in the output folder can be opened in a browser.
java -jar path/to/jacococli.jar report coverage.exec \
--classfiles classes.jar \
--sourcefiles some/path/to/sources \
--html report \
--name FuzzCoverageReport
Furthermore, it's also possible to directly use the CLI tools of the internal JaCoCo version via Bazel with the target
@jazzer_jacoco//:jacoco_cli
. The following command builds an HTML report similar to the one mentioned above:
bazel run @jazzer_jacoco//:jacoco_cli -- \
report /coverage.exec \
--classfiles /classes.jar \
--sourcefiles /some/path/to/sources \
--html /tmp/report/ \
--name FuzzCoverageReport
Jazzer supports fuzzing of native libraries loaded by the JVM, for example via System.load()
. For the fuzzer to get
coverage feedback, these libraries have to be compiled with -fsanitize=fuzzer-no-link
.
Additional sanitizers such as AddressSanitizer or UndefinedBehaviorSanitizer are often desirable to uncover bugs inside the native libraries. The required compilation flags for native libraries are as follows:
- AddressSanitizer:
-fsanitize=fuzzer-no-link,address
- UndefinedBehaviorSanitizer:
-fsanitize=fuzzer-no-link,undefined
(add-fno-sanitize-recover=all
to crash on UBSan reports)
Then, use the appropriate driver //:jazzer_asan
or //:jazzer_ubsan
.
Note: Sanitizers other than AddressSanitizer and UndefinedBehaviorSanitizer are not yet supported. Furthermore, due to the nature of the JVM's GC, LeakSanitizer reports too many false positives to be useful and is thus disabled.
The fuzz targets ExampleFuzzerWithNativeASan
and ExampleFuzzerWithNativeUBSan
in the examples/
directory contain
minimal working examples for fuzzing with native libraries. Also see TurboJpegFuzzer
for a real-world example.
LibFuzzer API offers two functions to customize the mutation strategy which is especially useful when fuzzing functions
that require structured input. Jazzer does not define LLVMFuzzerCustomMutator
nor LLVMFuzzerCustomCrossOver
and
leaves the mutation strategy entirely to libFuzzer. However, custom mutators can easily be integrated by
compiling a mutator library which defines LLVMFuzzerCustomMutator
(and optionally LLVMFuzzerCustomCrossOver
) and
pre-loading the mutator library:
# Using Bazel:
LD_PRELOAD=libcustom_mutator.so bazel run //:jazzer -- <arguments>
# Using the binary release:
LD_PRELOAD=libcustom_mutator.so ./jazzer <arguments>
The following developers have contributed to Jazzer before its public release:
Sergej Dechand, Christian Hartlage, Fabian Meumertzheim, Sebastian Pöplau, Mohammed Qasem, Simon Resch, Henrik Schnor, Khaled Yakdan
The LLVM-style edge coverage instrumentation for JVM bytecode used by Jazzer relies on JaCoCo. Previously, Jazzer used AFL-style coverage instrumentation as pioneered by kelinci.