Jazzer is a coverage-guided, in-process fuzzer for the JVM platform developed by Code Intelligence

Related tags

Profilers jazzer
Overview

Jazzer logo

Jazzer

Maven Central GitHub Actions Fuzzing Status

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

News: Jazzer available in OSS-Fuzz

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.

Installation

The preferred way to install Jazzer is to compile it from source using Bazel, but binary distributions for x64 Linux as well as a Docker image are also available. Note that these binaries might be outdated as Jazzer follows the "Live at Head" philosophy - you should be able to just checkout the latest commit from main and build it.

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.

Using Docker

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.

Using Bazel

Jazzer has the following dependencies when being built from source:

  • JDK 8 or later (e.g. OpenJDK)
  • Clang and LLD 9.0 or later (using a recent version is strongly recommended)

Linux

Jazzer uses Bazelisk to automatically download and install Bazel on Linux. Building Jazzer from source and running it thus only requires the following assuming the dependencies are installed:

git clone https://github.com/CodeIntelligenceTesting/jazzer
cd jazzer
# Note the double dash used to pass 
   
     to Jazzer rather than Bazel.
   
./bazelisk-linux-amd64 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:

$ ./bazelisk-linux-amd64 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.

macOS

Since Jazzer does not ship the macOS version of Bazelisk, a tool that automatically downloads and installs the correct version of Bazel, download the most recent release of bazelisk-darwin. Afterwards, clone Jazzer and run it via:

git clone https://github.com/CodeIntelligenceTesting/jazzer
cd jazzer
# Note the double dash used to pass 
   
     to Jazzer rather than Bazel.
   
/path/to/bazelisk-darwin 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:

$ /path/to/bazelisk-darwin 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.

Using the provided binaries

Binary releases are available under Releases and are built using an LLVM 11 Bazel toolchain.

The binary distributions of Jazzer consist of the following components:

  • jazzer_driver - native binary that interfaces between libFuzzer and the JVM fuzz target
  • jazzer_agent_deploy.jar - Java agent that performs bytecode instrumentation and tracks coverage
  • jazzer_api_deploy.jar - contains convenience methods for creating fuzz targets and defining custom hooks
  • jazzer - convenience shell script that runs the Jazzer driver with the local JRE shared libraries added to LD_LIBRARY_PATH

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.

Examples

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 Bazelisk:
./bazelisk-linux-amd64 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.

Usage

Creating a fuzz target

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 the FuzzedDataProvider 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.

Kotlin

An example of a Kotlin fuzz target can be found in KlaxonFuzzer.kt.

Running the fuzzer

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.

Fuzzed Data Provider

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.

Autofuzz mode

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

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.

Docker

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

Reproducing a bug

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- 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- .java contains a class with a main function that invokes the fuzz target with the crashing input. This is especially useful if using FuzzedDataProvider 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 (plus jazzer_api_deploy.jar if using `FuzzedDataProvider).

Minimizing a crashing input

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>

Parallel execution

libFuzzer offers the -fork=N and -jobs=N flags for parallel fuzzing, both of which are also supported by Jazzer.

Limitations

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.

Findings

Jazzer has so far uncovered the following vulnerabilities and bugs:

Project Bug Status CVE found by
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 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.

Advanced Options

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.

Passing JVM arguments

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.

Coverage Instrumentation

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.

Trace Instrumentation

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 coverage
  • cmp: compares (int, long, String) and switch cases
  • div: divisors in integer divisions
  • gep: constant array indexes
  • indir: call through Method#invoke
  • all: shorthand to apply all available instrumentations (except gep)

Multiple instrumentation types can be combined with a colon.

Value Profile

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.

Custom Hooks

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. This list of custom hooks can alternatively be specified via the Jazzer-Hook-Classes attribute in the fuzz target JAR's manifest.

Suppressing stack traces

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= , .

Advanced fuzz targets

Fuzzing with Native Libraries

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.

Fuzzing with Custom Mutators

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 ./bazelisk-linux-amd64 run //:jazzer -- <arguments>
# Using the binary release:
LD_PRELOAD=libcustom_mutator.so ./jazzer <arguments>

Credit

The following developers have contributed to Jazzer:

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.

Code Intelligence logo

Comments
  • Undocumented build issues on macOS

    Undocumented build issues on macOS

    same to issue-21

    MacOS version

    10.15.7
    

    java -version

    java version "1.8.0_241"
    Java(TM) SE Runtime Environment (build 1.8.0_241-b07)
    Java HotSpot(TM) 64-Bit Server VM (build 25.241-b07, mixed mode)
    

    bazel --version

    2.1.1-homebrew
    

    clang --version

    Apple clang version 11.0.3 (clang-1103.0.32.29)
    Target: x86_64-apple-darwin19.6.0
    Thread model: posix
    InstalledDir: /Library/Developer/CommandLineTools/usr/bin
    

    run :

    git clone https://github.com/CodeIntelligenceTesting/jazzer
    cd jazzer
    bazel run //:jazzer -- --cp=target.jar
    

    error:

    INFO: Options provided by the client:
      Inherited 'common' options: --isatty=1 --terminal_columns=149
    INFO: Reading rc options for 'run' from /Users/xxx/jazzer/.bazelrc:
      Inherited 'build' options: --incompatible_strict_action_env -c opt --cxxopt=-std=c++17 --action_env=CC=clang --java_language_version=8 --tool_java_language_version=9
    ERROR: Unrecognized option: --java_language_version=8
    
    opened by LandGrey 19
  • JUnit integration usage

    JUnit integration usage

    Hello

    I've been trying to use jazzer-junit with my unit test suite and gradle and it didn't work for me. Couldn't find any documentation on how to make it work with gradle (not bazel). Am I missing some junit configuration? I imported jazzer-junit and synced gradle so it sees all dependencies. But when i try to run i'm getting > No tests found for given includes message. Please, give some brief explanation on how to integrate @FuzzTest annotations to existing junit/gradle setup.

    opened by yarikbratashchuk 15
  • slow-unit does not reproduce and hangs jazzer

    slow-unit does not reproduce and hangs jazzer

    I'm currently testing GZIPInputStream and a portion of the Jackson library. My fuzzer ends up writing a slow-unit to disk, but never writes the reproducer .java. It also never finishes and just sits in futex syscall when I look through /proc/pid/syscall.

    I'm basically asking to see is this an issue with jazzer or did I find a not reproducible bug in my fuzz test. I can post my testcase and whatever else is needed. Just didn't want to end up disclosing a 0-day in the library here if it exists.

    What kind of information would be beneficial to your team to see if it's jazzer?

    bug 
    opened by thapr0digy 11
  • Jazzer junit test engine doesn't write the crash unit test file?

    Jazzer junit test engine doesn't write the crash unit test file?

    Hi, me again.

    So I'm running a Fuzz test through the junit engine and the output tells me:

    <snip>
    MS: 2 ShuffleBytes-InsertByte-; base unit: 0764e7ddb1c31bca059330ce28666718f0879fa2
    0xa,0x3a,0xa,0x4a,
    \012:\012J
    artifact_prefix='\'; Test unit written to \crash-ba614fa5e4b1a1288b0086415b491891adece8b4
    Base64: CjoKSg==
    Done 62 runs in 0 second(s)
    

    But I cannot find that file. I'm running in gradle under Intellij's IDEA.

    Obviously, I've looked in the root of C: (running on Windows 10). I've also done a search for "crash-". The corpus files appear, but nothing else.

    If I'm being dumb again, I apologise.

    opened by stephengardiner 8
  • Jazzer does not use libc++

    Jazzer does not use libc++

    I tried adding jazzer test rules as a http_archive to my WORKSPACE file:

    http_archive(
        name = "rules_jazzer",
        sha256 = "c2b26f80618f51fd7d75e2e8067084f3776f321b596ca2fb19c585f836739bf9",
        strip_prefix = "jazzer-0.9.1",
        urls = ["https://github.com/CodeIntelligenceTesting/jazzer/archive/refs/tags/v0.9.1.tar.gz"],
    )
    

    and then using java_fuzz_target_test as a test in one of my BUILD files

    load("@rules_jazzer//bazel:fuzz_target.bzl", "java_fuzz_target_test")
    
    java_fuzz_target_test(
        name = "gateway_controller_fuzz",
      ....
    )
    

    However, it seems that java_fuzz_target_test adds dependencies on internal targets (e.g. //agent/src/main/java/com/code_intelligence/jazzer/api), which means that it can't be used in this way.

    FWIW, I also suggested that jazzer rules could be added to bazelbuild/rules_fuzzing, so that might be a better place to fix this problem.

    enhancement 
    opened by chrismgrayftsinc 8
  • Issues with classpath for cifuzz/jazzer docker image

    Issues with classpath for cifuzz/jazzer docker image

    I cannot run the docker image with the provided command in the readme. Following the command: docker run -v path/containing/the/application:/fuzzing cifuzz/jazzer --cp=<classpath> --target_class=<fuzz test class>

    I'm executing the command in the root directory of my project: docker run -v $(pwd):/fuzzing cifuzz/jazzer --cp=build/libs/jazzer-docker-example-1.0-SNAPSHOT-all.jar --target_class=com.example.FuzzTestCase

    But I'm getting:

    ERROR: 'com.example.FuzzTestCase' not found on classpath:
    
    build/libs/jazzer-docker-example-1.0-SNAPSHOT-all.jar:/app/jazzer_standalone.jar
    
    All required classes must be on the classpath specified via --cp.
    

    Is there something wrong, with how I provided the classpath? Hope someone can point out the obvious to me. Thanks : )

    opened by lukaswoellhaf 7
  • Java Jazzer class seams to does not honor the --jvm_args nor JAVA_OPTS

    Java Jazzer class seams to does not honor the --jvm_args nor JAVA_OPTS

    When using the new Java-Style com.code_intelligence.jazzer.Jazzer main. The code seams to not honor JVM options, which should be passed to child processes either with --jvm_args or JAVA_OPTS.

    I could not find any code except of the Native launcher to check for these arguments. In the Jazzer class the method javaBinaryArgs() constructs the JVM args, but it does not copy the args into it.

    opened by AndreasTu 7
  • Add support for `compile_command.json` generation

    Add support for `compile_command.json` generation

    compile_command.json, as specified at JSONCompilationDatabase, is used by many tools to provide C++ support. This file can easily be created using the added bazel rule.

    C++ support is particular helpful when changing code in the driver module.

    opened by bertschneider 7
  • Split crash reproducer data

    Split crash reproducer data

    If the recorded FuzzedDataProvider invocation data gets too long it can not be assigned to one String variable in the crash reproducer template anymore. More concretely one constant pool CONSTANT_Utf8_info entry can only hold data of a size up to uint16. This PR splits up the recorded data into multiple chunks to always generate valid crash reproducers.

    Furthermore, a tests directory is introduced to hold an explicit Jazzer integration test to verify this issue (#269). The integration test compiles and executes the generated crash reproducer to verify it's functionality.

    Fixes #269

    opened by bertschneider 6
  • Junit jupiter not picking up any

    Junit jupiter not picking up any "jazzer" tagged tests

    Hi,

    I'm trying to retrofit Jazzer to an existing project (often a mistake!), just to get some familiarity with the software. Having seen that the new Junit jupiter integration is in play, I thought I would try and use that.

    So, I have a new fuzz test task in my gradle build script:

    	val fuzzTest = task<Test>("fuzztest") {
    		description = "Runs fuzz tests."
    		group = "verification"
    
    	dependsOn(tasks.compileTestJava)
    
    	testClassesDirs = sourceSets["test"].output.classesDirs
    	classpath = sourceSets["test"].runtimeClasspath + sourceSets.main.get().output
    	useJUnitPlatform {
    		includeTags("jazzer")
    	}
    	//shouldRunAfter("test")
    }
    

    and I have tagged my fuzz test with the required tag (which is also included in the @FuzzTest annotation)

    @Tag("jazzer")
    class ByteFuzzTest {
        @FuzzTest(maxDuration = "2m")
        void byteFuzz(byte[] data) {
            assumeFalse(System.getenv("JAZZER_FUZZ").isEmpty());
            if (data.length < 1) {
                return;
            }
            if (data[0] % 2 == 0) {
                fail();
            }
        }
    }
    

    with JAZZER_FUZZ=1, I always get this error message:

    org.junit.platform.launcher.core.EngineDiscoveryOrchestrator lambda$logTestDescriptorExclusionReasons$7
    INFO: 18 containers and 14 tests were excluded because tags do not match tag expression(s): [jazzer]
    

    Probably my configuration or junit jupiter libraries, perhaps? I have these in my build script:

        testImplementation(group = "org.junit.jupiter", name = "junit-jupiter", version = "5.9.1")
        testImplementation(group = "org.junit.jupiter", name = "junit-jupiter-api", version = "5.9.1")
        testImplementation(group = "org.junit.jupiter", name = "junit-jupiter-params", version = "5.9.1")
        testImplementation(group = "com.code-intelligence", name="jazzer-junit", version="0.13.1")
    

    Pretty sure this is on me, but any suggestions would be gratefully received.

    opened by stephengardiner 5
  • AutofuzzError: popGroup must be called exactly once for every pushGroup

    AutofuzzError: popGroup must be called exactly once for every pushGroup

    The exception below is encountered when using autofuzz functionality in jazzer-macos-x86_64 release 0.13.0 with the following options: --keep_going=20 -timeout=500 -max_total_time=1000 -detect_leaks=1 --autofuzz_ignore=java.lang.NullPointerException

    Exception: Unexpected exception encountered during autofuzz

    == Java Exception: com.code_intelligence.jazzer.api.FuzzerSecurityIssueHigh: Remote Code Execution Unrestricted class loading based on externally controlled data may allow remote code execution depending on available classes on the classpath. at jaz.Zer.(Zer.java:54) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) DEDUP_TOKEN: 369a3531317dd2b8 == libFuzzer crashing input == MS: 2 ChangeASCIIInt-InsertByte-; base unit: 45af2ab87417b6ba33c8466209734092926d6091 0x1,0x0,0x2f,0x32,0x5d,0x1,0x3a,0x0,0x2f,0x31,0x5d,0xa,0x30,0xff,0xff,0xd2,0x25,0x6e,0xff,0xff,0xff,0xff,0x8,0x73,0xdb,0x3f,0xf4, \001\000/2]\001:\000/1]\0120\377\377\322%n\377\377\377\377\010s\333?\364 artifact_prefix='./'; Test unit written to ./crash-874c731d9350679a19dfce7cf0fc3b244704f7e9 Base64: AQAvMl0BOgAvMV0KMP//0iVu/////whz2z/0 Exception in thread "main" com.code_intelligence.jazzer.autofuzz.AutofuzzError: popGroup must be called exactly once for every pushGroup: [[], [((java.util.function.Supplier) (() -> {redactedClass autofuzzVariable0 = new redactedClass(); return autofuzzVariable0;})).get()], [], [], [], [], [new com.fasterxml.jackson.databind.node.JsonNodeFactory(false)], [], [(org.assertj.core.internal.bytebuddy.description.method.MethodDescription.InDefinedShape) new org.assertj.core.internal.bytebuddy.description.method.MethodDescription.ForLoadedMethod((java.lang.reflect.Method) null), (java.util.List) new jaz.Zer("", (java.lang.Throwable) null)]] Please file an issue at: https://github.com/CodeIntelligenceTesting/jazzer/issues/new/choose at com.code_intelligence.jazzer.autofuzz.AutofuzzCodegenVisitor.generate(AutofuzzCodegenVisitor.java:55) at com.code_intelligence.jazzer.autofuzz.FuzzTarget.dumpReproducer(FuzzTarget.java:238) at com.code_intelligence.jazzer.driver.FuzzTargetRunner.dumpReproducer(FuzzTargetRunner.java:341) at com.code_intelligence.jazzer.driver.FuzzTargetRunner.runOne(FuzzTargetRunner.java:253) at com.code_intelligence.jazzer.runtime.FuzzTargetRunnerNatives.startLibFuzzer(Native Method) at com.code_intelligence.jazzer.driver.FuzzTargetRunner.startLibFuzzer(FuzzTargetRunner.java:409) at com.code_intelligence.jazzer.driver.FuzzTargetRunner.startLibFuzzer(FuzzTargetRunner.java:282) at com.code_intelligence.jazzer.driver.Driver.start(Driver.java:88) at com.code_intelligence.jazzer.Jazzer.start(Jazzer.java:90) at com.code_intelligence.jazzer.Jazzer.main(Jazzer.java:69)

    opened by csulliv9 5
  • Add android support

    Add android support

    This is to add fuzzing support to Jazzer. This is part one, to enable fuzzing if you already have an instrumented Java binary (which you can get with a few manual steps). I will follow this shortly with part 2 to add a tool to instrument a Java binary offline and convert to Android.

    opened by TheCoryBarker 0
  • AutofuzzError: popGroup must be called exactly once for every pushGroup

    AutofuzzError: popGroup must be called exactly once for every pushGroup

    0.14.0 args --autofuzz=test.TestServer::start --autofuzz_ignore=java.lang.NullPointerException

    INFO: Loaded 1802 hooks from com.code_intelligence.jazzer.runtime.TraceCmpHooks
    INFO: Loaded 4 hooks from com.code_intelligence.jazzer.runtime.TraceDivHooks
    INFO: Loaded 2 hooks from com.code_intelligence.jazzer.runtime.TraceIndirHooks
    INFO: Loaded 4 hooks from com.code_intelligence.jazzer.runtime.NativeLibHooks
    INFO: Loaded 5 hooks from com.code_intelligence.jazzer.sanitizers.Deserialization
    INFO: Loaded 5 hooks from com.code_intelligence.jazzer.sanitizers.ExpressionLanguageInjection
    INFO: Loaded 70 hooks from com.code_intelligence.jazzer.sanitizers.LdapInjection
    INFO: Loaded 46 hooks from com.code_intelligence.jazzer.sanitizers.NamingContextLookup
    INFO: Loaded 1 hooks from com.code_intelligence.jazzer.sanitizers.OsCommandInjection
    INFO: Loaded 76 hooks from com.code_intelligence.jazzer.sanitizers.ReflectiveCall
    INFO: Loaded 8 hooks from com.code_intelligence.jazzer.sanitizers.RegexInjection
    INFO: Loaded 16 hooks from com.code_intelligence.jazzer.sanitizers.RegexRoadblocks
    INFO: Loaded 19 hooks from com.code_intelligence.jazzer.sanitizers.SqlInjection
    INFO: Instrumented test.Fuzzer (took 716 ms, size +17%)
    INFO: Instrumented test.TestServer (took 184 ms, size +22%)
    INFO: libFuzzer ignores flags that start with '--'
    INFO: Running with entropic power schedule (0xFF, 100).
    INFO: Seed: 3323939128
    INFO: Loaded 1 modules   (512 inline 8-bit counters): 512 [0x7f8fbc93b9e0, 0x7f8fbc93bbe0), 
    INFO: Loaded 1 PC tables (512 PCs): 512 [0x7f8fbc8d0a70,0x7f8fbc8d2a70), 
    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: 18 ft: 18 corp: 1/1b exec/s: 0 rss: 3114Mb
    
    == Java Exception: java.lang.IllegalArgumentException
    	at java.base/java.lang.Thread.setPriority(Thread.java:1943)
    	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
    	at java.base/java.lang.reflect.Method.invoke(Method.java:578)
    DEDUP_TOKEN: 75c0cacae976638f
    == libFuzzer crashing input ==
    MS: 4 CMP-ShuffleBytes-ChangeBit-ChangeBit- DE: "\000\000"-; base unit: adc83b19e793491b1c6ea0fd8b46cd9f32e592fc
    0x40,0x2,0xa,
    @\002\012
    artifact_prefix='./'; Test unit written to ./crash-21a99ce3a3da13e439a8fdf76a5501c9c04cbe20
    Base64: QAIK
    Exception in thread "main" com.code_intelligence.jazzer.autofuzz.AutofuzzError: popGroup must be called exactly once for every pushGroup: [[], [((java.util.function.Supplier<test.TestServer>) (() -> {test.TestServer autofuzzVariable0 = new test.TestServer(); autofuzzVariable0.setPriority(0); return autofuzzVariable0;})).get()]]
    Please file an issue at:
      https://github.com/CodeIntelligenceTesting/jazzer/issues/new/choose
    	at com.code_intelligence.jazzer.autofuzz.AutofuzzCodegenVisitor.generate(AutofuzzCodegenVisitor.java:55)
    	at com.code_intelligence.jazzer.autofuzz.FuzzTarget.dumpReproducer(FuzzTarget.java:238)
    	at com.code_intelligence.jazzer.driver.FuzzTargetRunner.dumpReproducer(FuzzTargetRunner.java:341)
    	at com.code_intelligence.jazzer.driver.FuzzTargetRunner.runOne(FuzzTargetRunner.java:253)
    	at com.code_intelligence.jazzer.runtime.FuzzTargetRunnerNatives.startLibFuzzer(Native Method)
    	at com.code_intelligence.jazzer.driver.FuzzTargetRunner.startLibFuzzer(FuzzTargetRunner.java:409)
    	at com.code_intelligence.jazzer.driver.FuzzTargetRunner.startLibFuzzer(FuzzTargetRunner.java:282)
    	at com.code_intelligence.jazzer.driver.Driver.start(Driver.java:88)
    	at com.code_intelligence.jazzer.Jazzer.start(Jazzer.java:90)
    	at com.code_intelligence.jazzer.Jazzer.main(Jazzer.java:63)
    	at test.Fuzzer.main(Unknown Source)
    
    public class TestServer extends Thread {
    	@Override
    	public void run() {
    		start();
    	}
    
    	public void start(final byte[] out) {
    		try (var serverSocket = new ServerSocket()) {
    			serverSocket.bind(new InetSocketAddress(41525));
    			try (var client = serverSocket.accept(); var os = client.getOutputStream()) {
    				os.write(out);
    				os.flush();
    			}
    		} catch (final IOException e) {
    			e.printStackTrace();
    		}
    	}
    }
    
    opened by freedom1b2830 0
  • junit: Simplify and improve inputs directory discovery

    junit: Simplify and improve inputs directory discovery

    Inputs directory handling was confusing as e.g. Maven doesn't copy over empty resource directories by default. Instead of relying on that, always fall back to locating the inputs directory in the source tree and even try to create it if at least the test resources root is found.

    opened by fmeum 0
  • Add script engine injection sanitizer with real life example

    Add script engine injection sanitizer with real life example

    This merge request adds a sanitiser to detect data flows of user input into the javax.script.ScriptEngine#eval sink which often results in arbitrary code execution (CWE-94) using a registered scripting engine.

    JVM script engines (JSR-223 implementations) can be registered under multiple arbitrary names and they can implement any language (although ECMAScript is probably the most widely used one in real applications).

    This sanitizer implementation only confirms data flow, it does not require successful script execution with a registered script engine (similarly to how the OsCommandInjection sanitizer does not guide the fuzzer into running the actual command). As soon as an input produces an execution that reaches the evaluation of the “1+1” expression by a javax.script.ScriptEngine implementation, we report a finding.

    I have added a test that demonstrates the sanitizer by rediscovering the CVE-2022-42889 in Apache Commons Text using minimal assumptions of the library and the finding. (It does however limit the length of the input taken from the fuzzer and it adds a hook to avoid the ${const:…} interpolation which can be used to read public static members of any loadable class - not remotely as promising as the ${script:…} payload.)

    bazel clean && bazel run --local_cpu_resources=8 //examples:CommonsTextFuzzer
    ...
    INFO: Build completed successfully, 443 total actions
    exec ${PAGER:-/usr/bin/less} "$0" || exit 1
    Executing tests from //examples:CommonsTextFuzzer
    -----------------------------------------------------------------------------
    INFO: Loaded 125 hooks from com.code_intelligence.jazzer.runtime.TraceCmpHooks
    INFO: Loaded 4 hooks from com.code_intelligence.jazzer.runtime.TraceDivHooks
    INFO: Loaded 2 hooks from com.code_intelligence.jazzer.runtime.TraceIndirHooks
    INFO: Loaded 4 hooks from com.code_intelligence.jazzer.runtime.NativeLibHooks
    INFO: Loaded 1 hooks from com.example.CommonsTextFuzzerHooks
    INFO: Loaded 8 hooks from com.code_intelligence.jazzer.sanitizers.Deserialization
    INFO: Loaded 5 hooks from com.code_intelligence.jazzer.sanitizers.ExpressionLanguageInjection
    INFO: Loaded 70 hooks from com.code_intelligence.jazzer.sanitizers.LdapInjection
    INFO: Loaded 46 hooks from com.code_intelligence.jazzer.sanitizers.NamingContextLookup
    INFO: Loaded 1 hooks from com.code_intelligence.jazzer.sanitizers.OsCommandInjection
    INFO: Loaded 52 hooks from com.code_intelligence.jazzer.sanitizers.ReflectiveCall
    INFO: Loaded 8 hooks from com.code_intelligence.jazzer.sanitizers.RegexInjection
    INFO: Loaded 16 hooks from com.code_intelligence.jazzer.sanitizers.RegexRoadblocks
    INFO: Loaded 19 hooks from com.code_intelligence.jazzer.sanitizers.SqlInjection
    INFO: Loaded 5 hooks from com.code_intelligence.jazzer.sanitizers.ScriptEngineInjection
    INFO: Instrumented com.example.CommonsTextFuzzer (took 17 ms, size +10%)
    INFO: libFuzzer ignores flags that start with '--'
    INFO: Running with entropic power schedule (0xFF, 100).
    INFO: Seed: 3229358036
    INFO: Loaded 1 modules   (512 inline 8-bit counters): 512 [0x160278000, 0x160278200),
    INFO: Loaded 1 PC tables (512 PCs): 512 [0x15a660e00,0x15a662e00),
    INFO: -fork=8: fuzzing in separate process(s)
    INFO: -fork=8: 0 seed inputs, starting to fuzz in /var/folders/j7/bry6w71d1jl97rd7s3cy3yrm0000gn/T//libFuzzerTemp.FuzzWithFork68681.dir
    #24988: cov: 0 ft: 0 corp: 0 exec/s 12494 oom/timeout/crash: 0/0/0 time: 7s job: 1 dft_time: 0
    #73551: cov: 278 ft: 843 corp: 109 exec/s 16187 oom/timeout/crash: 0/0/0 time: 11s job: 2 dft_time: 0
    #177135: cov: 308 ft: 1068 corp: 241 exec/s 25896 oom/timeout/crash: 0/0/0 time: 13s job: 3 dft_time: 0
    #295530: cov: 338 ft: 1314 corp: 391 exec/s 23679 oom/timeout/crash: 0/0/0 time: 16s job: 4 dft_time: 0
    #464996: cov: 341 ft: 1365 corp: 436 exec/s 28244 oom/timeout/crash: 0/0/0 time: 19s job: 5 dft_time: 0
    #668737: cov: 415 ft: 1617 corp: 547 exec/s 29105 oom/timeout/crash: 0/0/0 time: 22s job: 6 dft_time: 0
    #895854: cov: 637 ft: 2369 corp: 625 exec/s 28389 oom/timeout/crash: 0/0/0 time: 26s job: 7 dft_time: 0
    ...
    #453559	REDUCE cov: 745 ft: 4257 corp: 1474/25Kb lim: 661 exec/s: 5335 rss: 924Mb L: 21/68 MS: 1 EraseBytes-
    Warning: Nashorn engine is planned to be removed from a future JDK release
    Warning: Nashorn engine is planned to be removed from a future JDK release
    #455106	REDUCE cov: 745 ft: 4257 corp: 1474/25Kb lim: 670 exec/s: 5354 rss: 924Mb L: 12/68 MS: 2 CopyPart-EraseBytes-
    #455172	REDUCE cov: 745 ft: 4257 corp: 1474/25Kb lim: 670 exec/s: 5354 rss: 924Mb L: 13/68 MS: 1 EraseBytes-
    Warning: Nashorn engine is planned to be removed from a future JDK release
    Warning: Nashorn engine is planned to be removed from a future JDK release
    #456349	REDUCE cov: 745 ft: 4257 corp: 1474/25Kb lim: 679 exec/s: 5368 rss: 924Mb L: 14/68 MS: 2 CopyPart-EraseBytes-
    #456545	REDUCE cov: 745 ft: 4257 corp: 1474/25Kb lim: 679 exec/s: 5371 rss: 924Mb L: 12/68 MS: 1 EraseBytes-
    Warning: Nashorn engine is planned to be removed from a future JDK release
    Warning: Nashorn engine is planned to be removed from a future JDK release
    
    == Java Exception: com.code_intelligence.jazzer.api.FuzzerSecurityIssueCritical: Possible script execution
    	at com.code_intelligence.jazzer.sanitizers.ScriptEngineInjection.checkScriptEngineExecute(ScriptEngineInjection.java:114)
    	at org.apache.commons.text.lookup.ScriptStringLookup.lookup(ScriptStringLookup.java:86)
    	at org.apache.commons.text.lookup.InterpolatorStringLookup.lookup(InterpolatorStringLookup.java:135)
    	at org.apache.commons.text.StringSubstitutor.resolveVariable(StringSubstitutor.java:1067)
    	at org.apache.commons.text.StringSubstitutor.substitute(StringSubstitutor.java:1433)
    	at org.apache.commons.text.StringSubstitutor.substitute(StringSubstitutor.java:1308)
    	at org.apache.commons.text.StringSubstitutor.replace(StringSubstitutor.java:816)
    	at com.example.CommonsTextFuzzer.fuzzerTestOneInput(CommonsTextFuzzer.java:24)
    DEDUP_TOKEN: f10483b167fba3d6
    == libFuzzer crashing input ==
    MS: 2 ChangeASCIIInt-CMP- DE: "1+1"-; base unit: 6931eff51adba2b80c902e62511ee20b7fe8b3ae
    0x24,0x7b,0x73,0x63,0x72,0x69,0x70,0x74,0x3a,0x6a,0x73,0x3a,0x31,0x2b,0x31,0x7d,0x4,0xe7,
    ${script:js:1+1}\004\347
    artifact_prefix='/private/var/tmp/_bazel_gyorgydemarcsek/071a3ae2fb95e15eb05d82d6a2a2dd28/execroot/jazzer/bazel-out/darwin_arm64-opt/testlogs/examples/CommonsTextFuzzer/test.outputs/'; Test unit written to /private/var/tmp/_bazel_gyorgydemarcsek/071a3ae2fb95e15eb05d82d6a2a2dd28/execroot/jazzer/bazel-out/darwin_arm64-opt/testlogs/examples/CommonsTextFuzzer/test.outputs/crash-7b8a90d41dff830e912476dbe9304d2b56e9235e
    Base64: JHtzY3JpcHQ6anM6MSsxfQTn
    stat::number_of_executed_units: 456787
    stat::average_exec_per_sec:     5373
    stat::new_units_added:          3165
    stat::slowest_unit_time_sec:    0
    stat::peak_rss_mb:              924
    Warning: Nashorn engine is planned to be removed from a future JDK release
    reproducer_path='/private/var/tmp/_bazel_gyorgydemarcsek/071a3ae2fb95e15eb05d82d6a2a2dd28/execroot/jazzer/bazel-out/darwin_arm64-opt/testlogs/examples/CommonsTextFuzzer/test.outputs'; Java reproducer written to /private/var/tmp/_bazel_gyorgydemarcsek/071a3ae2fb95e15eb05d82d6a2a2dd28/execroot/jazzer/bazel-out/darwin_arm64-opt/testlogs/examples/CommonsTextFuzzer/test.outputs/Crash_7b8a90d41dff830e912476dbe9304d2b56e9235e.java
    INFO: exiting: 19712 time: 2686s
    

    I have managed to reproduce this a couple of times in reasonable running times on a laptop.

    opened by gdemarcsek 0
Releases(v0.14.0)
  • v0.14.0(Jan 3, 2023)

    What's Changed

    • Major feature: The fuzzing mode of @FuzzTests is now implemented within JUnit Jupiter and thus supports lifecycle hooks (https://github.com/CodeIntelligenceTesting/jazzer/pull/556)
    • Major feature: Kotlin string comparison functions are instrumented (https://github.com/CodeIntelligenceTesting/jazzer/pull/566)
    • Bugfix: Correctly emit finding inputs generated by @FuzzTest on Windows (https://github.com/CodeIntelligenceTesting/jazzer/pull/578)
    • Bugfix: @FuzzTests no longer interfere with regular unit tests in certain edge cases (https://github.com/CodeIntelligenceTesting/jazzer/pull/575)
    • junit: Inputs are sorted by path (https://github.com/CodeIntelligenceTesting/jazzer/pull/562)
    • docker: Updated to OpenJDK 17 (https://github.com/CodeIntelligenceTesting/jazzer/pull/559)
    • docs: Added CONTRIBUTING.md and restructured docs (https://github.com/CodeIntelligenceTesting/jazzer/pull/549, https://github.com/CodeIntelligenceTesting/jazzer/pull/553, https://github.com/CodeIntelligenceTesting/jazzer/pull/551, https://github.com/CodeIntelligenceTesting/jazzer/pull/550, https://github.com/CodeIntelligenceTesting/jazzer/pull/560)

    Full Changelog: https://github.com/CodeIntelligenceTesting/jazzer/compare/v0.13.3...v0.14.0

    Source code(tar.gz)
    Source code(zip)
    jazzer-linux.tar.gz(8.71 MB)
    jazzer-macos.tar.gz(8.42 MB)
    jazzer-windows.tar.gz(8.53 MB)
  • v0.13.3(Dec 8, 2022)

  • v0.13.2(Dec 2, 2022)

    What's Changed

    • driver: Make jazzer_standalone.jar executable without the launcher (https://github.com/CodeIntelligenceTesting/jazzer/pull/537)
    • Add support for JDK 19 (https://github.com/CodeIntelligenceTesting/jazzer/pull/541)
    • junit: Tag Jazzer test engine tests with "jazzer" (https://github.com/CodeIntelligenceTesting/jazzer/pull/540)

    Full Changelog: https://github.com/CodeIntelligenceTesting/jazzer/compare/v0.13.1...v0.13.2

    Source code(tar.gz)
    Source code(zip)
    jazzer-linux.tar.gz(8.67 MB)
    jazzer-macos-arm64.tar.gz(8.12 MB)
    jazzer-macos-x86_64.tar.gz(8.12 MB)
    jazzer-windows.tar.gz(8.49 MB)
  • v0.13.1(Nov 24, 2022)

    What's Changed

    • autofuzz: Fix exclusion of Jazzer-internal classes (https://github.com/CodeIntelligenceTesting/jazzer/pull/528)
    • deps: Update rules_jvm_external to preserve directories in JARs (https://github.com/CodeIntelligenceTesting/jazzer/pull/532)
    • Fix sanitizers not being loaded with jazzer_standalone_deploy.jar (https://github.com/CodeIntelligenceTesting/jazzer/pull/533)

    Full Changelog: https://github.com/CodeIntelligenceTesting/jazzer/compare/v0.13.0...v0.13.1

    Source code(tar.gz)
    Source code(zip)
    jazzer-linux.tar.gz(8.67 MB)
    jazzer-macos-arm64.tar.gz(8.12 MB)
    jazzer-macos-x86_64.tar.gz(8.12 MB)
    jazzer-windows.tar.gz(8.49 MB)
  • v0.13.0(Oct 25, 2022)

    What's Changed

    • Breaking change: A JUnit @FuzzTest now runs on inputs in a ClassNameInputs rather than a ClassNameSeedCorpus directory.
    • Breaking change: Removed the seedCorpus attribute from @FuzzTest. Following the ClassNameInputs convention allows for better integration with the fuzzer.
    • Breaking change: --autofuzz no longer enables --keep_going by default, but instead prints suggestions on how to skip uninteresting findings.
    • Major feature: JUnit @FuzzTests can now take any parameters and will use Autofuzz if not using the standard byte[] or FuzzedDataProvider signatures (https://github.com/CodeIntelligenceTesting/jazzer/pull/476)
    • Major feature: Jazzer is now available as a jar, using the native launcher is no longer required. (https://github.com/CodeIntelligenceTesting/jazzer/pull/492)
    • Major feature: Jazzer now supports native library fuzzing with release builds. See Fuzzing with Native Libraries. (https://github.com/CodeIntelligenceTesting/jazzer/pull/500)
    • junit: Do not leak fuzzer startup into first seed test (https://github.com/CodeIntelligenceTesting/jazzer/pull/491)
    • junit: Fixed Windows failure when running with corpus (https://github.com/CodeIntelligenceTesting/jazzer/pull/467)
    • Fixed Java reproducer not compiling when referencing non-visible superclasses or interfaces (https://github.com/CodeIntelligenceTesting/jazzer/pull/471)
    • Fixed DEDUP_TOKEN and --ignore behavior (https://github.com/CodeIntelligenceTesting/jazzer/pull/472)
    • Fixed JaCoCo coverage measurements (https://github.com/CodeIntelligenceTesting/jazzer/pull/479)
    • Improved fuzz test class not found error message (https://github.com/CodeIntelligenceTesting/jazzer/pull/481)
    • Cleaned up stack traces (https://github.com/CodeIntelligenceTesting/jazzer/pull/485)
    • Added docs and source JAR for jazzer-junit (https://github.com/CodeIntelligenceTesting/jazzer/pull/477)
    • Ignore regex pattern syntax exceptions caused by stack overflows (https://github.com/CodeIntelligenceTesting/jazzer/pull/488)
    • Added --version flag (https://github.com/CodeIntelligenceTesting/jazzer/pull/502)
    • Improved @FuzzTest docs and increased default duration (https://github.com/CodeIntelligenceTesting/jazzer/pull/509)
    • Improved jar stripping to fix various packaging issues (https://github.com/CodeIntelligenceTesting/jazzer/pull/515)

    Full Changelog: https://github.com/CodeIntelligenceTesting/jazzer/compare/v0.12.0...v0.13.0

    Source code(tar.gz)
    Source code(zip)
    jazzer-linux.tar.gz(8.67 MB)
    jazzer-macos-arm64.tar.gz(8.11 MB)
    jazzer-macos-x86_64.tar.gz(8.12 MB)
    jazzer-windows.tar.gz(8.49 MB)
  • v0.12.0(Aug 30, 2022)

    What's Changed

    • Breaking change: Autofuzz API methods (consume and autofuzz) have moved from the Jazzer class to the dedicated Autofuzz class
    • Major feature: Added JUnit 5 integration for fuzzing and regression tests using the @FuzzTest annotation (available as com.code-intelligence:jazzer-junit)
    • Feature: Added sanitizer for SQL injections
    • Feature: Hooks can be selectively disabled by specifying their full class name using the new --disabled_hooks flag
    • Fix: Remove memory leaks in native code
    • Fix: Don't instrument internal Azul JDK classes
    • Fix: Classes with local variable annotations are now instrumented without errors

    This release also includes smaller improvements and bugfixes, as well as a major refactoring and Java rewrite of native components.

    New Contributors

    • @vargen made their first contribution in https://github.com/CodeIntelligenceTesting/jazzer/pull/416
    • @henryrneh made their first contribution in https://github.com/CodeIntelligenceTesting/jazzer/pull/439

    Full Changelog: https://github.com/CodeIntelligenceTesting/jazzer/compare/v0.11.0...v0.12.0

    Source code(tar.gz)
    Source code(zip)
    jazzer-api.jar(24.07 KB)
    jazzer-junit.jar(9.93 MB)
    jazzer-linux-x86_64.tar.gz(8.53 MB)
    jazzer-macos-arm64.tar.gz(7.96 MB)
    jazzer-macos-x86_64.tar.gz(7.98 MB)
    jazzer-windows-x86_64.tar.gz(8.37 MB)
  • v0.11.0(Apr 28, 2022)

    • Feature: Add sanitizer for context lookups
    • Feature: Add sanitizer for OS command injection
    • Feature: Add sanitizer for regex injection
    • Feature: Add sanitizer for LDAP injections
    • Feature: Add sanitizer for arbitrary class loading
    • Feature: Guide fuzzer to generate proper map lookups keys
    • Feature: Generate standalone Java reproducers for autofuzz
    • Feature: Hooks targeting interfaces and abstract classes hook all implementations
    • Feature: Enable multiple BEFORE and AFTER hooks for the same target
    • Feature: Greatly improve performance of coverage instrumentation
    • Feature: Improve performance of interactions between Jazzer and libFuzzer
    • Feature: Export JaCoCo coverage dump using --coverage_dump flag
    • Feature: Honor JAVA_OPTS
    • API: Add exploreState to help the fuzzer maximize state coverage
    • API: Provide additionalClassesToHook field in MethodHook annotation to hook dependent classes
    • Fix: Synchronize coverage ID generation
    • Fix: Support REPLACE hooks for constructors
    • Fix: Do not apply REPLACE hooks in Java 6 class files

    This release also includes smaller improvements and bugfixes.

    Source code(tar.gz)
    Source code(zip)
    jazzer-0.11.0.tar.gz(199.82 KB)
    jazzer-api-0.11.0.jar(20.23 KB)
    jazzer-linux-0.11.0.tar.gz(5.92 MB)
    jazzer-macos-0.11.0.tar.gz(5.57 MB)
    jazzer-windows-0.11.0.tar.gz(5.72 MB)
  • v0.10.0(Oct 21, 2021)

  • v0.9.1(Mar 10, 2021)

    • Breaking change: The static fuzzerTestOneInput method in a fuzz target now has to return void instead of boolean. Fuzz targets that previously returned true should now throw an exception or use assert.
    • Fixed: jazzer wrapper can find jazzer_driver even if not in the working directory
    • Fixed: Switch instrumentation no longer causes an out-of-bounds read in the driver
    • Feature: assert can be used in fuzz targets
    • Feature: Coverage is now collision-free and more fine-grained (based on JaCoCo)
    • API: Added pickValue(Collection c) and consumeChar(char min, char max) to FuzzedDataProvider
    • API: Added FuzzerSecurityIssue* exceptions to allow specifiying the severity of findings
    Source code(tar.gz)
    Source code(zip)
    examples_deploy.jar(3.28 MB)
    jazzer_release.tar.gz(5.48 MB)
Inspect pmap -X output of a java process, requires Java11, likely not 100% accurate

java-pmap-inspector Inspect pmap -X output of a java process, requires Java 11, likely not 100% accurate. Usage examples $ pmap -X pid > pmap.txt; jav

Brice Dutheil 7 Jul 6, 2022
Tools for tracking down memory / JVM problems & generating predictable-as-possible VM behaviour

Hawkshaw Tools for tracking down memory / JVM problems & generating predictable-as-possible VM behaviour You can Use Hawkshaw to mimic application obj

Martijn Verburg 40 Jan 9, 2021
production heap profiling for the JVM. compatible with google-perftools.

Heapster Heapster provides an agent library to do heap profiling for JVM processes with output compatible with Google perftools. The goal of Heapster

marius a. eriksen 392 Dec 27, 2022
JVM Profiler Sending Metrics to Kafka, Console Output or Custom Reporter

Uber JVM Profiler Uber JVM Profiler provides a Java Agent to collect various metrics and stacktraces for Hadoop/Spark JVM processes in a distributed w

Uber Common 1.7k Dec 22, 2022
Simple JVM Profiler Using StatsD and Other Metrics Backends

statsd-jvm-profiler statsd-jvm-profiler is a JVM agent profiler that sends profiling data to StatsD. Inspired by riemann-jvm-profiler, it was primaril

Etsy, Inc. 330 Oct 30, 2022
Small set of tools for JVM troublshooting, monitoring and profiling.

Swiss Java Knife (SJK) SJK is a command line tool for JVM diagnostic, troubleshooting and profiling. SJK exploits standard diagnostic interfaces of JV

Alexey Ragozin 3.2k Jan 3, 2023
A driver to allow deep interaction with the JVM without any restrictions

ToolFactory JVM Driver A driver to allow deep interaction with the JVM without any restrictions. To include ToolFactory JVM Driver in your projects si

ToolFactory 34 Oct 8, 2022
Kotlin-decompiled - (Almost) every single language construct of the Kotlin programming language compiled to JVM bytecode and then decompiled to Java again for better readability

Kotlin: Decompiled (Almost) every single language construct of the Kotlin programming language compiled to JVM bytecode and then decompiled to Java ag

The Self-Taught Software Engineer 27 Dec 14, 2022
Dynamic loading and compiling project based on JVM

camphor 基于jvm的弹性加载及编译中间件(Elastic loading and compiling middleware based on JVM) camphor_0.0.1 项目简介 该项目定位为弹性中间件,能够使系统在不重启的情况下完成增量代码文件的动态编译和加载 模块介绍 camp

palading 1 Jan 22, 2022
JavaOTTF - Official OTTF parser and composer for JVM languages

JavaOTTF Official OTTF parser and composer for JVM languages. Documentation Please refer to the Wiki Section. Installation Maven Add repository into p

Open Timetable 2 Nov 21, 2022
chardetng for the JVM

chardetng_j This is chardetng compiled for the JVM using asmble. Licensing Please see the file named COPYRIGHT. TL;DR: Apache-2.0 OR MIT Disclaimer Th

Henri Sivonen 1 Oct 18, 2021
JVM Explorer is a Java desktop application for browsing loaded class files inside locally running Java Virtual Machines.

JVM Explorer JVM Explorer is a Java desktop application for browsing loaded class files inside locally running Java Virtual Machines. Features Browse

null 109 Nov 30, 2022
BTrace - a safe, dynamic tracing tool for the Java platform

btrace A safe, dynamic tracing tool for the Java platform Version 2.1.0 Quick Summary BTrace is a safe, dynamic tracing tool for the Java platform. BT

btrace.io 5.3k Jan 9, 2023
Statistical Machine Intelligence & Learning Engine

Smile Smile (Statistical Machine Intelligence and Learning Engine) is a fast and comprehensive machine learning, NLP, linear algebra, graph, interpola

Haifeng Li 5.7k Jan 1, 2023
HUAWEI 3D Modeling Kit project contains a sample app. Guided by this demo, you will be able to implement full 3D Modeling Kit capabilities, including 3D object reconstruction and material generation.

HUAWEI 3D Modeling Kit Sample English | 中文 Introduction This project includes apps developed based on HUAWEI 3D Modeling Kit. The project directory is

HMS 59 Jan 1, 2023
:microscope: Java Code Coverage Library

JaCoCo Java Code Coverage Library JaCoCo is a free Java code coverage library distributed under the Eclipse Public License. Check the project homepage

Java Code Coverage Tools 3.5k Dec 28, 2022
Advanced Java library for integration testing, mocking, faking, and code coverage

Codebase for JMockit 1.x releases - Documentation - Release notes How to build the project: use JDK 1.8 or newer use Maven 3.6.0 or newer; the followi

The JMockit Testing Toolkit 439 Dec 9, 2022
Auto-Unit-Test-Case-Generator automatically generates high-level code-coverage JUnit test suites for Java, widely used within the ANT Group.

中文README传送门 What is Auto-Unit-Test-Case-Generator Auto-Unit-Test-Case-Generator generates JUnit test suites for Java class just as its name. During te

TRaaS 108 Dec 22, 2022
Kyrestia, named after Kyrestia the Firstborne, is a process engine supporting mainstream process definition standards.

Kyrestia Kyrestia, named after Kyrestia the Firstborne, is a process engine supporting mainstream process definition standards. It is not only lightwe

Weiran Wu 32 Feb 22, 2022