Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the fuzzing #27

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions fuzzing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ endif()
# project information
project(Fuzzer
VERSION 1.0
DESCRIPTION "Contract parser of Boilerplate plugin app"
DESCRIPTION "Contract parser of Lisk plugin app"
LANGUAGES C)

# guard against bad build-type strings
Expand Down Expand Up @@ -51,7 +51,7 @@ set(SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../src")
set(ETH_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../ethereum-plugin-sdk")

add_compile_definitions(
APPNAME="PluginBoilerplate"
APPNAME="Lisk"
hrmhatef marked this conversation as resolved.
Show resolved Hide resolved
)

add_compile_definitions(
Expand Down
6 changes: 3 additions & 3 deletions fuzzing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Fuzzing allows us to test how a program behaves when provided with invalid, unexpected, or random data as input.

In the case of `app-plugin-boilerplate` we want to test the code that is responsible for handling the contract data.
In the case of `lisk-app-plugin` we want to test the code that is responsible for handling the contract data.
The fuzzer needs to implement `int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)`, which provides an array of random bytes that can be used to simulate a serialized transaction.
If the application crashes, or a [sanitizer](https://github.com/google/sanitizers) detects any kind of access violation, the fuzzing process is stopped, a report regarding the vulnerability is shown, and the input that triggered the bug is written to disk under the name `crash-*`. The vulnerable input file created can be passed as an argument to the fuzzer to triage the issue.

Expand Down Expand Up @@ -70,13 +70,13 @@ The principle is to build the container, and run it to perform the fuzzing.
# Prepare directory tree
mkdir fuzzing/{corpus,out}
# Container generation
docker build -t app-plugin-boilerplate --file .clusterfuzzlite/Dockerfile .
docker build -t lisk-app-plugin --file .clusterfuzzlite/Dockerfile .
```

### Compilation

```console
docker run --rm --privileged -e FUZZING_LANGUAGE=c -v "$(realpath .)/fuzzing/out:/out" -ti app-plugin-boilerplate
docker run --rm --privileged -e FUZZING_LANGUAGE=c -v "$(realpath .)/fuzzing/out:/out" -ti lisk-app-plugin
```

### Run
Expand Down
Loading