6b64a6b331
This PR fixes 3 false positive issues in https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=64623, https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=64625 and https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=64634 which accidentally loops a very large byte array for too many times. In `GuavaSerailizerFuzzer` case 11. The logic uses a combination of `Iterables.cycle(T...)` and `Iterables.limit(Iterable, int)` to create an iterator for the fuzzing process. But there is a bug in the creation causing OOM. In Java, the generic type application is only possible for non-primitive type. For example, if the following code is run, the result is 2 and `elements[0] = 1` and `elements[1] = 2` inside `genericTest(T...)` because the generic type retrieves the Integer type successfully and `T` is treated as `Integer`. ```java public class Test { public static void main (String[] args) { Integer[] test = {1, 2}; genericTest(test); } public static <T> T genericTest(T...elements) { System.out.println(elements.length); } } ``` But if the code changes to use a primitive type array instead like the following, the result is 2 and `elements[0][0] = 1` and `elements[0][1] = 2` inside `genericTest(T...)` because the generic type fails to convert the primitive type and thus it treats `T` as `int[]`. ```java public class Test { public static void main (String[] args) { int[] test = {1, 2}; genericTest(test); } public static <T> T genericTest(T...elements) { System.out.println(elements.length); } } ``` Because of the above reason, the original code in `GuavaSerializerFuzzer` shown below provides a `byte[]` to the `Iterables.cycle(T...)` method. Thus the later `Iterables.limit(Iterable, int)` is looping through the whole byte[] for limit time, instead of looping the byte elements in the byte[]. It results in OOM in some issues when the `data.consumeRemainingAsBytes()` returns a very large byte array (e.g. 10k bytes). Instead of looping each byte in the byte array, it actually loops the whole byte array as a single object for 10k times which uses up the heap memory and causes OOM. ```java Iterables.limit(Iterables.cycle(data.consumeRemainingAsBytes()), remainingBytes)) ``` This PR fixes the problem by using the `Bytes.asList()` to retrieve the correct iterable objects for the fuzzing. Signed-off-by: Arthur Chan <arthur.chan@adalogics.com> |
||
---|---|---|
.allstar | ||
.clusterfuzzlite | ||
.github | ||
docs | ||
infra | ||
projects | ||
tools/vscode-extension | ||
.dockerignore | ||
.gitattributes | ||
.gitignore | ||
.pylintrc | ||
.style.yapf | ||
CONTRIBUTING.md | ||
LICENSE | ||
README.md |
README.md
OSS-Fuzz: Continuous Fuzzing for Open Source Software
Fuzz testing is a well-known technique for uncovering programming errors in software. Many of these detectable errors, like buffer overflow, can have serious security implications. Google has found thousands of security vulnerabilities and stability bugs by deploying guided in-process fuzzing of Chrome components, and we now want to share that service with the open source community.
In cooperation with the Core Infrastructure Initiative and the OpenSSF, OSS-Fuzz aims to make common open source software more secure and stable by combining modern fuzzing techniques with scalable, distributed execution. Projects that do not qualify for OSS-Fuzz (e.g. closed source) can run their own instances of ClusterFuzz or ClusterFuzzLite.
We support the libFuzzer, AFL++, and Honggfuzz fuzzing engines in combination with Sanitizers, as well as ClusterFuzz, a distributed fuzzer execution environment and reporting tool.
Currently, OSS-Fuzz supports C/C++, Rust, Go, Python, Java/JVM, and JavaScript code. Other languages supported by LLVM may work too. OSS-Fuzz supports fuzzing x86_64 and i386 builds.
Overview
Documentation
Read our detailed documentation to learn how to use OSS-Fuzz.
Trophies
As of August 2023, OSS-Fuzz has helped identify and fix over 10,000 vulnerabilities and 36,000 bugs across 1,000 projects.
Blog posts
- 2023-08-16 - AI-Powered Fuzzing: Breaking the Bug Hunting Barrier
- 2023-02-01 - Taking the next step: OSS-Fuzz in 2023
- 2022-09-08 - Fuzzing beyond memory corruption: Finding broader classes of vulnerabilities automatically
- 2021-12-16 - Improving OSS-Fuzz and Jazzer to catch Log4Shell
- 2021-03-10 - Fuzzing Java in OSS-Fuzz
- 2020-12-07 - Improving open source security during the Google summer internship program
- 2020-10-09 - Fuzzing internships for Open Source Software
- 2018-11-06 - A New Chapter for OSS-Fuzz
- 2017-05-08 - OSS-Fuzz: Five months later, and rewarding projects
- 2016-12-01 - Announcing OSS-Fuzz: Continuous fuzzing for open source software