-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
646 additions
and
255 deletions.
There are no files selected for viewing
This file contains 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,10 @@ | ||
# Debug | ||
|
||
To debug your program with values from a crash file: | ||
|
||
```bash | ||
# fuzzer will run the <TARGET_NAME> with the specified <CRASH_FILE_PATH> | ||
trident fuzz run-debug <TARGET_NAME> <CRASH_FILE_PATH> | ||
# for example: | ||
trident fuzz run-debug fuzz_0 trident-tests/fuzz_tests/fuzzing/fuzz_0/cr1.fuzz | ||
``` |
This file contains 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
This file contains 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,25 @@ | ||
# Fuzzing statistics | ||
|
||
!!! important | ||
|
||
In order to show statistics of fuzzing session (statistics are displayed after the fuzzing session ended), set `fuzzing_with_stats` within the Trident.toml to `true`. | ||
|
||
```toml | ||
[fuzz] | ||
# ... | ||
fuzzing_with_stats = true | ||
# ... | ||
``` | ||
|
||
|
||
Currently exported statistics from the Fuzzing Session | ||
|
||
#### Simple | ||
|
||
- Number of invocations of each instruction during the fuzzing session. | ||
- Number of successful invocations of each instruction during the fuzzing session. | ||
- Number of failed invariants checks for each instruction during the fuzzing session. | ||
|
||
??? note | ||
|
||
Keep in mind that the number of fuzz iterations does not directly correspond to the total number of invocations. In one fuzz iteration, the fuzzer might be unable to deserialize fuzz data into instructions, causing the entire iteration to be skipped. |
File renamed without changes.
This file contains 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,75 @@ | ||
--- | ||
hide: | ||
- toc | ||
--- | ||
|
||
# Trident by Examples | ||
|
||
<div class="grid cards" markdown> | ||
|
||
- :material-hand-wave:{ .lg .middle } __Hello World!__ | ||
|
||
--- | ||
|
||
Hello World example with Trident. | ||
|
||
[hello_world](https://github.com/Ackee-Blockchain/trident/tree/master/examples/fuzz-tests/hello_world) | ||
|
||
- :octicons-bug-16:{ .lg .middle } __Possible vulnerabilities and bugs__ | ||
|
||
--- | ||
|
||
Check the possible attack vectors and bugs that can be detected using Trident. | ||
|
||
[Unchecked Arithmetic](https://github.com/Ackee-Blockchain/trident/tree/master/examples/fuzz-tests/unchecked-arithmetic-0) | ||
|
||
[Incorrect Instruction Sequence](https://github.com/Ackee-Blockchain/trident/tree/master/examples/fuzz-tests/incorrect-ix-sequence-1) | ||
|
||
[Unauthorized Access](https://github.com/Ackee-Blockchain/trident/tree/master/examples/fuzz-tests/unauthorized-access-2) | ||
|
||
[Incorrect Integer Arithmetic](https://github.com/Ackee-Blockchain/trident/tree/master/examples/fuzz-tests/incorrect-integer-arithmetic-3) | ||
|
||
- :octicons-tools-24:{ .lg .middle } __Customize with Arbitrary__ | ||
|
||
--- | ||
|
||
You can use Arbitrary crate to your advantage and limit or customize the data that are sent to the instructions. | ||
|
||
[Custom Data Types](https://github.com/Ackee-Blockchain/trident/tree/master/examples/fuzz-tests/arbitrary-custom-types-4) | ||
|
||
|
||
[Limiting Instructions Inputs](https://github.com/Ackee-Blockchain/trident/tree/master/examples/fuzz-tests/arbitrary-limit-inputs-5) | ||
|
||
- :material-call-made:{ .lg .middle } __Cross-Program Invocation__ | ||
|
||
--- | ||
|
||
Trident supports Cross-Program Invocation, you can fuzz your programs and create NFTs at the same time. | ||
|
||
[Simple CPI](https://github.com/Ackee-Blockchain/trident/tree/master/examples/fuzz-tests/simple-cpi-6) | ||
|
||
[CPI with Metaplex Metadata Program](https://github.com/Ackee-Blockchain/trident/tree/master/examples/fuzz-tests/cpi-metaplex-7) | ||
|
||
</div> | ||
|
||
<!-- ### Hello World! Example | ||
- [hello_world](https://github.com/Ackee-Blockchain/trident/tree/master/examples/fuzz-tests/hello_world) | ||
### Possible vulnerabilities and bugs | ||
- [unchecked-arithmetic-0](https://github.com/Ackee-Blockchain/trident/tree/master/examples/fuzz-tests/unchecked-arithmetic-0) | ||
- [incorrect-ix-sequence-1](https://github.com/Ackee-Blockchain/trident/tree/master/examples/fuzz-tests/incorrect-ix-sequence-1) | ||
- [unauthorized-access-2](https://github.com/Ackee-Blockchain/trident/tree/master/examples/fuzz-tests/unauthorized-access-2) | ||
- [incorrect-integer-arithmetic-3](https://github.com/Ackee-Blockchain/trident/tree/master/examples/fuzz-tests/incorrect-integer-arithmetic-3) | ||
### Example usage of Arbitrary Trait with Custom Data type as Instruction parameter | ||
- [arbitrary-custom-types-4](https://github.com/Ackee-Blockchain/trident/tree/master/examples/fuzz-tests/arbitrary-custom-types-4) | ||
### Example usage of limiting the Instruction data structure with the Arbitrary trait | ||
- [arbitrary-limit-inputs-5](https://github.com/Ackee-Blockchain/trident/tree/master/examples/fuzz-tests/arbitrary-limit-inputs-5) | ||
### Example usage of CPI with available source code to the callee program | ||
- [simple-cpi-6](https://github.com/Ackee-Blockchain/trident/tree/master/examples/fuzz-tests/simple-cpi-6) | ||
### Example usage of CPI with unavailable source code to the callee program (i.e. callee as SBF) | ||
- [cpi-metaplex-7](https://github.com/Ackee-Blockchain/trident/tree/master/examples/fuzz-tests/cpi-metaplex-7) --> |
File renamed without changes.
This file contains 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
31 changes: 31 additions & 0 deletions
31
documentation/docs/fuzzing/first-steps/writing-fuzz-test.md
This file contains 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,31 @@ | ||
# Writing Fuzz Test | ||
|
||
!!! important | ||
|
||
At the current development stage, there are some manual steps required to start the Fuzzing Session. In principle: | ||
|
||
**Prerequisites:** | ||
|
||
- Add dependencies specific to your program to `trident-tests/fuzz_tests/Cargo.toml` (such as anchor-spl etc.). | ||
- Add necessary `use` statements into `trident-tests/fuzz_tests/<FUZZ_TEST_NAME>/accounts_snapshots.rs` to import missing types. | ||
|
||
**Writing Fuzz Tests** | ||
|
||
1. Include desired Programs [Include Programs](../writing-fuzz-test/programs.md). | ||
2. Specify pseudo-random accounts to re-use [Accounts to re-use](../writing-fuzz-test/accounts.md). | ||
3. Specify instruction data [Instruction Data](../writing-fuzz-test/instruction-data.md). | ||
4. Specify instruction accounts [Instruction Accounts](../writing-fuzz-test/instruction-accounts.md). | ||
|
||
**Run and Debug** | ||
|
||
1. Execute desired fuzz test [Run](../execute/run.md) | ||
2. See the found crash with more details [Debug](../execute/debug.md) | ||
|
||
!!! note | ||
|
||
For better fuzzing results and experience you can also manually adjust the following: | ||
|
||
1. Define Invariants checks [Invariants Checks](../writing-fuzz-test-extra/invariants-checks.md). | ||
2. Specify instruction sequences[Instruction sequences](../writing-fuzz-test-extra/instruction-sequences.md). | ||
3. Specify custom data types[Custom Data types](../writing-fuzz-test-extra/custom-data-types.md). | ||
4. Well structured data[Arbitrary](../writing-fuzz-test-extra/arbitrary.md). |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
documentation/docs/fuzzing/initialization/fuzzing-initialization-all.md
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
documentation/docs/fuzzing/initialization/fuzzing-initialization-fuzz-add.md
This file was deleted.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
documentation/docs/fuzzing/writing-fuzz-test-extra/accounts-snapshots.md
This file contains 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,3 @@ | ||
# AccountsSnapshots | ||
|
||
TBD |
2 changes: 1 addition & 1 deletion
2
...on/docs/fuzzing/howto/fuzzing-howto-p7.md → ...zing/writing-fuzz-test-extra/arbitrary.md
This file contains 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
2 changes: 1 addition & 1 deletion
2
...on/docs/fuzzing/howto/fuzzing-howto-p6.md → ...ting-fuzz-test-extra/custom-data-types.md
This file contains 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
6 changes: 4 additions & 2 deletions
6
...on/docs/fuzzing/howto/fuzzing-howto-p5.md → ...-fuzz-test-extra/instruction-sequences.md
This file contains 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.