-
Notifications
You must be signed in to change notification settings - Fork 28
Add Absolution-based stateful fuzzing framework #1585
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
502c5ae
fuzzing: add Absolution-based stateful fuzzing framework
N3ur0sis fae7a97
lib_cxng: fix signed-int shift UB in reverse_32_bits
N3ur0sis d96f498
lib_cxng: avoid NULL memcpy in cx_sha256_update on empty input
N3ur0sis 2a1580d
lib_tlv: avoid NULL strnlen/memcpy when TLV value is empty
N3ur0sis 338b423
lib_standard_app: avoid NULL memcpy in send_swap_error_with_buffers
N3ur0sis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,12 @@ | ||
| # Base image with clang toolchain | ||
| # SDK ClusterFuzzLite Dockerfile. Builds the Absolution-driven SDK self-fuzz | ||
| # targets defined under fuzzing/sdk-fuzz/ (see .clusterfuzzlite/build.sh). | ||
| FROM gcr.io/oss-fuzz-base/base-builder:v1 | ||
|
|
||
| RUN pip3 install --break-system-packages --no-cache-dir pillow>=3.4.0 | ||
| RUN apt update && apt install -y ninja-build zip | ||
|
|
||
| # Copy the project's source code. | ||
| COPY . $SRC/ledger-secure-sdk | ||
|
|
||
| # Working directory for build.sh | ||
| WORKDIR $SRC/ledger-secure-sdk | ||
|
|
||
| # Copy build.sh into $SRC dir. | ||
| COPY ./.clusterfuzzlite/build.sh $SRC/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,25 @@ | ||
| #!/bin/bash -e | ||
|
|
||
| pushd fuzzing | ||
| cmake -S . -B build -DCMAKE_C_COMPILER=clang -DCMAKE_BUILD_TYPE=Debug \ | ||
| -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=On \ | ||
| -DBOLOS_SDK=/src/ledger-secure-sdk/ -DTARGET=flex \ | ||
| -DAPP_BUILD_PATH=/src/ledger-secure-sdk/ | ||
| # Generates .zip for initial corpus in clusterFuzz | ||
| for dir in harness/*; do | ||
| if [ -d "$dir" ]; then | ||
| fuzzer_name=$(basename "$dir") | ||
| zip_name="${fuzzer_name}_seed_corpus.zip" | ||
| echo "Zipping corpus from $dir into $zip_name" | ||
| # SDK self-fuzz targets under fuzzing/sdk-fuzz/ are Absolution-driven: absolution_add_fuzzer() regenerates each harness from the model, using the same app contract as real apps. | ||
|
|
||
| (cd "$dir" && zip -q -r "$zip_name" .) | ||
| SDK_DIR="${SRC:-/src}/ledger-secure-sdk" | ||
|
|
||
| mv "$dir/$zip_name" "$OUT/" | ||
| fi | ||
| pushd "${SDK_DIR}/fuzzing/sdk-fuzz" | ||
|
|
||
| cmake -S . -B build-absolution \ | ||
| -DCMAKE_C_COMPILER=clang \ | ||
| -DCMAKE_BUILD_TYPE=Debug \ | ||
| -G Ninja \ | ||
| -DCMAKE_EXPORT_COMPILE_COMMANDS=On \ | ||
| -DBOLOS_SDK="${SDK_DIR}" \ | ||
| -DTARGET=flex \ | ||
| -DAPP_BUILD_PATH="${SDK_DIR}" | ||
|
|
||
| cmake --build build-absolution | ||
|
|
||
| for fuzzer in ./build-absolution/fuzz_*; do | ||
| [[ -f "${fuzzer}" && -x "${fuzzer}" ]] || continue | ||
| cp "${fuzzer}" "${OUT}/" | ||
| done | ||
| cmake --build build | ||
| mv ./build/fuzz_* "${OUT}" | ||
|
|
||
| popd |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| name: ClusterFuzzLite fuzzing tests | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - master | ||
| schedule: | ||
| - cron: '0 13 * * 6' # 13:00 UTC every Saturday | ||
|
|
||
| permissions: read-all | ||
|
|
||
| jobs: | ||
| Fuzzing: | ||
| uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_clusterfuzz_tests.yml@v1 | ||
| with: | ||
| exec_mode: ${{ github.event_name }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.