Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

VelesDB Fuzzing

Security fuzzing targets for VelesDB using cargo-fuzz.

Prerequisites

# Install cargo-fuzz (requires nightly)
cargo install cargo-fuzz

# Or use rustup
rustup install nightly

Fuzz Targets

fuzz_velesql_parser

Tests the VelesQL SQL parser with arbitrary input strings to find:

  • Panics on malformed queries
  • Memory safety issues in pest parsing
  • Stack overflows from deeply nested expressions
cd fuzz
cargo +nightly fuzz run fuzz_velesql_parser

fuzz_distance_metrics

Tests SIMD distance calculations with arbitrary vectors to find:

  • Panics on edge cases (NaN, Inf, denormals)
  • Numerical stability issues
  • SIMD alignment problems
cd fuzz
cargo +nightly fuzz run fuzz_distance_metrics

fuzz_snapshot_parser

Tests the snapshot loader against malformed binary snapshots to find:

  • OOM from attacker-controlled entry_count/length fields sizing allocations
  • Panics or UB on truncated or corrupted snapshot files
cd fuzz
cargo +nightly fuzz run fuzz_snapshot_parser

Running Fuzzing

Quick Run (1 minute)

cd fuzz
cargo +nightly fuzz run fuzz_velesql_parser -- -max_total_time=60

Long Run (1 hour)

cd fuzz
cargo +nightly fuzz run fuzz_velesql_parser -- -max_total_time=3600

Check Coverage

cargo +nightly fuzz coverage fuzz_velesql_parser

Reproducing Crashes

If a crash is found, it will be saved in fuzz/artifacts/. Reproduce with:

cargo +nightly fuzz run fuzz_velesql_parser fuzz/artifacts/fuzz_velesql_parser/<crash_file>

CI Integration

Add to GitHub Actions:

- name: Fuzz Test (Quick)
  run: |
    cargo install cargo-fuzz
    cd fuzz
    cargo +nightly fuzz run fuzz_velesql_parser -- -max_total_time=60

Adding New Targets

  1. Create fuzz/fuzz_targets/fuzz_<name>.rs
  2. Add [[bin]] entry to fuzz/Cargo.toml
  3. Document in this README