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

Change action for MD link checks #2563

Merged
merged 10 commits into from
Sep 26, 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
14 changes: 14 additions & 0 deletions .github/workflows/.linkspector.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
dirs:
- .

useGitIgnore: true

ignorePatterns:
- pattern: "^https://crates.io"
- pattern: "^https://github.com/AFLplusplus/linux-qemu-image-builder"
- pattern: "https://www.romu-random.org/"

aliveStatusCodes:
- 0
- 200
- 403
20 changes: 14 additions & 6 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,22 @@ jobs:
- name: Format Check
run: ./scripts/fmt_all.sh check

md-links-check:
runs-on: ubuntu-24.04
check-md-links:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Markdown Link checks
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
config-file: '.github/workflows/md-config.json'
- name: Install linkspector
shell: bash
run: sudo apt-get install -y npm && npm install -g @umbrelladocs/linkspector
- name: Run linkspector
shell: bash
run: ./scripts/check_md_links.sh
# TODO: Use github action once it's fixed (https://github.com/UmbrellaDocs/action-linkspector/issues/20)
# - name: Run linkspector
# uses: umbrelladocs/action-linkspector@v1
# with:
# fail_on_error: 'true'
# config_file: '.github/workflows/.linkspector.yml'

fuzzers-preflight:
runs-on: ubuntu-24.04
Expand Down
11 changes: 0 additions & 11 deletions .github/workflows/md-config.json

This file was deleted.

10 changes: 5 additions & 5 deletions docs/src/advanced_features/concolic.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ The `symcc_runtime` crate supports this use case and runtimes built with `symcc_

## Hybrid Fuzzing in LibAFL

The LibAFL repository contains an [example hybrid fuzzer](https://github.com/AFLplusplus/LibAFL/tree/main/fuzzers/stb/libfuzzer_stb_image_concolic).
The LibAFL repository contains an [example hybrid fuzzer](https://github.com/AFLplusplus/LibAFL/tree/main/fuzzers/inprocess/libfuzzer_stb_image_concolic).

There are three main steps involved with building a hybrid fuzzer using LibAFL:

Expand All @@ -130,7 +130,7 @@ For example, we need to have a runtime ready before we can do instrumentation wi

Building a custom runtime can be done easily using the `symcc_runtime` crate.
Note, that a custom runtime is a separate shared object file, which means that we need a separate crate for our runtime.
Check out the [example hybrid fuzzer's runtime](https://github.com/AFLplusplus/LibAFL/tree/main/fuzzers/stb/libfuzzer_stb_image_concolic/runtime) and the [`symcc_runtime` docs](https://docs.rs/symcc_runtime/0.1/symcc_runtime) for inspiration.
Check out the [example hybrid fuzzer's runtime](https://github.com/AFLplusplus/LibAFL/tree/main/fuzzers/inprocess/libfuzzer_stb_image_concolic/runtime) and the [`symcc_runtime` docs](https://docs.rs/symcc_runtime/0.1/symcc_runtime) for inspiration.

### Instrumentation

Expand All @@ -151,7 +151,7 @@ How exactly this is done does not matter.
However, the SymCC compiler needs to be made aware of the location of the runtime that it should instrument against.
This is done by setting the `SYMCC_RUNTIME_DIR` environment variable to the directory which contains the runtime (typically the `target/(debug|release)` folder of your runtime crate).

The example hybrid fuzzer instruments the target in its [`build.rs` build script](https://github.com/AFLplusplus/LibAFL/blob/main/fuzzers/stb/libfuzzer_stb_image_concolic/fuzzer/build.rs#L50).
The example hybrid fuzzer instruments the target in its [`build.rs` build script](https://github.com/AFLplusplus/LibAFL/blob/main/fuzzers/inprocess/libfuzzer_stb_image_concolic/fuzzer/build.rs#L50).
It does this by cloning and building a copy of SymCC and then using this version to instrument the target.
The [`symcc_libafl` crate](https://docs.rs/symcc_libafl) contains helper functions for cloning and building SymCC.

Expand All @@ -169,7 +169,7 @@ No matter the instrumentation method, the interface between the fuzzer and the i
The only difference between using SymCC and SymQEMU should be the binary that represents the target:
In the case of SymCC it will be the binary that was build with instrumentation and with SymQEMU it will be the emulator binary (eg. `x86_64-linux-user/symqemu-x86_64`), followed by your uninstrumented target binary and its arguments.

You can use the [`CommandExecutor`](https://docs.rs/libafl/latest/libafl/executors/command/struct.CommandExecutor.html) to execute your target ([example](https://github.com/AFLplusplus/LibAFL/blob/main/fuzzers/stb/libfuzzer_stb_image_concolic/fuzzer/src/main.rs#L244)).
You can use the [`CommandExecutor`](https://docs.rs/libafl/latest/libafl/executors/command/struct.CommandExecutor.html) to execute your target ([example](https://github.com/AFLplusplus/LibAFL/blob/main/fuzzers/inprocess/libfuzzer_stb_image_concolic/fuzzer/src/main.rs#L244)).
When configuring the command, make sure you pass the `SYMCC_INPUT_FILE` environment variable (set to the input file path), if your target reads input from a file (instead of standard input).

#### Serialization and Solving
Expand All @@ -184,4 +184,4 @@ It will attempt to solve all branches, like the original simple backend from Sym

### Example

The example fuzzer shows how to use the [`ConcolicTracingStage` together with the `SimpleConcolicMutationalStage`](https://github.com/AFLplusplus/LibAFL/blob/main/fuzzers/stb/libfuzzer_stb_image_concolic/fuzzer/src/main.rs#L222) to build a basic hybrid fuzzer.
The example fuzzer shows how to use the [`ConcolicTracingStage` together with the `SimpleConcolicMutationalStage`](https://github.com/AFLplusplus/LibAFL/blob/main/fuzzers/inprocess/libfuzzer_stb_image_concolic/fuzzer/src/main.rs#L222) to build a basic hybrid fuzzer.
4 changes: 2 additions & 2 deletions docs/src/advanced_features/frida.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ LibAFL supports different instrumentation engines for binary-only fuzzing.
A potent cross-platform (Windows, MacOS, Android, Linux, iOS) option for binary-only fuzzing is Frida; the dynamic instrumentation tool.

In this section, we will talk about the components in fuzzing with `libafl_frida`.
You can take a look at a working example in our [`fuzzers/frida/frida_libpng`](https://github.com/AFLplusplus/LibAFL/tree/main/fuzzers/frida/frida_libpng) folder for Linux, and [`fuzzers/frida/frida_gdiplus`](https://github.com/AFLplusplus/LibAFL/tree/main/fuzzers/frida/frida_gdiplus) for Windows.
You can take a look at a working example in our [`fuzzers/binary-only/frida_libpng`](https://github.com/AFLplusplus/LibAFL/tree/main/fuzzers/binary-only/frida_libpng) folder for Linux, and [`fuzzers/binary-only/frida_gdiplus`](https://github.com/AFLplusplus/LibAFL/tree/main/fuzzers/binary-only/frida_gdiplus) for Windows.

## Dependencies

Expand Down Expand Up @@ -84,4 +84,4 @@ You can then link this observer to `FridaInProcessExecutor` as follows:
```

And finally you can run the fuzzer.
See the `frida_` examples in [`./fuzzers/frida`](https://github.com/AFLplusplus/LibAFL/tree/main/fuzzers/frida/) for more information and, for linux or full-system, play around with `libafl_qemu`, another binary-only tracer.
See the `frida_` examples in [`./fuzzers/binary-only`](https://github.com/AFLplusplus/LibAFL/tree/main/fuzzers/binary-only/) for more information and, for linux or full-system, play around with `libafl_qemu`, another binary-only tracer.
6 changes: 3 additions & 3 deletions docs/src/advanced_features/nyx.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ For binary-only fuzzing, Nyx uses intel-PT(Intel® Processor Trace). You can fin

## Preparing the Nyx working directory

This step is used to pack the target into Nyx's kernel. Don't worry, we have a template shell script in our [example](https://github.com/AFLplusplus/LibAFL/blob/main/fuzzers/nyx/nyx_libxml2_parallel/setup_libxml2.sh):
This step is used to pack the target into Nyx's kernel. Don't worry, we have a template shell script in our [example](https://github.com/AFLplusplus/LibAFL/blob/main/fuzzers/full-system/nyx_libxml2_parallel/setup_libxml2.sh):

the parameter's meaning is listed below:

Expand All @@ -49,7 +49,7 @@ python3 ./packer/packer/nyx_config_gen.py /tmp/nyx_libxml2/ Kernel || exit

## Standalone fuzzing

In the [example fuzzer](https://github.com/AFLplusplus/LibAFL/blob/main/fuzzers/nyx/nyx_libxml2_standalone/src/main.rs) you first need to run `./setup_libxml2.sh`. It will prepare your target and create your nyx work directory in `/tmp/libxml2`. After that, you can start to write your code.
In the [example fuzzer](https://github.com/AFLplusplus/LibAFL/blob/main/fuzzers/full-system/nyx_libxml2_standalone/src/main.rs) you first need to run `./setup_libxml2.sh`. It will prepare your target and create your nyx work directory in `/tmp/libxml2`. After that, you can start to write your code.

First, to create `Nyxhelper`:

Expand All @@ -71,7 +71,7 @@ Finally, use them normally and pass them into `fuzzer.fuzz_loop(&mut stages, &mu

## Parallel fuzzing

In the [example fuzzer](https://github.com/AFLplusplus/LibAFL/blob/main/fuzzers/nyx/nyx_libxml2_parallel/src/main.rs) you first need to run `./setup_libxml2.sh` as described before.
In the [example fuzzer](https://github.com/AFLplusplus/LibAFL/blob/main/fuzzers/full-system/nyx_libxml2_parallel/src/main.rs) you first need to run `./setup_libxml2.sh` as described before.

Parallel fuzzing relies on [`Launcher`](../message_passing/spawn_instances.md), so spawn logic should be written in the scoop of anonymous function `run_client`:

Expand Down
2 changes: 1 addition & 1 deletion docs/src/getting_started/crates.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ In it, you'll find highlights like:
The sugar crate abstracts away most of the complexity of LibAFL's API.
Instead of high flexibility, it aims to be high-level and easy-to-use.
It is not as flexible as stitching your fuzzer together from each individual component, but allows you to build a fuzzer with minimal lines of code.
To see it in action, take a look at the [`libfuzzer_stb_image_sugar` example fuzzer](https://github.com/AFLplusplus/LibAFL/tree/main/fuzzers/stb/libfuzzer_stb_image_sugar).
To see it in action, take a look at the [`libfuzzer_stb_image_sugar` example fuzzer](https://github.com/AFLplusplus/LibAFL/tree/main/fuzzers/inprocess/libfuzzer_stb_image_sugar).

### [`libafl_derive`](https://github.com/AFLplusplus/LibAFL/tree/main/libafl_derive)

Expand Down
2 changes: 1 addition & 1 deletion docs/src/tutorial/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
> This section is under construction.
> Please check back later (or open a PR)
>
> In the meantime, find the final Lain-based fuzzer in [the fuzzers folder](https://github.com/AFLplusplus/LibAFL/tree/main/fuzzers/others/tutorial)
> In the meantime, find the final Lain-based fuzzer in [the fuzzers folder](https://github.com/AFLplusplus/LibAFL/tree/main/fuzzers/inprocess/tutorial)
17 changes: 17 additions & 0 deletions scripts/check_md_links.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
LIBAFL_DIR=$(realpath "$SCRIPT_DIR/..")

echo "[*] Checking MD links..."

cd "$LIBAFL" || exit 1

if ! command -v linkspector > /dev/null; then
echo "Error: install linkspector to check MD file links."
exit 1
fi

linkspector check -c "${LIBAFL_DIR}/.github/workflows/.linkspector.yml" || exit 1

echo "[*] Done :)"