Skip to content

Commit 8651ee2

Browse files
committed
Add fuzzing infrastructure for improved security testing
- Initialize cargo-fuzz with 5 fuzz targets - Target critical protocol parsing areas (MySQL, PostgreSQL) - Focus on RUSTSEC-2024-0363 vulnerability area - Add fuzzing helper scripts for development - Configure workspace to exclude fuzz directory Fuzzing targets: - fuzz_mysql_lenenc: MySQL length-encoded integer parsing - fuzz_mysql_row_binary: Binary protocol row parsing - fuzz_mysql_handshake: Connection handshake parsing - fuzz_postgres_data_row: PostgreSQL data row parsing - fuzz_postgres_response: Error/notice response parsing This infrastructure enables continuous fuzzing to discover security vulnerabilities and protocol misinterpretation issues. Contributed by: Jared Reyes
1 parent 7248f64 commit 8651ee2

14 files changed

+2157
-0
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ members = [
2525
"examples/sqlite/todos",
2626
"examples/sqlite/extension",
2727
]
28+
exclude = ["fuzz"]
2829

2930
[workspace.package]
3031
version = "0.9.0-alpha.1"

check_fuzzing_status.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
3+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
4+
LOG_DIR="$SCRIPT_DIR/fuzz_logs"
5+
6+
echo "🔍 Fuzzing Status Check"
7+
echo "======================="
8+
echo ""
9+
10+
TARGETS=(
11+
"fuzz_mysql_lenenc"
12+
"fuzz_mysql_row_binary"
13+
"fuzz_mysql_handshake"
14+
"fuzz_postgres_data_row"
15+
"fuzz_postgres_response"
16+
)
17+
18+
RUNNING_COUNT=0
19+
for TARGET in "${TARGETS[@]}"; do
20+
PID=$(pgrep -f "cargo-fuzz.*$TARGET" || true)
21+
if [ -n "$PID" ]; then
22+
echo "✅ Fuzzer $((++RUNNING_COUNT)) (PID $PID): RUNNING"
23+
else
24+
echo "❌ Fuzzer for $TARGET: NOT RUNNING"
25+
fi
26+
done
27+
28+
echo ""
29+
echo "Summary: $RUNNING_COUNT/5 fuzzers running"
30+
echo ""
31+
echo "📊 Latest Stats:"
32+
echo "==============="
33+
echo ""
34+
35+
for TARGET in "${TARGETS[@]}"; do
36+
LATEST_LOG=$(ls -t "$LOG_DIR"/${TARGET}_*.log 2>/dev/null | head -1)
37+
if [ -n "$LATEST_LOG" ]; then
38+
echo "${TARGET}:"
39+
tail -3 "$LATEST_LOG" 2>/dev/null || echo " No stats yet"
40+
echo ""
41+
fi
42+
done
43+
44+
echo "💥 Crashes Found:"
45+
echo "================="
46+
CRASH_COUNT=$(find "$SCRIPT_DIR/fuzz/artifacts" -name "crash-*" -type f 2>/dev/null | wc -l)
47+
if [ "$CRASH_COUNT" -gt 0 ]; then
48+
echo " Found $CRASH_COUNT crash(es)!"
49+
find "$SCRIPT_DIR/fuzz/artifacts" -name "crash-*" -type f 2>/dev/null
50+
else
51+
echo " None found yet (keep running!)"
52+
fi

fuzz/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
target
2+
corpus
3+
artifacts
4+
coverage

0 commit comments

Comments
 (0)