|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| .github/ | H | 25-Apr-2025 | - | 250 | 197 |
| bazel/ | H | 25-Apr-2025 | - | 917 | 779 |
| deploy/ | H | 25-Apr-2025 | - | 430 | 314 |
| docker/ | H | 25-Apr-2025 | - | 139 | 76 |
| docs/ | H | 25-Apr-2025 | - | 384 | 279 |
| examples/ | H | 25-Apr-2025 | - | 3,887 | 2,551 |
| launcher/ | H | 25-Apr-2025 | - | 910 | 621 |
| sanitizers/ | H | 25-Apr-2025 | - | 3,501 | 2,298 |
| src/ | H | 25-Apr-2025 | - | 39,692 | 27,293 |
| tests/ | H | 25-Apr-2025 | - | 1,981 | 1,180 |
| third_party/ | H | 25-Apr-2025 | - | 749 | 671 |
| .bazelignore | H A D | 25-Apr-2025 | 22 | 2 | 1 |
| .bazelrc | H A D | 25-Apr-2025 | 4.5 KiB | 109 | 95 |
| .bazelversion | H A D | 25-Apr-2025 | 41 | 2 | 1 |
| .clang-format | H A D | 25-Apr-2025 | 123 | 9 | 8 |
| .gitignore | H A D | 25-Apr-2025 | 31 | 5 | 4 |
| Android.bp | H A D | 25-Apr-2025 | 2.1 KiB | 65 | 60 |
| BUILD.bazel | H A D | 25-Apr-2025 | 2 KiB | 82 | 72 |
| CHANGELOG.md | H A D | 25-Apr-2025 | 4.3 KiB | 80 | 65 |
| CONTRIBUTING.md | H A D | 25-Apr-2025 | 4.5 KiB | 95 | 67 |
| JazzerSetup.java | H A D | 25-Apr-2025 | 130 | 6 | 6 |
| LICENSE | H A D | 25-Apr-2025 | 11.1 KiB | 202 | 169 |
| METADATA | H A D | 25-Apr-2025 | 484 | 19 | 17 |
| MODULE_LICENSE_APACHE2 | HD | 25-Apr-2025 | 0 | | |
| OWNERS | H A D | 25-Apr-2025 | 78 | 5 | 4 |
| README.md | H A D | 25-Apr-2025 | 8.7 KiB | 167 | 123 |
| WORKSPACE.bazel | H A D | 25-Apr-2025 | 10.1 KiB | 301 | 241 |
| format.sh | H A D | 25-Apr-2025 | 1.7 KiB | 41 | 11 |
| init.bzl | H A D | 25-Apr-2025 | 1.4 KiB | 32 | 28 |
| jazzer_setup.sh | H A D | 25-Apr-2025 | 184 | 7 | 3 |
| maven.bzl | H A D | 25-Apr-2025 | 3.1 KiB | 67 | 63 |
| maven_install.json | H A D | 25-Apr-2025 | 77.3 KiB | 2,136 | 2,135 |
| platform_mappings | H A D | 25-Apr-2025 | 271 | 9 | 7 |
| repositories.bzl | H A D | 25-Apr-2025 | 8 KiB | 195 | 171 |
README.md
1<div align="center">
2 <a href="https://code-intelligence.com"><img src="https://www.code-intelligence.com/hubfs/Logos/CI%20Logos/Jazzer_einfach.png" height=150px alt="Jazzer by Code Intelligence">
3</a>
4 <h1>Jazzer</h1>
5 <p>Fuzz Testing for the JVM</p>
6 <a href="https://github.com/CodeIntelligenceTesting/jazzer/releases">
7 <img src="https://img.shields.io/github/v/release/CodeIntelligenceTesting/jazzer" alt="Releases">
8 </a>
9 <a href="https://search.maven.org/search?q=g:com.code-intelligence%20a:jazzer">
10 <img src="https://img.shields.io/maven-central/v/com.code-intelligence/jazzer" alt="Maven Central">
11 </a>
12 <a href="https://github.com/CodeIntelligenceTesting/jazzer/actions/workflows/run-all-tests.yml?query=branch%3Amain">
13 <img src="https://img.shields.io/github/actions/workflow/status/CodeIntelligenceTesting/jazzer/run-all-tests.yml?branch=main&logo=github" alt="CI status">
14 </a>
15 <a href="https://github.com/CodeIntelligenceTesting/jazzer/blob/main/LICENSE">
16 <img src="https://img.shields.io/github/license/CodeIntelligenceTesting/jazzer" alt="License">
17 </a>
18 <a href="https://github.com/CodeIntelligenceTesting/jazzer/blob/main/CONTRIBUTING.md">
19 <img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs welcome" />
20 </a>
21
22 <br />
23
24<a href="https://www.code-intelligence.com/" target="_blank">Website</a>
25|
26<a href="https://www.code-intelligence.com/blog" target="_blank">Blog</a>
27|
28<a href="https://twitter.com/CI_Fuzz" target="_blank">Twitter</a>
29</div>
30
31Jazzer is a coverage-guided, in-process fuzzer for the JVM platform developed by [Code Intelligence](https://code-intelligence.com).
32It is based on [libFuzzer](https://llvm.org/docs/LibFuzzer.html) and brings many of its instrumentation-powered mutation features to the JVM.
33
34Jazzer currently supports the following platforms:
35* Linux x86_64
36* macOS 12+ x86_64 & arm64
37* Windows x86_64
38
39## Quick start
40
41You can use Docker to try out Jazzer's Autofuzz mode, in which it automatically generates arguments to a given Java function and reports unexpected exceptions and detected security issues:
42
43```
44docker run -it cifuzz/jazzer-autofuzz \
45 com.mikesamuel:json-sanitizer:1.2.0 \
46 com.google.json.JsonSanitizer::sanitize \
47 --autofuzz_ignore=java.lang.ArrayIndexOutOfBoundsException
48```
49
50Here, the first two arguments are the Maven coordinates of the Java library and the fully qualified name of the Java function to be fuzzed in "method reference" form.
51The optional `--autofuzz_ignore` flag takes a list of uncaught exception classes to ignore.
52
53After a few seconds, Jazzer should trigger an `AssertionError`, reproducing a bug it found in this library that has since been fixed.
54
55## Using Jazzer via...
56
57### JUnit 5
58
59The following steps assume that JUnit 5 is set up for your project, for example based on the official [junit5-samples](https://github.com/junit-team/junit5-samples).
60
611. Add a dependency on `com.code-intelligence:jazzer-junit:<latest version>`.
62 All Jazzer Maven artifacts are signed with [this key](deploy/maven.pub).
632. Add a new *fuzz test* to a new or existing test class: a method annotated with [`@FuzzTest`](https://codeintelligencetesting.github.io/jazzer-docs/jazzer-junit/com/code_intelligence/jazzer/junit/FuzzTest.html) and at least one parameter.
64 Using a single parameter of type [`FuzzedDataProvider`](https://codeintelligencetesting.github.io/jazzer-docs/jazzer-api/com/code_intelligence/jazzer/api/FuzzedDataProvider.html), which provides utility functions to produce commonly used Java values, or `byte[]` is recommended for optimal performance and reproducibility of findings.
653. Assuming your test class is called `com.example.MyFuzzTests`, create the *inputs directory* `src/test/resources/com/example/MyFuzzTestsInputs`.
664. Run a fuzz test with the environment variable `JAZZER_FUZZ` set to `1` to let the fuzzer rapidly try new sets of arguments.
67 If the fuzzer finds arguments that make your fuzz test fail or even trigger a security issue, it will store them in the inputs directory.
685. Run the fuzz test without `JAZZER_FUZZ` set to execute it only on the inputs in the inputs directory.
69 This mode, which behaves just like a traditional unit test, ensures that issues previously found by the fuzzer remain fixed and can also be used to debug the fuzz test on individual inputs.
70
71A simple property-based fuzz test could look like this (excluding imports):
72
73```java
74class ParserTests {
75 @Test
76 void unitTest() {
77 assertEquals("foobar", SomeScheme.decode(SomeScheme.encode("foobar")));
78 }
79
80 @FuzzTest
81 void fuzzTest(FuzzedDataProvider data) {
82 String input = data.consumeRemainingAsString();
83 assertEquals(input, SomeScheme.decode(SomeScheme.encode(input)));
84 }
85}
86```
87
88A complete Maven example project can be found in [`examples/junit`](examples/junit).
89
90### CI Fuzz
91
92The open-source CLI tool [cifuzz](https://github.com/CodeIntelligenceTesting/cifuzz) makes
93it easy to set up Maven and Gradle projects for fuzzing with Jazzer.
94It provides a command-line UI for fuzzing runs, deduplicates and manages findings, and
95provides coverage reports for fuzz tests. Moreover, you can use CI Fuzz to run your fuzz
96tests at scale in the [CI App](https://app.code-intelligence.com).
97
98### GitHub releases
99
100You can also use GitHub release archives to run a standalone Jazzer binary that starts its own JVM configured for fuzzing:
101
1021. Download and extract the latest release from the [GitHub releases page](https://github.com/CodeIntelligenceTesting/jazzer/releases).
1032. Add a new class to your project with a <code>public static void fuzzerTestOneInput(<a href="https://codeintelligencetesting.github.io/jazzer-docs/jazzer-api/com/code_intelligence/jazzer/api/FuzzedDataProvider.html">FuzzedDataProvider</a> data)</code> method.
1043. Compile your fuzz test with `jazzer_standalone.jar` on the classpath.
1054. Run the `jazzer` binary (`jazzer.exe` on Windows), specifying the classpath and fuzz test class:
106
107```shell
108./jazzer --cp=<classpath> --target_class=<fuzz test class>
109```
110
111If you see an error saying that `libjvm.so` has not been found, make sure that `JAVA_HOME` points to a JDK.
112
113The [`examples`](examples/src/main/java/com/example) directory includes both toy and real-world examples of fuzz tests.
114
115### Docker
116
117The "distroless" Docker image [cifuzz/jazzer](https://hub.docker.com/r/cifuzz/jazzer) includes a recent Jazzer release together with OpenJDK 17.
118Mount a directory containing your compiled fuzz target into the container under `/fuzzing` and use it like a GitHub release binary by running:
119
120```sh
121docker run -v path/containing/the/application:/fuzzing cifuzz/jazzer --cp=<classpath> --target_class=<fuzz test class>
122```
123
124If Jazzer produces a finding, the input that triggered it will be available in the same directory.
125
126### Bazel
127
128Support for Jazzer is available in [rules_fuzzing](https://github.com/bazelbuild/rules_fuzzing), the official Bazel rules for fuzzing.
129See [the README](https://github.com/bazelbuild/rules_fuzzing#java-fuzzing) for instructions on how to use Jazzer in a Java Bazel project.
130
131### OSS-Fuzz
132
133[Code Intelligence](https://code-intelligence.com) and Google have teamed up to bring support for Java, Kotlin, and other JVM-based languages to [OSS-Fuzz](https://github.com/google/oss-fuzz), Google's project for large-scale fuzzing of open-souce software.
134Read [the OSS-Fuzz guide](https://google.github.io/oss-fuzz/getting-started/new-project-guide/jvm-lang/) to learn how to set up a Java project.
135
136## Further documentation
137
138* [Common options and workflows](docs/common.md)
139* [Advanced techniques](docs/advanced.md)
140
141## Findings
142
143A list of security issues and bugs found by Jazzer is maintained [here](docs/findings.md).
144If you found something interesting and the information is public, please send a PR to add it to the list.
145
146## Credit
147
148The following developers have contributed to Jazzer before its public release:
149
150[Sergej Dechand](https://github.com/serj),
151[Christian Hartlage](https://github.com/dende),
152[Fabian Meumertzheim](https://github.com/fmeum),
153[Sebastian Pöplau](https://github.com/sebastianpoeplau),
154[Mohammed Qasem](https://github.com/mohqas),
155[Simon Resch](https://github.com/simonresch),
156[Henrik Schnor](https://github.com/henrikschnor),
157[Khaled Yakdan](https://github.com/kyakdan)
158
159The LLVM-style edge coverage instrumentation for JVM bytecode used by Jazzer relies on [JaCoCo](https://github.com/jacoco/jacoco).
160Previously, Jazzer used AFL-style coverage instrumentation as pioneered by [kelinci](https://github.com/isstac/kelinci).
161
162<p align="center">
163<a href="https://www.code-intelligence.com"><img src="https://www.code-intelligence.com/hubfs/Logos/CI%20Logos/CI_Header_GitHub_quer.jpeg" height=50px alt="Code Intelligence logo"></a>
164</p>
165
166[`FuzzedDataProvider`]: https://codeintelligencetesting.github.io/jazzer-docs/jazzer-api/com/code_intelligence/jazzer/api/FuzzedDataProvider.html
167