agentic-actions-audito…
Audits GitHub Actions workflows for security vulnerabilities in AI agent integrations including Claude Code Action, Gemini CLI, OpenAI Codex, and GitHub AI…
Builds and runs code under AddressSanitizer to catch buffer overflows, use-after-free, and other memory errors during fuzzing or tests. Covers -fsanitize=address builds, ASAN_OPTIONS, reading the crash report, LeakSanitizer, and the overhead and platform trade-offs. Use when
$ npx -y skills add trailofbits/skills --skill address-sanitizer --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/address-sanitizerContext preview
The summary Claude sees to decide when to auto-load this skill.
Builds and runs code under AddressSanitizer to catch buffer overflows, use-after-free, and other memory errors during fuzzing or tests. Covers -fsanitize=address builds, ASAN_OPTIONS, reading the crash report, LeakSanitizer, and the overhead and platform trade-offs. Use when
name: address-sanitizer type: technique description: "Builds and runs code under AddressSanitizer to catch buffer overflows, use-after-free, and other memory errors during fuzzing or tests. Covers -fsanitize=address builds, ASAN_OPTIONS, reading the crash report, LeakSanitizer, and the overhead and platform trade-offs. Use when fuzzing C/C++ or Rust that has unsafe blocks or FFI, when debugging a memory corruption crash, or when reading an ASan stack trace."
AddressSanitizer (ASan) is a widely adopted memory error detection tool used extensively during software testing, particularly fuzzing. It helps detect memory corruption bugs that might otherwise go unnoticed, such as buffer overflows, use-after-free errors, and other memory safety violations.
ASan is a standard practice in fuzzing due to its effectiveness in identifying memory vulnerabilities. It instruments code at compile time to track memory allocations and accesses, detecting illegal operations at runtime.
| Concept | Description | |---------|-------------| | Instrumentation | ASan adds runtime checks to memory operations during compilation | | Shadow Memory | Maps 20TB of virtual memory to track allocation state | | Performance Cost | Approximately 2-4x slowdown compared to non-instrumented code | | Detection Scope | Finds buffer overflows, use-after-free, double-free, and memory leaks |
**Apply this technique when:**
**Skip this technique when:**
| Task | Command/Pattern | |------|-----------------| | Enable ASan (Clang/GCC) | `-fsanitize=address` | | Enable verbosity | `ASAN_OPTIONS=verbosity=1` | | Disable leak detection | `ASAN_OPTIONS=detect_leaks=0` | | Force abort on error | `ASAN_OPTIONS=abort_on_error=1` | | Multiple options | `ASAN_OPTIONS=verbosity=1:abort_on_error=1` |
Compile and link your code with the `-fsanitize=address` flag:
clang -fsanitize=address -g -o my_program my_program.c
The `-g` flag is recommended to get better stack traces when ASan detects errors.
Set the `ASAN_OPTIONS` environment variable to configure ASan behavior:
export ASAN_OPTIONS=verbosity=1:abort_on_error=1:detect_leaks=0
Execute the ASan-instrumented binary. When memory errors are detected, ASan will print detailed reports:
./my_program
ASan requires approximately 20TB of virtual memory. Disable fuzzer memory restrictions:
**Use Case:** Standard fuzzing setup with ASan
**Before:**
clang -o fuzz_target fuzz_target.c ./fuzz_target
**After:**
clang -fsanitize=address -g -o fuzz_target fuzz_target.c ASAN_OPTIONS=verbosity=1:abort_on_error=1 ./fuzz_target
**Use Case:** Enable ASan for unit test suite
**Before:**
gcc -o test_suite test_suite.c -lcheck ./test_suite
**After:**
gcc -fsanitize=address -g -o test_suite test_suite.c -lcheck ASAN_OPTIONS=detect_leaks=1 ./test_suite
| Tip | Why It Helps | |-----|--------------| | Use `-g` flag | Provides detailed stack traces for debugging | | Set `verbosity=1` | Confirms ASan is enabled before program starts | | Disable leaks during fuzzing | Leak detection doesn't cause immediate crashes, clutters output | | Enable `abort_on_error=1` | Some fuzzers require `abort()` instead of `_exit()` |
When ASan detects a memory error, it prints a detailed report including:
Example ASan report:
==12345==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60300000eff4 at pc 0x00000048e6a3
READ of size 4 at 0x60300000eff4 thread T0
#0 0x48e6a2 in main /path/to/file.c:42ASan can be combined with other sanitizers for comprehensive detection:
clang -fsanitize=address,undefined -g -o fuzz_target fuzz_target.c
**Linux**: Full ASan support with best performance **macOS**: Limited support, some features may not work **Windows**: Experimental support, not recommended for production fuzzing
| Anti-Pattern | Problem | Correct Approach | |--------------|---------|------------------| | Using ASan in production | Can make applications less secure | Use ASan only for testing | | Not disabling memory limits | Fuzzer may kill process due to 20TB virtual memory | Set `-rss_limit_mb=0` or `-m none` | | Ignoring leak reports | Memory leaks indicate resource management issues | Review leak reports at end of fuzzing campaign |
Compile with both fuzzer and address sanitizer:
clang++ -fsanitize=fuzzer,address -g harness.cc -o fuzz
Run with unlimited RSS:
./fuzz -rss_limit_mb=0
**Integration tips:**
See: [libFuzzer: AddressSanitizer](https://github.com/goo
A Claude Code plugin marketplace from Trail of Bits providing skills to enhance AI-assisted security analysis, testing, and development workflows. Codex can load this marketplace through its Claude marketplace compatibility.
Audits GitHub Actions workflows for security vulnerabilities in AI agent integrations including Claude Code Action, Gemini CLI, OpenAI Codex, and GitHub AI…
Understand a codebase before looking for bugs in it - what each function assumes, what it guarantees, and what it depends on elsewhere. Use when starting an…
Scans Algorand smart contracts for 11 common vulnerabilities including rekeying attacks, unchecked transaction fees, missing field validations, and access…
Prepares codebases for security review using Trail of Bits' checklist. Helps set review goals, runs static analysis tools, increases test coverage, removes…
Scans Cairo/StarkNet smart contracts for 6 critical vulnerabilities including felt252 arithmetic overflow, L1-L2 messaging issues, address conversion problems,…
Systematic code maturity assessment using Trail of Bits' 9-category framework. Analyzes codebase for arithmetic safety, auditing practices, access controls,…