Skip to content

Latest commit

 

History

History
190 lines (156 loc) · 9.75 KB

fuzzing.md

File metadata and controls

190 lines (156 loc) · 9.75 KB

+

Methodology

Targets

Case studies

Fault injection

  • use byte value of surrounding data to bypass input sanitization
  • apply faults at elements separated by delimiters to reduce test cases
  • apply deltas to common buffer sizes (e.g. k^2, k^10, -+20)

Syscalls

strace -e mprotect -e fault=all:error=EPERM:when=1 \
    pwd
strace -e inject=write:delay_exit=100000 -e write -o/dev/null \
    dd if=/dev/zero of=/dev/null bs=1M count=10
  • Modern strace - Dmitry Levin
  • Can strace make you fail? - Dmitry Levin

Network

# packet loss
iptables -A INPUT -m statistic --mode random --probability 0.1 -j DROP
iptables -A OUTPUT -m statistic --mode random --probability 0.1 -j DROP
# network latency, limited bandwidth, and packet loss
tc qdisc add dev eth0 root netem delay 250ms loss 10% rate 1mbps
# network latency w/ jitter
tc qdisc add dev eth0 root netem delay 50ms 20ms distribution normal
# re-order, duplicate, and corrupt packets.
tc qdisc add dev eth0 root netem reorder 0.02 duplicate 0.05 corrupt 0.01

OS

Coverage / Feedback based fuzzing

; store old reg values
lea rsp, [rsp-98h]
mov [rsp+a0h+var_a0], rdx
mov [rsp+a0h+var_98], rcx
mov [rsp+a0h+var_90], rax
; instrumentation
mov rcx, 0be80h
call __afl_maybe_log
; restore old reg values
mov rax, [rsp+a0h+var_90]
mov rcx, [rsp+a0h+var_98]
mov rdx, [rsp+a0h+var_a0]
lea rsp, [rsp+98h]

Mutation based fuzzing

System fuzzing

Directory busting

  • burp
    • Scope > Target Scope > Host / IP range > add target domains
    • Site Map > select entry, open context menu, select "Send to Intruder"
    • Positions > add variable $foo$ as request header "Host" value, "Attack type" = "Cluster bomb"
      • Payloads > "Payload type" = "Simple list", add subdomains
      • check: http 200, https 301...
      • extract links from resources (.html, .js), wayback machine...
    • Positions > add variable /$foo$ as host, "Attack type" = "Sniper"
      • Payloads > "Payload type" = "Simple list", add wordlist, limit concurrent requests to 100
      • check: http 200, https 301...
    • Bug Bounty 101: #18 - Approaching a Public Target (Pinterest) - YouTube
grep -v '%' ~/opt/dirbustlist/dirbuster/directory-list-2.3-medium.txt > /tmp/wordlist
gobuster dir --url http://vulnerable --wordlist /tmp/wordlist
# ||
gobuster dir --url http://vulnerable --wordlist ~/opt/zap-extensions/tree/master/addOns/directorylistv2_3/src/main/zapHomeFiles/fuzzers/dirbuster/directory-list-2.3-medium.txt
# ||
gobuster dir --url http://vulnerable --wordlist SecLists/Discovery/Web_Content/raft-large-files.txt
for i in files directories; do gobuster dir -t 30 -u http://vulnerable -w SecLists/Discovery/Web_Content/raft-medium-$i.txt; done

# Specific file extensions
gobuster -x .php,.html
gobuster -x .js,.json
gobuster -x .aspx

# Boolean-based filter by response length
ffuf -c -w ~/code/guides/ctf/SecLists/Passwords/Leaked-Databases/rockyou-75.txt -u 'https://foo?FUZZ' -fs 123
ffuf -c -w ~/code/guides/ctf/SecLists/Passwords/Leaked-Databases/rockyou-75.txt -u 'https://foo?bar=FUZZ' -fs 234

Parameter discovery

Wordlists