Skip to main content
Synced from an Obsidian vault

For graph and advanced features, download the full Intel Codex Vault and open it in Obsidian.

Vulnerability Research SOP

Authorized environments only. Vulnerability research, exploit development, and disclosure work has narrow legal carveouts. Confirm authorization (your own code, lab targets, CTF, bug-bounty scope, or written engagement letter) before running anything in this SOP. Cross-references: Legal & Ethics for jurisdictional framework, OPSEC for handling artifacts and infrastructure, Bug Bounty for program-specific rules.

Table of Contents​

  1. Overview
  2. Pre-Engagement & Authorization
  3. Quick Reference
  4. Research Methodology
  5. Reconnaissance & Attack Surface Mapping
  6. Static Analysis
  7. Dynamic Analysis & Fuzzing
  8. Binary Exploitation
  9. Memory Corruption Vulnerabilities
  10. Logic Vulnerabilities
  11. Race Conditions
  12. Privilege Escalation
  13. Exploit Development
  14. Exploit Mitigations & Bypasses
  15. CVE Process & Disclosure
  16. Bug Bounty Programs
  17. 0-Day Research Ethics
  18. Tools Reference
  19. Common Pitfalls & Risks
  20. Legal & Ethical Considerations
  21. Related SOPs

Overview​

Purpose: Comprehensive guide for discovering, analyzing, and responsibly disclosing security vulnerabilities in software and systems.

Scope:

  • Vulnerability identification methodologies
  • Binary exploitation techniques
  • Fuzzing and dynamic analysis
  • Memory corruption and logic vulnerabilities
  • Exploit development
  • Responsible disclosure processes
  • CVE assignment and publication

Prerequisites:

  • Understanding of programming (C/C++, Python, Assembly)
  • Knowledge of operating system internals
  • Familiarity with debugging tools
  • Understanding of exploitation mitigations

Related SOPs: see Related SOPs at the foot of this document.


Pre-Engagement & Authorization​

Vulnerability research that touches third-party software, infrastructure, or live services requires explicit authorization. Lab work on your own targets is the only universally safe default.

Authorization Checklist​

  • Target is your own code, a CTF/lab VM you control, or covered by a bug-bounty / VDP scope or signed engagement letter.
  • Scope of allowed activity (fuzzing, exploitation, post-exploitation, lateral movement) is in writing.
  • Halt criteria, rules of engagement, and emergency contacts are documented.
  • Production systems, real user data, and out-of-scope assets are explicitly excluded.
  • Disclosure pathway (vendor PSIRT, CNA, platform triage queue) is identified before testing begins.
  • Jurisdictional constraints reviewed — see Legal & Ethics for CFAA / Computer Misuse Act / Cybercrime Directive framing.

Lab Environment Requirements​

  • Air-gapped or NAT'd VM/container; no shared credentials with personal/work hosts.
  • Snapshots before each fuzzing campaign; revert after instrumentation changes.
  • Outbound network restricted to a controlled test endpoint when exploit PoCs include network primitives.
  • Research artifacts (crash inputs, minimized PoCs, mutated corpora) labelled and stored per OPSEC guidance; destroy or hand off per disclosure agreement.

Disclosure-Ready Posture​

Before crashes turn into a write-up, line up: vendor security contact (security.txt, PSIRT page, HackerOne / Bugcrowd handle), encrypted-channel option (PGP key, Signal, platform-managed inbox), CNA path (vendor CNA, MITRE root, GitHub Security Advisories), and a private artifact repo. Re-disclosing under pressure tends to leak details — pre-stage the comms.


Quick Reference​

Vulnerability Categories​

CategoryImpactCommon Vectors
Memory CorruptionCriticalBuffer overflow, use-after-free, heap overflow
InjectionCriticalSQL injection, command injection, XXE
Authentication BypassCriticalLogic flaws, weak crypto, session issues
Privilege EscalationCriticalKernel bugs, SUID binaries, misconfigurations
Information DisclosureMedium-HighMemory leaks, verbose errors, directory traversal
Denial of ServiceMediumResource exhaustion, null pointer dereference
Logic FlawsVariableRace conditions, business logic bypass

Critical Commands​

# Fuzzing with AFL++
afl-fuzz -i input_corpus/ -o findings/ -- ./target_binary @@

# Debugging with GDB
gdb -q ./target_binary
> run $(python3 -c 'print("A"*100)')

# Find SUID binaries (privilege escalation)
find / -perm -4000 -type f 2>/dev/null

# Binary security analysis (pwntools; slimm609 checksec 3.x: checksec file ./binary) [verify 2026-10-31]
pwn checksec ./binary

Common Exploit Patterns​

Payload construction is out of scope for this SOP (see Binary Exploitation). Triage and exploitability notes per bug class:


Research Methodology​

Vulnerability Discovery Process​

1. Target Selection:

# Choose research target based on:
# - Attack surface (network services, parsers, browsers)
# - Complexity (more code = more bugs)
# - Impact (kernel, authentication, crypto)
# - Accessibility (open-source vs. closed-source)

# Examples of high-value targets:
# - Web browsers (Chrome, Firefox, Safari)
# - Operating system kernels (Linux, Windows, macOS)
# - Network services (SSH, HTTP servers, DNS)
# - File parsers (PDF, image formats, office documents)
# - Hypervisors (VMware, VirtualBox, Hyper-V)

2. Information Gathering:

# Collect information about target
# - Version numbers
# - Build configuration
# - Dependencies
# - Previous vulnerabilities (CVE database)
# - Patch history

# Check existing CVEs / known exploits
searchsploit openssh 7.4 # Exploit-DB local mirror
nvdlib / curl https://services.nvd.nist.gov/rest/json/cves/2.0?keywordSearch=openssh+7.4
# (NVD API 2.0 is the supported endpoint; legacy 1.0 was retired in 2023)

# GitHub Security Advisories (web): https://github.com/advisories?query=openssh
# CISA Known Exploited Vulnerabilities: https://www.cisa.gov/known-exploited-vulnerabilities-catalog
# National Vulnerability Database: https://nvd.nist.gov/

3. Attack Surface Analysis:

# Identify entry points:
# - Network ports and protocols
# - File parsers
# - User input handling
# - IPC mechanisms
# - API endpoints

# Example: Web server attack surface
nmap -sV -sC -p- target.com
# - HTTP/HTTPS (80, 443)
# - Admin panels
# - File upload functionality
# - API endpoints
# - WebSocket connections

4. Code Review (if source available):

# Search for dangerous functions
grep -r "strcpy\|strcat\|sprintf\|gets" source_code/
grep -r "memcpy\|strncpy\|strncat" source_code/
grep -r "malloc\|free\|realloc" source_code/

# Look for common patterns
# - Unbounded loops
# - Integer overflows
# - Missing input validation
# - Race conditions (TOCTOU)
# - Improper error handling

5. Binary Analysis (if closed-source):

# Reverse engineer binary (see Reverse-Engineering.md)
# - Disassembly with IDA Pro, Ghidra, Binary Ninja
# - Identify vulnerabilities in assembly
# - Reconstruct high-level logic

6. Fuzzing (automated testing):

# Generate test cases to trigger crashes
# - AFL++, LibFuzzer, Honggfuzz
# - Coverage-guided fuzzing
# - Mutation-based fuzzing
# - Generation-based fuzzing (grammar)

7. Vulnerability Confirmation:

# Reproduce crash reliably
# Analyze crash (debugger, core dump)
# Determine exploitability
# Develop proof-of-concept exploit

8. Responsible Disclosure:

# Report to vendor
# Wait for patch development
# Coordinate public disclosure
# Request CVE assignment

Reconnaissance & Attack Surface Mapping​

Network Service Enumeration​

# Full port scan
nmap -p- --min-rate 10000 -T4 target.com -oN nmap_all_ports.txt

# Service version detection
nmap -sV -sC -p 21,22,80,443,3306,8080 target.com -oN nmap_services.txt

# Vulnerability scanning
nmap --script vuln -p 80,443 target.com

# Banner grabbing
nc -v target.com 80
HEAD / HTTP/1.0

# SSL/TLS version enumeration
nmap --script ssl-enum-ciphers -p 443 target.com

Application Fingerprinting​

# Web server fingerprinting
whatweb -v target.com
wafw00f target.com # WAF detection

# CMS detection
wpscan --url http://target.com # WordPress
droopescan scan drupal -u http://target.com # Drupal

# Technology stack
curl -I http://target.com
# Look for: Server, X-Powered-By, X-AspNet-Version headers

# JavaScript libraries: save the site's JS locally first (retire.js scans folders, not URLs) [verify 2026-10-31]
retire --path ./site_js/

# Check robots.txt and sitemap
curl http://target.com/robots.txt
curl http://target.com/sitemap.xml

Binary Surface Analysis​

# List imported functions (potential attack surface)
objdump -T ./binary | grep -E "strcpy|memcpy|system|exec"

# Radare2 analysis
r2 -A ./binary
> afl # List functions
> ii # List imports
> iz # List strings

# Identify file parsers
strings ./binary | grep -i "png\|jpg\|pdf\|xml"

# Network-related functions
strings ./binary | grep -i "socket\|connect\|recv\|send"

Static Analysis​

Source Code Analysis​

Manual code review - dangerous patterns:

// ❌ Buffer overflow - unbounded copy
char buffer[64];
strcpy(buffer, user_input); // No length check!

// ✅ Safe version
strncpy(buffer, user_input, sizeof(buffer) - 1);
buffer[sizeof(buffer) - 1] = '\0';

// ❌ Format string vulnerability
printf(user_input); // User controls format string!

// ✅ Safe version
printf("%s", user_input);

// ❌ Integer overflow
int size = user_size;
char *buf = malloc(size); // What if user_size is negative or huge?
memcpy(buf, data, size);

// ✅ Safe version
if (user_size <= 0 || user_size > MAX_SIZE) {
return -1;
}
size_t size = (size_t)user_size;
char *buf = malloc(size);

// ❌ Use-after-free
free(ptr);
ptr->field = value; // Use after free!

// ✅ Safe version
free(ptr);
ptr = NULL;

Common vulnerability patterns:

// Integer overflow leading to buffer overflow
void vulnerable(int count) {
char *buffer = malloc(count * sizeof(int)); // count * 4 can overflow!
if (!buffer) return;

for (int i = 0; i < count; i++) {
((int*)buffer)[i] = get_data(); // Heap overflow if count * 4 wrapped
}
}

// Time-of-check to time-of-use (TOCTOU)
if (access("/tmp/file", W_OK) == 0) { // Check
// Attacker can replace /tmp/file with symlink here!
FILE *f = fopen("/tmp/file", "w"); // Use
}

// Race condition
if (global_counter < MAX) { // Thread 1 checks
// Thread 2 can increment here
global_counter++; // Thread 1 increments (can exceed MAX)
}

// SQL injection (interpreted language)
query = "SELECT * FROM users WHERE username='" + user_input + "'"
# user_input = "admin' OR '1'='1" → authentication bypass

Automated Static Analysis​

Cppcheck (C/C++):

# Install
sudo apt install cppcheck

# Basic scan
cppcheck --enable=all --inconclusive source_code/

# Specific checks
cppcheck --enable=warning,performance,portability source_code/

# XML output for further analysis
cppcheck --xml --xml-version=2 source_code/ 2> report.xml

Semgrep (multi-language):

# Install
pip install semgrep

# Scan with default rules
semgrep --config=auto source_code/

# Security-focused scan
semgrep --config=p/security-audit source_code/

# OWASP Top 10 rules
semgrep --config=p/owasp-top-ten source_code/

# Custom rule example (detect dangerous strcpy)
cat > strcpy_rule.yaml << 'EOF'
rules:
- id: dangerous-strcpy
pattern: strcpy($DST, $SRC)
message: Unsafe strcpy detected - use strncpy instead
languages: [c, cpp]
severity: WARNING
EOF

semgrep --config=strcpy_rule.yaml source_code/

Clang Static Analyzer:

# Analyze during build
scan-build make

# Specific file
clang --analyze vulnerable.c

FlawFinder (C/C++):

# Install
sudo apt install flawfinder

# Scan source code
flawfinder source_code/

# Minimum risk level
flawfinder --minlevel=4 source_code/

# HTML report
flawfinder --html source_code/ > report.html

Dynamic Analysis & Fuzzing​

Fuzzing Fundamentals​

Types of fuzzing:

  1. Mutation-based - Mutate existing valid inputs
  2. Generation-based - Generate inputs from grammar/specification
  3. Coverage-guided - Use code coverage feedback to guide input generation
  4. Symbolic / concolic execution - Explore program paths systematically (KLEE, SymCC, Sydr, Manticore)
  5. In-process / persistent - Re-enter target many times per process (libFuzzer-style harnesses, AFL++ persistent mode, Honggfuzz -P)
  6. Snapshot fuzzing - Restore VM/process state between iterations (Nyx, what-the-fuzz, snapchange) for kernel and large stateful targets

Modern toolchain status (2026-10):

  • AFL++ — actively maintained (5.x series; latest v5.03c, September 2026), recommended default for native binaries; ships LTO mode, CmpLog, persistent harnesses, QEMU/Unicorn instrumentation. [verify 2026-10-31]
  • libFuzzer — bundled with LLVM/Clang (-fsanitize=fuzzer); its original authors have stopped active work on it and moved to the Centipede engine, so it gets bug fixes only, no major new features. New harnesses still work. Prefer running libFuzzer harnesses through OSS-Fuzz (https://google.github.io/oss-fuzz/) when the target qualifies. [verify 2026-10-31]
  • Honggfuzz — still functional; release cadence has slowed. Strong for persistent-mode network/parser fuzzing.
  • LibAFL (https://github.com/AFLplusplus/LibAFL) — Rust framework for building bespoke fuzzers; the modern replacement for "I need a custom mutator/scheduler" workflows.
  • OSS-Fuzz — Google's continuous fuzzing service for open-source projects. Free for qualifying projects; integrates AFL++, libFuzzer, Honggfuzz, Centipede behind a common harness API.
  • syzkaller (https://github.com/google/syzkaller) — coverage-guided Linux/Windows/FreeBSD/Fuchsia kernel syscall fuzzer. Pair with KCOV (kernel coverage) and kASAN/KMSAN/KCSAN (kernel sanitizers).
  • Language-native:
    • Rust → cargo-fuzz (libFuzzer backend) or cargo afl (AFL++).
    • Go ≥ 1.18 → built-in go test -fuzz=. No external tool needed.
    • Python → Atheris (Google, libFuzzer-backed).
    • Java/Kotlin → Jazzer (Code Intelligence, libFuzzer-backed).
    • JavaScript/V8 → Fuzzilli for engine fuzzing.

Coverage instrumentation flags (clang):

# SanitizerCoverage primitives (sancov) — feed coverage to your fuzzer
clang -fsanitize=fuzzer-no-link -fsanitize-coverage=trace-pc-guard,trace-cmp ...

# AFL++ LTO mode (best edge coverage on supported toolchains)
afl-clang-lto -o target target.c

# Combine fuzzer + sanitizers
clang -g -O1 -fsanitize=fuzzer,address,undefined harness.c target.c -o harness

AFL++ (American Fuzzy Lop plus plus)​

Installation:

# Linux
sudo apt install afl++

# Or build from source
git clone https://github.com/AFLplusplus/AFLplusplus.git
cd AFLplusplus
make
sudo make install

Compile target for fuzzing:

# Instrument binary with AFL++ compiler (afl-gcc/afl-clang were removed upstream) [verify 2026-10-31]
afl-cc -o target_fuzz target.c

# Or with additional sanitizers
AFL_USE_ASAN=1 afl-cc -o target_fuzz target.c # AddressSanitizer
AFL_USE_UBSAN=1 afl-cc -o target_fuzz target.c # UndefinedBehaviorSanitizer
AFL_USE_MSAN=1 afl-clang-fast -o target_fuzz target.c # MemorySanitizer (needs clang/LLVM mode)

Prepare input corpus:

# Create directory with seed inputs
mkdir input_corpus
echo "valid input 1" > input_corpus/input1.txt
echo "another valid input" > input_corpus/input2.txt

# For binary formats, use valid files
cp valid_image.png input_corpus/
cp valid_pdf.pdf input_corpus/

Run fuzzer:

# Basic fuzzing
afl-fuzz -i input_corpus/ -o findings/ -- ./target_fuzz @@

# Explanation:
# -i input_corpus/ : Input directory with seed files
# -o findings/ : Output directory for crashes/hangs
# @@ : Replaced with fuzzer-generated filename

# Multiple fuzzers in parallel (recommended)
# Master fuzzer
afl-fuzz -i input_corpus/ -o findings/ -M fuzzer01 -- ./target_fuzz @@

# Slave fuzzers (in separate terminals)
afl-fuzz -i input_corpus/ -o findings/ -S fuzzer02 -- ./target_fuzz @@
afl-fuzz -i input_corpus/ -o findings/ -S fuzzer03 -- ./target_fuzz @@

# For stdin input (no @@)
afl-fuzz -i input_corpus/ -o findings/ -- ./target_fuzz

# With custom dictionary
afl-fuzz -i input_corpus/ -o findings/ -x dictionary.txt -- ./target_fuzz @@

Dictionary example (for format-aware fuzzing):

# dictionary.txt - PDF format
keyword_obj="obj"
keyword_endobj="endobj"
keyword_stream="stream"
keyword_endstream="endstream"
keyword_PDF="%PDF-"
magic_header="%PDF-1.4"

Analyze results:

# Check fuzzer status
# Key metrics:
# - execs/s: Executions per second (higher = better)
# - unique crashes: Number of unique crash signatures
# - unique hangs: Number of unique timeouts

# Reproduce crash (a run without -M/-S writes to findings/default/) [verify 2026-10-31]
./target_fuzz findings/default/crashes/id:000000,sig:11,src:000000,op:havoc,rep:16

# Triage crashes: CASR writes one report per crash, then deduplicates and clusters them [verify 2026-10-31]
casr-afl -i findings/ -o casr_out/

# Minimize crash input
afl-tmin -i findings/default/crashes/id:000000,* -o minimal_crash -- ./target_fuzz @@

# Campaign status: every fuzzer plus a summary (-s for the summary only)
afl-whatsup findings/

LibFuzzer (LLVM)​

Compile with LibFuzzer:

# Create fuzzing harness
cat > fuzz_target.c << 'EOF'
#include <stdint.h>
#include <stddef.h>

// Fuzzing entry point
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
// Call target function with fuzzer-provided data
if (size > 0) {
process_input(data, size);
}
return 0;
}
EOF

# Compile with clang
clang -g -fsanitize=fuzzer,address -o fuzz_target fuzz_target.c target.c

Run fuzzer:

# Basic fuzzing
./fuzz_target corpus/

# With options
./fuzz_target corpus/ -max_len=4096 -timeout=1 -rss_limit_mb=2048

# Merge corpora
./fuzz_target -merge=1 merged_corpus/ corpus1/ corpus2/

# Minimize corpus
./fuzz_target -merge=1 minimized_corpus/ full_corpus/

Honggfuzz​

# Install: no package in Ubuntu 24.04; build from source [verify 2026-10-31]
sudo apt-get install binutils-dev libunwind-dev libblocksruntime-dev clang
git clone https://github.com/google/honggfuzz.git && cd honggfuzz && make && sudo make install

# Run fuzzer
honggfuzz -i input_corpus/ -o output_dir/ -- ./target_binary ___FILE___

# With persistent mode (faster)
honggfuzz -i input_corpus/ -P -- ./target_binary

Kernel Fuzzing (syzkaller + KCOV + kASAN)​

Kernel bugs are reached through syscalls and ioctls, not file inputs. The standard stack is syzkaller (syscall description language syzlang, generates programs, manages VMs, triages crashes) plus a coverage-instrumented kernel.

# 1. Build a coverage + sanitizer kernel
# In Linux kernel .config:
# CONFIG_KCOV=y # coverage feedback for syzkaller
# CONFIG_KASAN=y # address sanitizer (heap/oob/UAF)
# CONFIG_KASAN_INLINE=y
# CONFIG_DEBUG_INFO=y
# CONFIG_DEBUG_INFO_DWARF4=y
# CONFIG_KCSAN=y # data-race detector (optional)
# CONFIG_KMSAN=y # uninit-memory (clang only, optional)
# CONFIG_BUG_ON_DATA_CORRUPTION=y
make -j"$(nproc)"

# 2. Build syzkaller
git clone https://github.com/google/syzkaller
cd syzkaller && make

# 3. Run against a QEMU image
./bin/syz-manager -config my.cfg
# my.cfg points at the bzImage, root FS image, and a workdir for crashes/cover.

Crash artifacts arrive as a reproducer C program (repro.c) plus the coverage trace. Triage with syz-execprog and syz-prog2c, then minimise.

For Windows kernel see kAFL/Nyx (snapshot, hardware-assisted) and what-the-fuzz; for hypervisors/firmware see Nyx + Intel PT.

Structure-Aware Harnessing​

Coverage-guided fuzzers stall on heavily-checked formats (signed binaries, CRC'd containers, ASN.1, protobuf). Options:

  • Custom mutators — AFL++ AFL_CUSTOM_MUTATOR_LIBRARY, libFuzzer LLVMFuzzerCustomMutator.
  • Grammar-based — Nautilus, Grammarinator, Domato (browser DOM), AFL++ grammar mutator.
  • Protocol Buffers — libprotobuf-mutator (Google), produces structurally-valid messages.
  • Dictionaries first — cheap win before reaching for grammar tooling (-x dictionary.txt).

Network Protocol Fuzzing​

Boofuzz framework:

from boofuzz import *

# Define session (SocketConnection is deprecated since boofuzz 0.2.0) [verify 2026-10-31]
session = Session(target=Target(connection=TCPSocketConnection("192.168.1.100", 8080)))

# Define protocol
s_initialize("HTTP Request")
s_string("GET", fuzzable=False)
s_delim(" ", fuzzable=False)
s_string("/index.html") # Fuzzable field
s_delim(" ", fuzzable=False)
s_string("HTTP/1.1", fuzzable=False)
s_delim("\r\n", fuzzable=False)
s_string("Host:")
s_delim(" ", fuzzable=False)
s_string("localhost")
s_static("\r\n\r\n")

# Start fuzzing
session.connect(s_get("HTTP Request"))
session.fuzz()

Radamsa (mutation-based fuzzer):

# Install: no package in Ubuntu 24.04; build from source [verify 2026-10-31]
git clone https://gitlab.com/akihe/radamsa.git && cd radamsa && make && sudo make install

# Generate mutated inputs
cat valid_input.bin | radamsa -n 1000 -o output_%n.bin

# Fuzz in loop
while true; do
radamsa input.txt > fuzzed.txt
./target_binary fuzzed.txt
done

Binary Exploitation​

Everything in this section runs against lab binaries you built yourself. It covers reproduction, crash triage and exploitability assessment. Payload construction (ROP chains, shellcode, heap grooming, %n writes) is out of scope: the report deliverable is the minimal PoC defined under Determining Exploitability.

Lab Build Flags​

Build lab targets with the protection you are studying switched off explicitly, and record the exact build command in your notes. The defaults below are Ubuntu 24.04 (GCC 13.3, glibc 2.39); other distributions differ, so run pwn checksec after every build. For a -z execstack build, pwntools 4.15 prints NX unknown - GNU_STACK missing; trust readelf -lW for NX. [verify 2026-10-31]

MitigationOff (lab)On (hardened)Confirm
Stack canary-fno-stack-protector-fstack-protector-strongpwn checksec: Stack: No canary found / Canary found [verify 2026-10-31]
Non-executable stack (NX)-z execstackdefault (-z noexecstack)readelf -lW GNU_STACK flags: RWE / RW [verify 2026-10-31]
PIE-no-pie-fPIE -pie (Ubuntu default)PIE: No PIE (0x400000) / PIE enabled [verify 2026-10-31]
RELRO-Wl,-z,norelro (No RELRO); -no-pie alone gives Partial RELRO-Wl,-z,relro,-z,now (Full RELRO; Ubuntu default for PIE)RELRO: line [verify 2026-10-31]
FORTIFY_SOURCE-U_FORTIFY_SOURCE, or build at -O0 (Ubuntu predefines nothing there)-O2 -D_FORTIFY_SOURCE=3 (Ubuntu predefines level 3 at -O1 and above)FORTIFY: Enabled [verify 2026-10-31]
CET markings (IBT, SHSTK)-fcf-protection=none-fcf-protection=full (Ubuntu default)SHSTK / IBT lines; these read the ELF marking, enforcement depends on CPU, kernel and glibc [verify 2026-10-31]
ASLRsetarch -R ./binary (one process); GDB already disables it for the debuggeekernel.randomize_va_space = 2 (default)cat /proc/sys/kernel/randomize_va_space; in GDB, show disable-randomization [verify 2026-10-31]
  • The stack example under Memory Corruption Vulnerabilities is built with gcc -g -O0 -fno-stack-protector -no-pie. The 72-byte offset quoted in this section holds for that build only.
  • -fhardened switches on the hardened set in one flag from GCC 14; GCC 13.3 rejects it. [verify 2026-10-31]
  • Sanitizer builds on Ubuntu: -O1 predefines _FORTIFY_SOURCE=3, so strcpy becomes __strcpy_chk and glibc aborts with *** buffer overflow detected ***: terminated before ASan reports anything. Add -U_FORTIFY_SOURCE. [verify 2026-10-31]
# Lab build used for the stack example (no canary, no PIE, Partial RELRO; NX stays on) [verify 2026-10-31]
gcc -g -O0 -fno-stack-protector -no-pie -o vulnerable_binary vuln.c
pwn checksec ./vulnerable_binary

# Sanitizer build for root-cause triage (-U_FORTIFY_SOURCE so ASan, not FORTIFY, reports the bug)
gcc -g -O1 -fno-omit-frame-pointer -fsanitize=address,undefined -U_FORTIFY_SOURCE -o vulnerable_asan vuln.c

Crash Analysis​

Root cause first: rerun under ASan/UBSan. A sanitizer report names the bug class, the access size and the code location before you open a debugger. Read it top-down: the ERROR: line gives the class (stack-buffer-overflow, heap-buffer-overflow, heap-use-after-free, attempting double-free), the next line gives the access (WRITE of size 101), and heap reports add "freed by" and "previously allocated by" stacks. Map the class to the CWE given for each bug class under Memory Corruption Vulnerabilities. Flag reference: Sanitizers (Debugging) under Tools Reference.

UBSAN_OPTIONS=print_stacktrace=1 ./vulnerable_asan "$(python3 -c 'print("A"*100)')"
# Lab output (GCC 13.3) [verify 2026-10-31]:
# ==PID==ERROR: AddressSanitizer: stack-buffer-overflow on address ...
# WRITE of size 101 at ... thread T0
# SUMMARY: AddressSanitizer: stack-buffer-overflow ... in strcpy

Analyzing crashes with GDB:

# Run program in GDB
gdb -q ./vulnerable_binary
# Set a breakpoint
(gdb) break vulnerable_function

# Run with input, then continue to the crash
(gdb) run "$(python3 -c 'print("A"*200)')"
(gdb) continue

# After the SIGSEGV, examine registers
(gdb) info registers
# x86-64: the smashed return address is non-canonical, so the fault is ON ret [verify 2026-10-31]
# RIP still points at ret and the overwritten slot is at [rsp]
(gdb) x/i $pc # => 0x401196 <vulnerable_function+64>: ret
(gdb) x/gx $rsp # 0x4141414141414141
# x86 (32-bit): the fault is on the fetch, so EIP = 0x41414141

# Examine stack in 8-byte units ($rbp now holds attacker data, so x/... $rbp fails)
(gdb) x/40gx $rsp

# Backtrace
(gdb) bt

# Examine memory at address
(gdb) x/s 0x7fffffffe000

# Offset to the saved return address (plain GDB + pwntools CLI) [verify 2026-10-31]
# Fresh session, no breakpoints:
(gdb) run "$(pwn cyclic 200)"
(gdb) x/wx $rsp # low 4 bytes of the saved slot: 0x61616173 ("saaa")
# In a shell: pwn cyclic -l 0x61616173 -> 72

The scripted version of the offset measurement is under Buffer Overflow → "Measuring the offset with pwntools".

GEF (GDB Enhanced Features):

# Install GEF
bash -c "$(curl -fsSL https://gef.blah.cat/sh)"

# Launch GDB with GEF
gdb -q ./binary
# GEF commands
gef> checksec # Check binary protections
gef> vmmap # Memory mappings
gef> search-pattern "AAAA"
gef> heap chunks # Heap analysis

# Offset (plain GDB has no pattern command; "pattern offset" is an alias of "pattern search") [verify 2026-10-31]
gef> pattern create 200 # n=8 on x86-64
gef> run "<paste pattern>"
gef> pattern search $rsp # x86-64: search the saved slot, not $rip -> offset 72

pwndbg (https://github.com/pwndbg/pwndbg) has equivalents; its cyclic uses 4-byte subsequences by default. [verify 2026-10-31]

pwndbg> checksec
pwndbg> cyclic 200
pwndbg> run "<paste pattern>"
pwndbg> x/wx $rsp
pwndbg> cyclic -l 0x61616173 # -> 72

Core dump analysis:

# Enable core dumps
ulimit -c unlimited

# Where the core lands depends on core_pattern [verify 2026-10-31]:
# core -> ./core in the working directory
# |/usr/share/apport/apport ... -> /var/lib/apport/coredump/ (Ubuntu)
# |.../systemd-coredump ... -> coredumpctl list; coredumpctl dump &lt;PID&gt; -o core
cat /proc/sys/kernel/core_pattern

# Run program (crashes and dumps core)
./vulnerable_binary "$(python3 -c 'print("A"*200)')"

# Analyze core dump (use the path that core_pattern gives)
gdb ./vulnerable_binary core
# Examine crash state
(gdb) bt
(gdb) x/i $pc
(gdb) x/gx $rsp

Record and replay (rr): record the failing run once, then debug the recording deterministically. Reverse execution takes you from the crash back to the write that corrupted the slot. [verify 2026-10-31]

rr record ./vulnerable_binary "$(python3 -c 'print("A"*200)')"
rr replay
(gdb) continue # runs to the recorded SIGSEGV
(gdb) watch -l *(long *)$rsp # watch the overwritten return slot
(gdb) reverse-continue # stops at the last write to it (here, inside strcpy)

Determining Exploitability​

EXPLOITABLE GDB plugin (jfoote/exploitable: no upstream changes since 2022; works on live processes, not core files):

# Install
git clone https://github.com/jfoote/exploitable.git ~/exploitable
echo "source ~/exploitable/exploitable/exploitable.py" >> ~/.gdbinit

# Use in GDB
gdb ./binary
(gdb) run "$(python3 -c 'print("A"*200)')"
(gdb) exploitable

# Output (x86-64 lab crash, GDB 15.1; also prints a distutils DeprecationWarning) [verify 2026-10-31]:
# Description: Access violation during return instruction
# Short description: ReturnAv (1/22)
# Exploitability Classification: EXPLOITABLE

CASR (https://github.com/ispras/casr, v2.13.1, May 2026) is the maintained option. It builds crash reports with a severity class from sanitizer output, GDB or core files, then deduplicates and clusters them. [verify 2026-10-31]

casr-san -o asan.casrep -- ./vulnerable_asan "$(python3 -c 'print("A"*100)')"
casr-gdb -o crash.gdb.casrep -- ./vulnerable_binary "$(python3 -c 'print("A"*200)')"

Manual exploitability assessment:

1. Control of EIP/RIP?
- x86-64: is the saved return slot at [rsp] attacker-controlled when the fault hits ret?
- Can you redirect execution?
- YES → Highly exploitable

2. Control of data written?
- Can you control what is written where?
- YES (write-what-where) → Exploitable

3. Information leak?
- Can you leak addresses (bypass ASLR)?
- Can you leak stack canary?

4. Heap corruption?
- Use-after-free?
- Double-free?
- Heap overflow?

5. Available gadgets?
- ROP gadgets for exploitation?
- System calls available?

6. Mitigations in place?
- pwn checksec: canary, NX, PIE, RELRO, FORTIFY, SHSTK/IBT
- glibc version (heap bugs) and kernel settings (ASLR, protected_symlinks)

Minimal-PoC standard (report deliverable):

  • A PoC proves control with a harmless effect and stops there. Acceptable forms: a deterministic crashing input plus its sanitizer report; or, for control-flow bugs, execution redirected to a benign function in the lab build (for example a win() that prints a marker string), with the marker visible in the output.
  • Never a shell, shellcode, a ROP chain to system/execve, or a payload aimed at a system you do not own or are not authorized to test.
  • Ship it with the build command (see Lab Build Flags), the toolchain and glibc versions, the input file and its SHA-256, and the single command that reproduces the result.

Memory Corruption Vulnerabilities​

Buffer Overflow​

Stack buffer overflow (CWE-121): a write past the end of a stack buffer overwrites the frame data next to it: the saved frame pointer, then the saved return address. Here strcpy copies argv[1] into char buffer[64] with no length check. In the lab build the saved return address starts 72 bytes into the input (64-byte buffer + 8-byte saved RBP). [verify 2026-10-31]

  • Detect and confirm: ASan reports stack-buffer-overflow ... WRITE of size N in strcpy; in GDB the fault is at ret with your input at [rsp] (see Crash Analysis).
  • What blocks the classic technique: the canary aborts with *** stack smashing detected ***: terminated. FORTIFY_SOURCE turns strcpy into __strcpy_chk, which aborts earlier with *** buffer overflow detected ***: terminated when the buffer size is known at compile time. NX stops injected stack bytes from executing, and PIE plus ASLR randomize the addresses an overwrite would need. [verify 2026-10-31]
// Vulnerable code
#include <stdio.h>
#include <string.h>

void vulnerable_function(char *user_input) {
char buffer[64];
strcpy(buffer, user_input); // No bounds checking
printf("Input: %s\n", buffer);
}

int main(int argc, char **argv) {
if (argc > 1) {
vulnerable_function(argv[1]);
}
return 0;
}

Measuring the offset with pwntools:

from pwn import *

# Generate cyclic pattern (lowercase letters only, so it is safe in argv)
pattern = cyclic(200)

# Run program: the target reads argv[1], not stdin [verify 2026-10-31]
p = process(["./vulnerable_binary", pattern])
p.wait()

# Get core dump
core = p.corefile

# x86-64: the fault is at ret, so the pattern sits at [rsp]; cyclic_find matches 4-byte subsequences
offset = cyclic_find(core.read(core.rsp, 4))
print(f"Offset: {offset}") # 72 with the lab build

From offset to report: the offset only measures control. Stop at the minimal-PoC standard under Determining Exploitability, for example returning into a win() marker function in the lab build. This SOP does not reproduce return-address payloads.

Heap Exploitation​

Whether a classic heap technique still works depends on the glibc version. glibc 2.29 added tcache double-free detection, 2.32 added safe-linking of the tcache and fastbin pointers, and 2.34 removed __malloc_hook and __free_hook. [verify 2026-10-31] For the per-technique table, see glibc Version Limits for Heap Techniques under Exploit Development.

Use-After-Free (UAF, CWE-416):

// Vulnerable code
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct User {
char name[32];
void (*print_user)(struct User *);
};

void print_user_info(struct User *u) {
printf("User: %s\n", u->name);
}

int main(void) {
struct User *user = malloc(sizeof(struct User));
user->print_user = print_user_info;
strcpy(user->name, "Alice");

free(user); // Free user object

// Later... (user pointer still used)
user->print_user(user); // Use-after-free! Calls whatever now occupies offset 32
return 0;
}
  • What it is: the program calls through user after free(user). sizeof(struct User) is 40 and print_user sits at offset 32. glibc hands the freed chunk to the next allocation of the same size class (tcache is LIFO), so whatever that new owner writes at offset 32 becomes the pointer user->print_user(user) calls. [verify 2026-10-31]
  • Detect and confirm: ASan reports heap-use-after-free ... READ of size 8 (the function-pointer load), followed by a "freed by thread T0 here" stack and a "previously allocated by thread T0 here" stack. Together they give the use, free and allocation sites. [verify 2026-10-31]
  • Limits: glibc does not detect the stale use itself. Safe-linking (2.32) means tcache poisoning needs a heap address leak, and the hook removal (2.34) takes __free_hook away as a target; neither stops the stale call. Fix at the source: one owner per object, and set the pointer to NULL after free.

Heap overflow (CWE-122):

// Vulnerable code
#include <stddef.h>
#include <string.h>

struct Chunk {
size_t size;
char data[128];
struct Chunk *next;
};

void process_data(struct Chunk *chunk, char *user_input, size_t len) {
memcpy(chunk->data, user_input, len); // No bounds check on len!
}
  • What it is: memcpy trusts the caller's len. On x86-64, size is at offset 0, data at 8 and next at 136, and sizeof(struct Chunk) is 144. An overflow of data first overwrites next inside the same object (size comes before data and is out of reach), then runs off the end of the allocation into the next chunk's header. [verify 2026-10-31]
  • Detect and confirm: ASan only flags bytes past the end of the allocation. In a lab harness, len 136 overwrote next with no report, and len 137 gave heap-buffer-overflow ... WRITE of size 137 ... 0 bytes after 144-byte region. Confirm the in-object part in GDB with watch -l chunk->next. [verify 2026-10-31]
  • Limits: what an overflow into the neighbouring chunk header can still achieve depends on the glibc version (see the pointer above). Fix: reject len > sizeof chunk->data.

Double-free (CWE-415):

// Vulnerable code (fragment: ptr came from malloc)
free(ptr);
free(ptr); // Double-free!
  • What it is: freeing the same chunk twice puts it on a free list twice, so two later allocations can return the same memory.
  • Detect and confirm: glibc 2.29 and later catch this naive case and abort (exit status 134 on glibc 2.39) with free(): double free detected in tcache 2. ASan reports attempting double-free. [verify 2026-10-31]
  • Limits: variants that sidestep the tcache check exist, and each is limited to certain glibc versions; see glibc Version Limits for Heap Techniques under Exploit Development.

Format String Vulnerability​

Vulnerable code:

void vulnerable(char *user_input) {
printf(user_input); // User controls format string!
}
  • What it is (CWE-134): user data is passed as the format argument. Each conversion reads a variadic argument the caller never passed (%p, %s), and %n stores the number of characters printed so far through one. The same bug is therefore both an information leak and a write primitive.
  • Detect and confirm: GCC with -Wformat -Wformat-security warns format not a string literal and no format arguments. At runtime, input such as AAAAAAAA.%p.%p.%p.%p.%p.%p that comes back as pointer values (0x7fff..., (nil)) instead of the literal text confirms it. On x86-64, %1$p to %5$p read rsi, rdx, rcx, r8 and r9, and stack slots start at %6$p; where your own input sits is binary-specific. [verify 2026-10-31]
  • What blocks the classic technique: with _FORTIFY_SOURCE at 2 or higher (Ubuntu predefines 3 at -O1 and above), glibc aborts on %n in a writable format string (*** %n in writable segment detected ***) and on positional arguments with gaps (*** invalid %N$ use detected ***). Full RELRO (the Ubuntu default for PIE) makes the GOT read-only, which removes the classic GOT-overwrite target. [verify 2026-10-31]
  • Fix: printf("%s", user_input).

Integer Overflow​

Vulnerable code:

#include <stdlib.h>
#include <string.h>

void process_image(int width, int height, char *image_data) {
int size = width * height; // Signed overflow: undefined behaviour

if (size < 0) {
return; // Insufficient check: a truncated product can still be positive
}

char *buffer = malloc(size); // Allocates the truncated size
for (int y = 0; y < height; y++) { // Copies the real width x height bytes
memcpy(buffer + (size_t)y * width, image_data + (size_t)y * width, width); // Heap overflow
}
}

// Lab trigger: width=0x10001, height=0x10000 -> size 0x10000 (64 KiB), each row copies 0x10001 bytes
  • What it is (CWE-190): width * height overflows int. Signed overflow is undefined behaviour in C (C11 §6.5p5), not a defined wrap; only unsigned arithmetic is reduced modulo (§6.2.5p9). At -O0 on x86-64, GCC computed 0x10001 * 0x10000 as 0x10000. The allocation uses the truncated 64 KiB while the loop copies the real dimensions, so the bug surfaces as a heap overflow (CWE-122). [verify 2026-10-31]
  • Detect and confirm: build with -fsanitize=address,undefined (see Lab Build Flags). UBSan reports runtime error: signed integer overflow: 65537 * 65536 cannot be represented in type 'int', then ASan reports heap-buffer-overflow ... WRITE of size 65537 ... 0 bytes after 65536-byte region. [verify 2026-10-31]
  • Mitigation: check the arithmetic before allocating (__builtin_mul_overflow, or the CERT INT32-C pattern below) and reject non-positive dimensions.

Detection patterns:

// Unsafe arithmetic
int total = user_value1 + user_value2; // Signed overflow: undefined behaviour
int size = count * sizeof(struct item); // Computed in size_t (wraps), then truncated to int

// Safe version (CERT INT32-C: covers both signs of user_value2)
if ((user_value2 > 0 && user_value1 > INT_MAX - user_value2) ||
(user_value2 < 0 && user_value1 < INT_MIN - user_value2)) {
// Overflow would occur
return -1;
}

// Or use compiler builtins
int result;
if (__builtin_add_overflow(a, b, &result)) {
// Overflow occurred
}

Logic Vulnerabilities​

Authentication Bypass​

Common patterns:

# SQL injection in authentication (CWE-89)
username = "admin' -- "
password = "anything"
query = f"SELECT * FROM users WHERE username='{username}' AND password='{password}'"
# Result: SELECT * FROM users WHERE username='admin' -- ' AND password='anything'
# Password check is commented out!
# MySQL needs whitespace after "--" (hence the trailing space); "#" also starts a comment there [verify 2026-10-31]

# Boolean logic error
def check_password(username, password):
user = db.query(f"SELECT * FROM users WHERE username='{username}'")
if user and password: # ❌ Should check password == user.password
return True
return False

# Timing attack on comparison (CWE-208)
def verify_token(provided_token):
expected_token = get_secret_token()
for i in range(len(expected_token)):
if provided_token[i] != expected_token[i]:
return False # Returns early → timing leak
return True
# Also broken: no length check (a shorter token raises IndexError, a longer one with the right prefix passes)
# Fix: return hmac.compare_digest(provided_token, expected_token) [verify 2026-10-31]

Business Logic Flaws​

Price manipulation:

# Vulnerable checkout process (CWE-602: client-side enforcement of server-side security)
def checkout(cart_items):
total = 0
for item in cart_items:
total += item['price'] * item['quantity'] # Client-provided price!
charge_customer(total)

# Exploit: Set price to negative value
cart = [
{'item_id': 123, 'price': -100.00, 'quantity': 1},
{'item_id': 456, 'price': 50.00, 'quantity': 1}
]
# Total: -100 + 50 = -50 (a negative charge or refund, if the payment backend accepts it)

Race condition in balance check:

# Vulnerable transfer function (CWE-362)
def transfer(from_account, to_account, amount):
if get_balance(from_account) >= amount: # Check
# Race window here!
deduct_balance(from_account, amount) # Use
add_balance(to_account, amount)
else:
raise InsufficientFunds

# Exploit: Send multiple concurrent transfer requests
# Both pass balance check before first deduction

Insecure Deserialization​

Deserializing untrusted data (CWE-502) lets the sender choose which objects get built and which of their methods run.

Python pickle vulnerability:

import pickle
import os

# Malicious payload
class Exploit:
def __reduce__(self):
return (os.system, ('whoami',))

# Serialize
payload = pickle.dumps(Exploit())

# Vulnerable code
pickle.loads(payload) # Executes os.system('whoami')!

PHP unserialize vulnerability:

<?php
class User {
public $isAdmin = false;

public function __wakeup() {
if ($this->isAdmin) {
include('/flag.txt');
}
}
}

// Vulnerable code
$user = unserialize($_GET['data']);

// Exploit: ?data=O%3A4%3A%22User%22%3A1%3A%7Bs%3A7%3A%22isAdmin%22%3Bb%3A1%3B%7D
// (URL-decoded: O:4:"User":1:{s:7:"isAdmin";b:1;})
?>

Defence: the vendors say it plainly. Python: "The pickle module is not secure. Only unpickle data you trust." PHP: "Do not pass untrusted user input to unserialize() regardless of the options value of allowed_classes"; use a standard format such as JSON (json_decode() / json_encode()) instead. [verify 2026-10-31]


Race Conditions​

TOCTOU (Time-of-Check to Time-of-Use)​

Vulnerable code:

// Check if file exists and is writable
if (access("/tmp/myfile", W_OK) == 0) { // Time-of-Check
// Attacker can replace /tmp/myfile with symlink to /etc/passwd here!
FILE *f = fopen("/tmp/myfile", "w"); // Time-of-Use
fprintf(f, "data");
fclose(f);
}
  • What it is (CWE-367): the program checks a path (access()) and later uses the same path (fopen()). Anything that changes what the path points to between the two calls defeats the check. access() checks the real UID, so the race crosses a privilege boundary only in set-UID or otherwise privileged programs. [verify 2026-10-31]
  • Detect and confirm: look for a path-based check followed by a path-based use. strace -e trace=access,openat ./program shows them as two separate syscalls on the same path. [verify 2026-10-31]
  • What blocks the classic /tmp variant: with fs.protected_symlinks = 1 (the systemd default; check with sysctl fs.protected_symlinks), a symlink in a sticky world-writable directory such as /tmp is followed only when the follower's UID or the directory owner matches the symlink's owner. Reproduce in a non-sticky lab directory, or in a throwaway VM with the sysctl set to 0. [verify 2026-10-31]

Exploitation pattern (neutralised — defensive/educational scope):

The race-window attack uses two concurrent loops:

  1. Trigger loop — repeatedly invoke the vulnerable program so it re-runs the access() → fopen() window.
  2. Race loop — repeatedly recreate the path as a symlink to a sensitive target (/etc/passwd, an SUID binary, etc.) between the check and the use.

Pattern only — concrete exploit shells/symlink-target chains intentionally omitted. Background: CWE-367 (https://cwe.mitre.org/data/definitions/367.html); Drew Dean and Alan J. Hu, "Fixing Races for Fun and Profit: How to Use access(2)", USENIX Security 2004 (https://www.usenix.org/conference/13th-usenix-security-symposium/fixing-races-fun-and-profit-how-use-access2). For web and API request races, see PortSwigger "Race conditions" (https://portswigger.net/web-security/race-conditions). [verify 2026-10-31]

Mitigations (the actual point of this section):

  • Open with O_CREAT | O_EXCL (atomic: succeeds only if the file doesn't exist, and symlinks are not followed with these two flags).
  • O_NOFOLLOW refuses a symlink in the final path component only; openat2() with RESOLVE_NO_SYMLINKS refuses symlinks in every component (Linux 5.6 and later). [verify 2026-10-31]
  • For temporary files, use mkstemp(3), which opens with O_EXCL so the caller is the process that creates the file.
  • Operate on file descriptors, not paths, between check and use.

File system race conditions:

// Vulnerable: Check then create
if (stat("/tmp/logfile", &st) == -1) { // Check if doesn't exist
// Race window
FILE *f = fopen("/tmp/logfile", "w"); // Create
}

// Secure: Open with O_CREAT | O_EXCL
int fd = open("/tmp/logfile", O_CREAT | O_EXCL | O_WRONLY, 0600);
if (fd == -1) {
// File already exists
}

Multi-threaded Race Conditions​

Vulnerable code:

int balance = 1000;

void withdraw(int amount) {
if (balance >= amount) { // Thread 1 checks
// Thread 2 can also check here
usleep(100); // Simulate processing
balance -= amount; // Both threads withdraw
}
}

// Two threads call withdraw(800) concurrently.
// Both *may* pass the check, so the balance can become -600 (non-deterministic).
// The unsynchronised read-modify-write is a C11 data race: undefined behaviour.

Confirming it (CWE-362): the outcome changes from run to run. In a lab harness with two threads, six runs gave five -600 results and one 200, so a single clean run proves nothing. Run many iterations, or build with ThreadSanitizer, which flags the unsynchronised access to balance without needing the bad outcome to occur. Against a network service, the equivalent is many concurrent requests; for HTTP targets, PortSwigger's single-packet technique (link above) removes network jitter. Fix: hold one lock (or use an atomic compare-and-swap) across the check and the update. [verify 2026-10-31]

Detection with ThreadSanitizer:

# Compile with TSan (the clang docs recommend -O1 or higher) [verify 2026-10-31]
clang -fsanitize=thread -g -O1 -o program program.c
# GCC works too: gcc -fsanitize=thread -g -O1 -o program program.c

# Run (on Ubuntu 24.04 / kernel 6.8, TSan can abort with "FATAL: ThreadSanitizer: unexpected memory mapping"; run it as: setarch -R ./program)
./program

# Output will show race conditions:
# WARNING: ThreadSanitizer: data race

Privilege Escalation​

This section covers enumeration, detection and proof of impact. The full non-destructive Linux checklist (writable paths, capabilities, kernel and userland version checks, LinPEAS and other enumerators) is in Linux Pentesting §4 "Privilege Escalation Vectors (Non-Destructive Checks)" and §7 "Automated Enumeration Tools". When an engagement asks you to show impact, run a harmless command such as id (or id > /tmp/proof where you cannot see the output) with the gained privilege, record the result, and remove anything you created. Never leave a SUID shell, a modified job or a replaced binary behind.

Linux Privilege Escalation​

SUID binaries and file capabilities:

# Find SUID binaries
find / -perm -4000 -type f 2>/dev/null

# File capabilities (cap_setuid, cap_dac_override and similar are the interesting ones)
getcap -r / 2>/dev/null

A custom SUID binary with a memory-corruption bug goes through the Binary Exploitation workflow on a lab copy. Two facts limit what it yields: argv and strcpy-style input cannot carry a 0x00 byte, and /bin/sh (dash or bash) resets the effective UID to the real UID unless started with -p. The PoC deliverable is controlled execution with a harmless effect (see the minimal-PoC standard under Determining Exploitability), not a shell. [verify 2026-10-31]

Kernel exploits:

# Check kernel version
uname -a

# Search Exploit-DB offline (searchsploit; repository now at https://gitlab.com/exploit-database/exploitdb)
searchsploit linux kernel 4.4.0

# Notable Linux LPE bugs (study the original write-ups; never weaponise without authorization):
# - Dirty COW — CVE-2016-5195 (race in mm/gup.c copy-on-write handling; writes to read-only mappings)
# - DirtyPipe — CVE-2022-0847 (pipe_buffer.flags not initialised; overwrites page-cache pages of readable read-only files, within one page; introduced 5.8, fixed 5.16.11 / 5.15.25 / 5.10.102) [verify 2026-10-31]
# - CVE-2022-2588 — cls_route UAF (Zhenpeng Lin); used to demonstrate DirtyCred, a credential-swapping technique (Lin, Wu, Xing; Black Hat USA 2022 / CCS 2022) [verify 2026-10-31]
# - PwnKit — CVE-2021-4034 (polkit pkexec argv[0]=NULL env-var injection)
# - Sequoia — CVE-2021-33909 (size_t→int truncation in seq_file → LPE)
# - Looney Tunables — CVE-2023-4911 (glibc dynamic loader GLIBC_TUNABLES buffer overflow)
# - StackRot — CVE-2023-3269 (UAF in maple tree)

To decide exposure, compare uname -r (and, for userland bugs, the package version) against the distribution's security tracker, because distributions back-port fixes without changing the upstream version number. Version checks for these CVEs and linux-exploit-suggester are in Linux Pentesting §4 "Kernel & userland LPE (Version Check Only)" and "Polkit / pkexec". Building and running public LPE exploits is out of scope for this SOP.

Sudo misconfigurations:

# Check sudo privileges
sudo -l

# A NOPASSWD rule for a program that can run commands is root code execution.
# Prove it with a harmless command; the output should read uid=0(root):
# (ALL) NOPASSWD: /usr/bin/vim
sudo vim -c ':!id' -c ':qa!'

# (ALL) NOPASSWD: /usr/bin/find
sudo find . -exec id \; -quit

# (ALL) NOPASSWD: /usr/bin/python3
sudo python3 -c 'import os; os.system("id")'

# GTFOBins lists the command-execution form for each program:
# https://gtfobins.org/

Writable /etc/passwd (escalation pattern — neutralised):

# Discovery only — verify mode/owner of the password database:
ls -la /etc/passwd

# Escalation primitive (DO NOT execute on systems you don't own):
# A writable /etc/passwd allows appending a UID-0 row whose hash field is set
# to a value of the operator's choice. Concrete one-liner intentionally omitted.
# See HackTricks → "Linux Privilege Escalation → Writable /etc/passwd".
#
# Defensive guidance is the point of this section: /etc/passwd should be
# 0644 root:root and never world-writable; CIS Benchmarks audit the mode.

Writable cron jobs (detection only):

# Root's scheduled jobs
cat /etc/crontab
ls -la /etc/cron.d/ /etc/cron.daily/

# Cron files or directories the current user can write (GNU find -writable tests your own access)
find /etc/cron* -writable 2>/dev/null

# For each script a root job runs, check the script and its directory, for example:
ls -la /usr/local/bin/backup.sh /usr/local/bin/

A root job that runs a script you can write gives root code execution at its next run. Report the writable path and the job that runs it. If the engagement requires a demonstration, append (>>, never >) one harmless line such as id > /tmp/proof, wait for one run, then restore the original script and delete the proof file. Never copy a shell or set a SUID bit.

Windows Privilege Escalation​

Enumerate first. winPEAS (PEASS-ng, release 20261029-a596a9f3) and PrivescCheck (itm4n, release 2026.10.28-1) are maintained and cover the checks below. GhostPack Seatbelt has no published releases, and its repository was last updated in January 2025. [verify 2026-10-31]

# PrivescCheck (from its README); winPEAS: run winPEASx64.exe from the PEASS-ng release
powershell -ep bypass -c ". .\PrivescCheck.ps1; Invoke-PrivescCheck -Report TXT,HTML"

Common vectors:

# Unquoted service paths (CIM query; WMIC is gone from Windows 11 24H2 and later)
Get-CimInstance -ClassName Win32_Service |
Where-Object { $_.StartMode -eq 'Auto' -and $_.PathName -match ' ' -and $_.PathName -notmatch '^\s*"' -and $_.PathName -notmatch '^C:\\Windows\\' } |
Select-Object Name, DisplayName, PathName, StartMode

# Exploitable if the path is unquoted, contains spaces, and an earlier candidate directory is writable:
# C:\Program Files\My Service\service.exe
# Windows tries: C:\Program.exe, C:\Program Files\My.exe

# AlwaysInstallElevated
reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
# If both values are 1, any MSI a standard user installs runs as SYSTEM. Report the two values.

# Weak service permissions: who can reconfigure a service (service DACL)
accesschk.exe /accepteula -nobanner -uwcv "Authenticated Users" *

# Who can replace a service binary (file ACL; take the path from PathName above)
icacls "C:\Path\To\service.exe"

Microsoft's deprecated-features page records WMIC as removed from Windows 11 24H2 and later; the CIM class Win32_Service exposes the same PathName and StartMode properties. [verify 2026-10-31]

The two permission checks lead to different abuse paths. A service DACL that grants you SERVICE_CHANGE_CONFIG (AccessChk -c output) lets you repoint the service at another binary. A binary whose ACL gives your group F, M or W (icacls) lets you replace the file. Either one runs code as the service account. Report the ACL. If a demonstration is required, use a harmless command such as whoami > C:\Windows\Temp\proof.txt and restore the original configuration afterwards.

Token impersonation:

# Check for SeImpersonatePrivilege
whoami /priv

If SeImpersonatePrivilege is held, the *Potato tools chain an RPC/DCOM, Print Spooler or EFSRPC coercion to a SYSTEM token. Concrete invocations are out of scope; record the privilege and the account as the finding. Tool families (defensive context): [verify 2026-10-31]

  • JuicyPotato: legacy. Broken from Windows 10 1809 / Server 2019, where the OXID resolver can no longer be queried on a port other than 135 (decoder.cloud, "No more JuicyPotato? Old story, welcome RoguePotato!", 2020-05-11).
  • RoguePotato: works around that with a remote OXID resolver.
  • PrintSpoofer: Print Spooler named-pipe coercion; repository archived, last commit 2020.
  • EfsPotato: MS-EFSR (EfsRpcEncryptFileSrv).
  • GodPotato: DCOM / rpcss OXID handling; its README lists Windows Server 2012-2022 and Windows 8-11.
  • SweetPotato: a collection of these techniques in one tool.

Reference catalogue and current-version guidance: HackTricks "SeImpersonatePrivilege" (https://hacktricks.wiki/) and itm4n's research blog (https://itm4n.github.io/).


Exploit Development​

Exploit development in this SOP is research and disclosure, not weaponisation. Establish the root cause (Crash Analysis), decide exploitability against the target's actual mitigations (Determining Exploitability and the Mitigation Inventory), prove control with a minimal PoC, then disclose (CVE Process & Disclosure). The deliverable is the minimal-PoC standard at the end of Determining Exploitability: a harmless, reproducible effect, never a shell or a payload. Shellcode, ROP and ret2libc chains, and heap-grooming scripts are out of scope. This section keeps the facts that decide whether a technique still applies to a given target.

ROP (Return-Oriented Programming)​

Finding ROP gadgets:

# ROPgadget
ROPgadget --binary ./vulnerable_binary > gadgets.txt

# Search for specific gadgets
ROPgadget --binary ./vulnerable_binary --only "pop|ret"

# Ropper
ropper --file ./vulnerable_binary --search "pop rdi"

# radare2 (/R searches for ROP gadgets)
r2 -q -c '/R pop rdi' ./vulnerable_binary

What decides whether code reuse applies:

  • NX makes injected bytes non-executable, so code reuse (ROP) is the classic answer. ASLR and PIE mean gadget and libc addresses must first come from a non-PIE image or an information leak.
  • Binaries linked against glibc 2.34 or later no longer contain __libc_csu_init, the old source of a pop rdi; ret gadget and of ret2csu. A small -no-pie lab binary built on Ubuntu 24.04 (glibc 2.39) has no pop rdi; ret at all: ROPgadget --only "pop|ret" finds only pop rbp ; ret and ret. [verify 2026-10-31]
  • pwntools elf.plt['system'] exists only if the binary imports system. Otherwise the address has to come from libc after a leak.
  • ret2libc, as a method: leak a libc pointer, then compute the libc base from the target's own libc.so.6, never from offsets copied from another build. The x86-64 System V psABI requires rsp + 8 to be a multiple of 16 on function entry; on glibc 2.39, system() crashes on a misaligned stack, which is why chains carry an extra ret. [verify 2026-10-31]
  • An enforced shadow stack (CET SHSTK, see Modern Hardware Mitigations) stops return-address corruption outright.
  • The report deliverable is controlled RIP or a call to a benign function, per the minimal-PoC standard.

glibc Version Limits for Heap Techniques​

Classic heap techniques depend on allocator checks that change between glibc releases. Check the target's glibc first (ldd --version, or the libc.so.6 shipped with a CTF challenge), then read the row. Sources: the how2heap README version table (https://github.com/shellphish/how2heap), glibc NEWS, and the glibc commits named below. [verify 2026-10-31]

TechniqueRelies onBlocked or changed inWhat changed
tcache double free (how2heap tcache_dup)Freeing the same chunk twice into the tcacheglibc 2.29A per-chunk key field lets free() detect it and abort with free(): double free detected in tcache 2 (commit bcdaad21). how2heap's house_of_botcake is the variant that works around the check.
House of ForceOverwriting the top chunk size so one huge request moves the top chunkglibc 2.29Top-chunk size check, malloc(): corrupted top size (commit 30a17d8c). how2heap: "< 2.29".
tcache poisoningOverwriting a free chunk's tcache next pointerglibc 2.32Safe-linking (PROTECT_PTR) stores next XORed with the shifted chunk address, so the overwrite needs a heap address leak (commit a1a486d7). how2heap: "requires heap leak on and after 2.32".
fastbin dup (free A, B, A)A fastbin double freeglibc 2.26, 2.32, 2.43From 2.26 the tcache absorbs the first 7 frees of each size, so it must be filled first. From 2.32 fastbin fd pointers are safe-linked too. glibc 2.43 removed fastbins from malloc (how2heap: "< 2.43").
__malloc_hook / __free_hook overwriteA writable function pointer that malloc/free callglibc 2.34The hooks were removed from the API (glibc NEWS 2.34).
ret2csu (not a heap technique; same version audit)Gadgets in __libc_csu_initglibc 2.34__libc_csu_init is no longer linked into binaries (commit 035c012e), so ret2csu is gone and small binaries lack pop rdi; ret.

Exploit Mitigations & Bypasses​

Mitigation Inventory​

Inventory the mitigations before judging exploitability, and keep the output with your notes. On Linux, two different tools are both called checksec:

# pwntools
pwn checksec ./binary

# slimm609/checksec 3.x (Go rewrite); 2.x, which Ubuntu 24.04 still packages, uses: checksec --file=./binary
checksec file ./binary

pwn checksec output for a default Ubuntu 24.04 build (gcc -O2, GCC 13.3, glibc 2.39, pwntools 4.15.0). SHSTK and IBT report the ELF property note, not runtime enforcement (see Modern Hardware Mitigations): [verify 2026-10-31]

Arch: amd64-64-little
RELRO: Full RELRO
Stack: Canary found
NX: NX enabled
PIE: PIE enabled
FORTIFY: Enabled
SHSTK: Enabled
IBT: Enabled
Stripped: No

Recognising mitigations in disassembly (objdump -d -M intel):

  • Stack canary (GCC 13.3, x86-64): the prologue runs mov rax, QWORD PTR fs:0x28 and stores the value below the saved frame pointer. The epilogue reloads it, runs sub rax, QWORD PTR fs:0x28, and on a mismatch calls __stack_chk_fail. [verify 2026-10-31]
  • IBT marking: functions begin with endbr64.
  • FORTIFY_SOURCE: calls go to __*_chk variants such as __strcpy_chk and __printf_chk.
  • RELRO: not visible in code. readelf -lW shows the GNU_RELRO segment, and a Full RELRO binary has no separate writable .got.plt.

Windows (PE): the protections are linker flags recorded in the PE headers: /DYNAMICBASE (ASLR), /NXCOMPAT (DEP), /GUARD:CF (Control Flow Guard, which also requires /DYNAMICBASE) and /CETCOMPAT (marks the image as CET shadow-stack compatible). For a CFG build, dumpbin /headers /loadconfig shows Guard in the DLL characteristics and CF Instrumented in the guard flags. NetSPI PESecurity reports ASLR, DEP, SafeSEH, StrongNaming, Authenticode, CFG and HighEntropyVA per file; Trail of Bits winchecksec (winchecksec.exe &lt;file&gt;) is an alternative. Get-ProcessMitigation shows the per-program exploit-protection settings stored in the registry. [verify 2026-10-31]

Import-Module .\Get-PESecurity.psm1
Get-PESecurity -file C:\path\to\target.exe
Get-ProcessMitigation -Name target.exe

Stack Canaries​

Detection: Stack: Canary found in the Mitigation Inventory, and the fs:0x28 load and check around __stack_chk_fail in disassembly.

The canary is chosen once per process at exec (from the kernel's AT_RANDOM bytes) and every fork() child inherits it unchanged. On glibc x86-64 its lowest byte is always 0x00. [verify 2026-10-31]

Bypass techniques:

  1. Information leak: leak the canary (format string, over-read) before the overwrite, and write it back unchanged.
  2. Byte-at-a-time brute force: works only against a fork()-per-connection server, where every child carries the parent's canary and the *** stack smashing detected *** abort is the oracle. With the low byte fixed at 0x00, that is at most 7 × 256 attempts. It does not work against a target that is re-executed for each attempt, because every exec draws a new canary.

DEP/NX (Data Execution Prevention)​

Detection: NX: NX enabled in the Mitigation Inventory; on Linux, readelf -lW shows GNU_STACK as RW, not RWE.

Bypass: Use ROP (Return-Oriented Programming) - execute existing code instead of injecting shellcode.

ASLR (Address Space Layout Randomization)​

Check if enabled:

# Linux
cat /proc/sys/kernel/randomize_va_space
# 0 = off
# 1 = mmap base, stack and vDSO randomized (so shared libraries too); for PIE binaries, also the code base
# 2 = level 1 plus heap (brk) randomization; the default unless CONFIG_COMPAT_BRK is set

Levels as documented for randomize_va_space in the kernel's sysctl documentation (Documentation/admin-guide/sysctl/kernel.rst). [verify 2026-10-31]

Bypass techniques:

  1. Information leak: Leak address to calculate base
  2. Brute-force: On 32-bit systems (limited entropy)
  3. Partial overwrite: ASLR randomizes page-aligned bases, so the low 12 bits of an address (the page offset) never change. Overwriting the lowest one or two bytes redirects within the same page or a nearby one, with 0 or 4 bits to guess. [verify 2026-10-31]

PIE (Position Independent Executable)​

Detection: PIE: PIE enabled (or No PIE (0x400000)) in the Mitigation Inventory.

Bypass: Leak binary address to calculate base, similar to ASLR bypass.

RELRO (Relocation Read-Only)​

Types:

  • Partial RELRO (-z relro): .got is read-only after relocation; .got.plt (the lazy-binding slots) stays writable.
  • Full RELRO (-z relro -z now): every symbol is resolved at load time and all GOT slots are read-only. [verify 2026-10-31]

Detection: the RELRO: line in the Mitigation Inventory.

Partial RELRO bypass: Overwrite .got.plt entries to redirect execution.

Full RELRO: Must find alternative targets (vtables, function pointers).

Control Flow Integrity (CFI)​

LLVM CFI (-fsanitize=cfi, which requires LTO: -flto or -flto=thin), Microsoft CFG (/guard:cf, which also requires /DYNAMICBASE; Windows 10/11 and Windows Server 2019 and later) and kernel CFI (kCFI in Linux ≥ 6.1) constrain forward edges: indirect calls must reach type-matching or registered targets. None of them checks returns; that takes a shadow stack (see Modern Hardware Mitigations). Microsoft's XFG has no compiler-option documentation, so treat it as unavailable. [verify 2026-10-31]

Windows process mitigations (reference: https://learn.microsoft.com/en-us/defender-endpoint/exploit-protection-reference):

  • CFG: validates indirect-call targets (above).
  • ACG (Arbitrary Code Guard): blocks dynamically generated code. An allocation that asks for execute permission fails with STATUS_DYNAMIC_CODE_BLOCKED, so "allocate RWX, copy, jump" does not work.
  • CIG (Code Integrity Guard): only binaries signed by Microsoft (WHQL signatures included) may load into the process.
  • Hardware-enforced Stack Protection: CET shadow stack for user-mode processes, opt-in per image (/CETCOMPAT).

Bypass techniques:

  • Find valid CFI targets that can be abused (signature-compatible gadgets).
  • Exploit data-only attacks (no control flow hijacking needed) — corrupt sensitive variables, file paths, credentials.
  • ROP is unaffected by forward-edge CFI; JOP/COP must land on valid targets.
  • Type-confusion to upgrade an indirect call into a different but signature-compatible target.

Modern Hardware Mitigations (x86_64 + ARM64)​

The mitigation landscape has shifted in 2023–2026 from purely software-enforced controls to hardware-assisted ones. Track support per target before assuming a bypass is needed.

Intel CET (Control-flow Enforcement Technology) and AMD shadow stacks — Intel 11th generation (Tiger Lake, 2020) and AMD Zen 3 and later. Not on by default on either OS. Linux: userspace shadow stack only (kernel ≥ 6.6, glibc ≥ 2.39 built with --enable-cet); a process opts in at startup with GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK; the loader then enables it only if the executable and every loaded library carry the SHSTK marking (glibc.cpu.x86_shstk = on/off/permissive adjusts that policy once SHSTK is enabled). The kernel uses IBT for itself; there is no userspace IBT. Windows: user-mode Hardware-enforced Stack Protection is opt-in per image (/CETCOMPAT); kernel-mode Hardware-enforced Stack Protection is off by default and needs the Windows 11 2022 update or later with VBS and HVCI. [verify 2026-10-31]

  • Shadow Stack (SHSTK) — separate stack tracks return addresses; mismatch on ret raises a #CP fault. Defeats classical ROP where enforced. Bypasses require corrupting both stacks (rare without a separate primitive) or code that runs without shadow-stack enforcement.
  • Indirect Branch Tracking (IBT) — every legal indirect call/jump target must begin with ENDBR64/ENDBR32. Defeats classical JOP/COP. On Linux it is enforced for the kernel only; in userspace endbr64 is a marking. Bypasses: pivot through valid ENDBR targets, attack pre-ENDBR sequences in unprotected libraries, exploit kernels/binaries built without -fcf-protection.
  • Detection: the ELF marking, the per-process state and the CPU flags are three different things. readelf -n prints the marking as x86 feature: IBT, SHSTK (there is no "CET" string to grep for). x86_Thread_features: in /proc/&lt;pid&gt;/status is empty unless shadow stack is active for that process. [verify 2026-10-31]
readelf -n ./binary | grep -i 'x86 feature'
grep x86_Thread_features /proc/self/status
grep -o -w -E 'user_shstk|ibt' /proc/cpuinfo | sort -u

ARM Pointer Authentication (PAC) — ARMv8.3-A. Apple documents PAC for its system software and built-in apps (arm64e); enabled in Linux on supported kernels (≥ 5.0). Signs pointers with a tweak + key; corrupting a signed pointer raises a fault on use. Bypasses: signing-oracle gadgets, key-reuse across contexts, downgrade to non-PAC code paths, type-confusion that swaps signed/unsigned pointers. [verify 2026-10-31]

ARM Branch Target Identification (BTI) — ARMv8.5-A. Equivalent to IBT: indirect branches must land on BTI instructions. Linux mainline support since 5.8.

ARM Memory Tagging Extension (MTE) — ARMv8.5-A. Tags 16-byte granules with a 4-bit color; loads/stores must match the pointer's tag. Catches linear overflows, UAF, double-free probabilistically (1/16 = 6.25% miss rate per access). Supported on Pixel 8 and later but disabled by default: enable it per app (android:memtagMode, sync or async) or device-wide through Developer options. GKI kernels (Android 12-5.10 and later) are built with CONFIG_KASAN_HW_TAGS=y (kernel MTE). Bypasses: tag confusion across colors, type-confusion, large oob spanning many granules. [verify 2026-10-31]

Linux kernel mitigations to check:

# kCFI (CONFIG_CFI_CLANG was renamed CONFIG_CFI in Linux 6.18)
grep -E 'CONFIG_CFI(_CLANG)?=' /boot/config-$(uname -r)

# Stack protector; kernel FORTIFY_SOURCE (kernel-internal, separate from userspace _FORTIFY_SOURCE levels)
grep -E 'CONFIG_STACKPROTECTOR_STRONG|CONFIG_FORTIFY_SOURCE' /boot/config-$(uname -r)

# SLAB freelist hardening, randomization
grep -E 'CONFIG_SLAB_FREELIST_HARDENED|CONFIG_SLAB_FREELIST_RANDOM' /boot/config-$(uname -r)

# KASLR and KPTI (CONFIG_PAGE_TABLE_ISOLATION became CONFIG_MITIGATION_PAGE_TABLE_ISOLATION in 6.9)
grep -E 'CONFIG_RANDOMIZE_BASE=|CONFIG_(MITIGATION_)?PAGE_TABLE_ISOLATION=' /boot/config-$(uname -r)
cat /sys/devices/system/cpu/vulnerabilities/meltdown # KPTI status
grep -o -w nokaslr /proc/cmdline || echo "nokaslr not set"

# SMEP/SMAP are CPU features with no Kconfig symbol (CONFIG_X86_SMAP was removed in 5.19)
grep -o -w -E 'smep|smap' /proc/cpuinfo | sort -u

Userspace _FORTIFY_SOURCE=3 needs glibc 2.33 or later with clang (LLVM 9+), or glibc 2.35 or later with GCC 12+. The kernel's CONFIG_FORTIFY_SOURCE is a separate, kernel-internal option with no level 3. [verify 2026-10-31]

Status table (rough): [verify 2026-10-31]

MitigationAvailable sinceDefault onBypass cost
Stack CanaryGCC 4.1 / glibcMost distrosLeak required
NX/DEP2003-04 (AMD64 NX, Intel XD; Windows XP / Server 2003 DEP)UniversalROP / ret2libc
ASLRLinux 2.6.12 (2005)UniversalInfo leak
PIEGCC 3.4Distros 2017+Info leak
Full RELRObinutils (2004, -z relro + -z now)Distros 2016+Alt targets (vtables, fn ptrs)
CET shadow stackTiger Lake / Zen 3 (2020)Opt-in (Linux 6.6 + glibc 2.39; Windows /CETCOMPAT)Shadow-stack corruption / non-CET code
ARM PACARMv8.3 (2016)Apple system software (arm64e), recent AndroidSigning oracle / key reuse
ARM BTIARMv8.5 (2018)Pixel 8+, recent AndroidPivot through BTI targets
ARM MTEARMv8.5 (2018)Pixel 8+ (opt-in)Tag confusion
LLVM kCFILinux 6.1 (2022)Android, ChromeOSSignature-compatible call sites

CVE Process & Disclosure​

CVE Request Process​

1. Determine if vulnerability deserves CVE:

  • Affects security
  • Affects multiple users
  • Not already assigned CVE
  • Fixed or in process of being fixed

2. Request CVE from a CNA (CVE Numbering Authority):

CNAs scope their authority by product/vendor. Use the official lookup at https://www.cve.org/PartnerInformation/ListofPartners to find the CNA covering your target before contacting MITRE — many vendors are CNAs for their own products (Microsoft MSRC, Apple, Google, Red Hat, Cisco, GitHub, HackerOne, Bugcrowd, Synacktiv, etc.). If no scoped CNA exists, go to a CNA of Last Resort: CISA ICS for industrial control systems and medical devices, MITRE for everything else. [verify 2026-10-31]

The CVE Program migrated to CVE Record JSON 5.x in 2023 (current minor version 5.2, released October 2025, which adds Package URL identifiers for affected products [verify 2026-10-31]); records published since carry richer affected-product, references, and CVSS metric blocks. Submissions through CNA portals or the CVE Services API (https://cveawg.mitre.org/api-docs/) populate this schema directly.

MITRE as CNA of Last Resort (CNA-LR) (residual / unscoped products):

Web form: https://cveform.mitre.org/

Subject: CVE Request - [Product Name] [Vulnerability Type]

Body:
Product: [Name and version]
Vendor: [Vendor name]
Vulnerability Type: [Buffer overflow, XSS, etc.]
Attack Vector: [Remote, local, etc.]
Impact: [Code execution, DoS, info disclosure]
Affected Versions: [Specific versions]
Fixed Version: [Version with fix]

Description:
[Detailed technical description]

Proof of Concept:
[Minimal PoC to demonstrate]

Disclosure Timeline:
Reported to vendor: YYYY-MM-DD
Vendor response: YYYY-MM-DD
Fix available: YYYY-MM-DD

GitHub Security Advisories (for GitHub projects):

  1. Navigate to repository → Security → Advisories
  2. Click "New draft security advisory"
  3. Fill in details (affected versions, severity, description)
  4. Request CVE automatically

3. Receive CVE ID:

  • Format: CVE-YYYY-NNNN, with four or more digits after the year (e.g., CVE-2022-0847) [verify 2026-10-31]
  • Reserved before public disclosure
  • Published after disclosure

4. CVSS Scoring:

FIRST publishes two active versions of CVSS:

Many CNAs now publish v4.0 and v3.1 vectors side by side. NVD shows the CNA's v4.0 vector when one is supplied, but NVD's own assessments are v3.1. Score in the most recent version your CNA accepts; keep v3.1 alongside for downstream consumers that haven't migrated. [verify 2026-10-31]

Example v3.1 scoring:

  • Attack Vector: Network (AV:N)
  • Attack Complexity: Low (AC:L)
  • Privileges Required: None (PR:N)
  • User Interaction: None (UI:N)
  • Scope: Unchanged (S:U)
  • Confidentiality: High (C:H)
  • Integrity: High (I:H)
  • Availability: High (A:H)

Result: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H (Critical 9.8)

5. CISA KEV / EPSS context:

  • CISA Known Exploited Vulnerabilities (KEV) — https://www.cisa.gov/known-exploited-vulnerabilities-catalog. CVEs added to KEV carry a US Federal civilian executive-branch remediation deadline (BOD 22-01); inclusion is the strongest available signal of in-the-wild exploitation. Worth flagging in the advisory if your CVE meets KEV criteria.
  • EPSS (Exploit Prediction Scoring System) — https://www.first.org/epss/. Probabilistic 0–1 score for likelihood of exploitation in the next 30 days. Useful in remediation prioritisation conversations with the vendor / downstream operators.

Responsible Disclosure Timeline​

Standard 90-day disclosure:

Day 0: Discover vulnerability
Day 1-3: Verify and create PoC
Day 5: Report to vendor (encrypted email preferred)
Day 7: Vendor acknowledges receipt
Day 30: Vendor provides fix timeline
Day 60: Vendor releases patch (if ready)
Day 90: Public disclosure (coordinated)

Accelerated disclosure (active exploitation):

Day 0: Discover 0-day being exploited in wild
Day 1: Immediate notification to vendor
Day 7: Public disclosure if no patch
(users need to protect themselves)

Writing Security Advisories​

Advisory template:

# Security Advisory: [Product] [Vulnerability Type]

## Summary
[One-paragraph description of vulnerability and impact]

## CVE ID
CVE-YYYY-NNNNN

## Severity
Critical / High / Medium / Low (CVSS X.X)

## Affected Versions
- Product X.X.X through X.X.X

## Fixed Versions
- Product X.X.X and later

## Vulnerability Details
[Technical description of vulnerability]

### Vulnerability Type
[Buffer overflow, SQL injection, etc.]

### Attack Vector
[Remote/Local, network/adjacent/local]

### Attack Complexity
[Low/High - prerequisites for exploitation]

## Proof of Concept
[Minimal code to demonstrate vulnerability]

## Impact
- Remote code execution
- Authentication bypass
- Information disclosure
- Denial of service

## Mitigation
1. Upgrade to version X.X.X or later
2. If upgrade not possible:
- Apply workaround: [description]
- Disable feature: [description]

## Timeline
- YYYY-MM-DD: Vulnerability discovered
- YYYY-MM-DD: Reported to vendor
- YYYY-MM-DD: Vendor confirmed issue
- YYYY-MM-DD: CVE assigned
- YYYY-MM-DD: Patch released
- YYYY-MM-DD: Public disclosure

## Credits
Discovered by: [Your Name / Organization]

## References
- [Link to vendor advisory]
- [Link to patch]
- [Link to CVE entry]

Bug Bounty Programs​

Top Bug Bounty Platforms​

PlatformFocusWebsite
HackerOneGeneralhttps://www.hackerone.com/
BugcrowdGeneralhttps://www.bugcrowd.com/
SynackPrivate programshttps://www.synack.com/
IntigritiEuropean companieshttps://www.intigriti.com/
YesWeHackEuropean companieshttps://www.yeswehack.com/
Google VRPGoogle productshttps://bughunters.google.com/
Microsoft MSRCMicrosoft productshttps://www.microsoft.com/en-us/msrc/bounty

Bug Bounty Best Practices​

1. Read the scope carefully:

✅ In Scope:
- *.example.com
- mobile.example.com
- api.example.com

❌ Out of Scope:
- test.example.com
- blog.example.com (third-party)
- Physical security testing
- Social engineering

2. Understand severity ratings:

Critical ($$$$$):
- Remote code execution
- Authentication bypass
- SQL injection with data access
- SSRF with cloud metadata access

High ($$$$):
- Stored XSS
- Privilege escalation
- IDOR with PII access

Medium ($$$):
- Reflected XSS
- CSRF on sensitive actions

Low ($$):
- Self-XSS
- Clickjacking without impact

3. Write quality reports:

Good report structure:

## Summary
[One sentence describing vulnerability and impact]

## Description
[Detailed explanation of what the vulnerability is]

## Steps to Reproduce
1. Navigate to https://example.com/vulnerable-page
2. Enter payload in input field: <script>alert(1)</script>
3. Submit form
4. Observe XSS execution

## Proof of Concept
[Screenshot/video demonstrating vulnerability]

[Code snippet if applicable]

## Impact
An attacker can:
- Steal user session cookies
- Perform actions as victim user
- Deface the website

## Remediation
1. Sanitize user input before displaying
2. Implement Content-Security-Policy header
3. Use httpOnly and secure flags on cookies

## Supporting Material
- Browser: Chrome 120.0.6099.109
- Operating System: Ubuntu 22.04
- Video: [link to PoC video]

4. Automation for efficiency:

# Subdomain enumeration
subfinder -d target.com | httpx | nuclei

# Automated scanning
nuclei -l targets.txt -t ~/nuclei-templates/

# Continuous monitoring
while true; do
subfinder -d target.com | httpx -silent | \
nuclei -silent -t ~/nuclei-templates/cves/ | \
notify -silent
sleep 3600
done

Common Bounty Mistakes to Avoid​

❌ Don't:

  • Test out-of-scope assets
  • Perform denial-of-service attacks
  • Access other users' data (beyond PoC)
  • Spam duplicate reports
  • Demand specific bounty amounts
  • Share vulnerability publicly before resolution

✅ Do:

  • Follow scope and rules
  • Provide clear reproduction steps
  • Include impact analysis
  • Be professional and patient
  • Help vendor understand and fix issue

0-Day Research Ethics​

Responsible 0-Day Research​

Ethical guidelines:

  1. Discovery: Finding unknown vulnerabilities is legitimate security research
  2. Disclosure: Report to vendor for patching before public disclosure
  3. No harm: Don't exploit vulnerability against real users
  4. No sale: Don't sell 0-days to malicious actors
  5. Protect users: Prioritize user safety over researcher fame

Unethical practices:

  • ❌ Selling 0-days to offensive contractors without disclosure to vendor
  • ❌ Exploiting 0-days for financial gain
  • ❌ Releasing 0-days publicly without vendor notification
  • ❌ Threatening vendors for payment

Gray areas (debatable):

  • ⚠️ Coordinating with government agencies for defensive purposes
  • ⚠️ Disclosing after vendor ignores repeated reports (last resort)
  • ⚠️ Participating in government offensive programs (legal but controversial)

0-Day Market Economics​

Legitimate acquisition:

  • Vendors: Purchase to fix their own products
  • Governments: Offensive/defensive cyber capabilities (controversial)
  • Bug bounties: Ethical acquisition with public disclosure

Illegitimate market:

  • Criminal groups purchasing for financial cybercrime
  • State-sponsored APTs for espionage/warfare
  • Zero-day brokers selling to highest bidder

Pricing (rough order-of-magnitude, public broker payouts as of 2024–2025):

  • Mobile (iOS/Android) full-chain RCE+LPE+persistence: high six- to low seven-figure USD. Crowdfense's public acquisition page lists mobile full chains at up to USD 7M; treat Zerodium's older public tier table as historical. [verify 2026-10-31]
  • Browser full chain (RCE + sandbox escape + LPE): low seven figures USD for Chrome and Safari (Crowdfense lists USD 1.5–3.5M, and up to USD 500k each for an RCE or a sandbox escape alone); Firefox full chain around USD 300k. [verify 2026-10-31]
  • Windows / macOS / Linux LPE: tens to low hundreds of thousands USD.
  • Server-side enterprise app RCE: thousands to tens of thousands USD on bug bounty; higher on grey market.

Numbers move quickly with vendor-side hardening, geopolitics, and broker portfolio composition. Treat any specific figure as anecdotal unless sourced from a current public broker price list.

Note: Bug bounties typically pay far less than the grey market, but are legal, scope-bounded, and disclosure-positive. See Bug Bounty Hunting for program selection, scope reading, and report quality guidance.


Tools Reference​

Essential Tools​

ToolPurposeInstallation
GDB + GEFDebuggingbash -c "$(curl -fsSL https://gef.blah.cat/sh)"
pwntoolsExploit developmentpip install pwntools
AFL++Fuzzingsudo apt install afl++
radare2Binary analysissudo apt install radare2
GhidraReverse engineeringhttps://ghidra-sre.org/
IDA ProDisassemblerhttps://hex-rays.com/ida-pro/
Binary NinjaBinary analysishttps://binary.ninja/
checksecSecurity checksudo apt install checksec

Fuzzing Tools​

ToolTypeWebsite
AFL++Coverage-guidedhttps://github.com/AFLplusplus/AFLplusplus
LibFuzzerCoverage-guidedhttps://llvm.org/docs/LibFuzzer.html
HonggfuzzFeedback-drivenhttps://github.com/google/honggfuzz
RadamsaMutation-basedhttps://gitlab.com/akihe/radamsa
BoofuzzNetwork protocolhttps://github.com/jtpereyda/boofuzz

Sanitizers (Debugging)​

# AddressSanitizer (detect memory errors)
gcc -fsanitize=address -g program.c -o program

# UndefinedBehaviorSanitizer (detect undefined behavior)
gcc -fsanitize=undefined -g program.c -o program

# MemorySanitizer (detect uninitialized reads)
clang -fsanitize=memory -g program.c -o program

# ThreadSanitizer (detect race conditions)
gcc -fsanitize=thread -g program.c -o program

Common Pitfalls & Risks​

Methodology / discipline:

  • ❌ Fuzzing without sanitizers — silent corruptions become low-signal hangs instead of triagable crashes. Always pair with ASan/UBSan at minimum (MSan/TSan/HWASan when relevant).
  • ❌ Treating crashes as bugs without exploitability triage — many crashes are non-exploitable; spend time on the ones with corruption primitives.
  • ❌ Single-fuzzer / single-seed campaigns — run AFL++ in -M/-S ensembles, mix dictionaries, rotate seeds, and feed minimised corpora into the next campaign.
  • ❌ Ignoring code coverage — without coverage the fuzzer is wandering. Inspect afl-cov / llvm-cov output and write harnesses to push past plateaus.
  • ❌ Persistent-mode harnesses with global state — re-entering a target that mutates globals produces ghost crashes that do not reproduce outside the harness.

Operational / OPSEC:

  • ❌ Running PoCs against shared, third-party, or production endpoints without written authorization.
  • ❌ Storing sample crashes in cloud-synced folders — exfiltrates target data and possibly proprietary code.
  • ❌ Reusing exploit infrastructure (callback IPs, payloads) across unrelated engagements — see OPSEC.
  • ❌ Posting searchsploit output, raw crash dumps, or screenshots to public Discord/Slack/X before disclosure closes.

Disclosure / process:

  • ❌ Sending unsolicited PoCs over plaintext email — use vendor PGP key, Signal, or platform-managed inbox.
  • ❌ Demanding a specific bounty amount or threatening public release for payment (extortion territory; voids most safe-harbor language).
  • ❌ Filing a CVE before the vendor confirms — re-issuance and rejections create noise in the ecosystem.
  • ❌ Disclosing publicly without consulting the vendor's coordinated-disclosure window when the bug is in CISA KEV-eligible territory.

Legal:

  • ❌ Assuming bug-bounty scope covers all subsidiaries / acquisitions — explicit list only.
  • ❌ Reverse-engineering or distributing PoCs that bundle copyrighted vendor binaries (DMCA §1201 / EU Copyright Directive Article 6 still apply, even with security-research carveouts).
  • ❌ Crossing borders with unencrypted exploit research material.

Canonical jurisdictional framework lives in Legal & Ethics. The summary below is operational guidance only; do not substitute it for the cross-referenced source.

United States:

  • Computer Fraud and Abuse Act (CFAA) — 18 U.S.C. § 1030. The 2022 DOJ charging policy explicitly excludes good-faith security research from prosecution priorities, but the statute itself is unchanged.
  • DMCA §1201 — anti-circumvention. The Library of Congress's triennial security-research exemption (most recent renewal 2024 [verify 2026-10-31]) covers good-faith research on lawfully-acquired devices.

European Union:

  • Cybercrime Directive — Directive 2013/40/EU.
  • GDPR — data protection during research; minimise and avoid personal data wherever possible.
  • CRA (Cyber Resilience Act) — Regulation (EU) 2024/2847, entered into force 10 December 2024. Manufacturers' reporting obligations (Art. 14) have applied since 11 September 2026: actively exploited vulnerabilities and severe incidents go to the CSIRT of the manufacturer's main establishment, and to ENISA, through the CRA Single Reporting Platform, with an early warning within 24 hours and a full notification within 72 hours. The main obligations apply from 11 December 2027. Relevant to coordinated disclosure timelines when you report an exploited bug to a manufacturer. [verify 2026-10-31]

United Kingdom:

  • Computer Misuse Act 1990 — unauthorized access (s.1), unauthorised acts with intent to impair, or with recklessness as to impairing, operation of a computer (s.3), causing or risking serious damage (s.3ZA). The Home Office reviewed the Act through a call for information (2021) and a consultation (2023, outcome published November 2023). [verify 2026-10-31]

Many programs include safe harbor language:

"We will not pursue legal action against researchers who:
- Make good faith effort to avoid privacy violations
- Only access data necessary for vulnerability demonstration
- Do not perform attacks that degrade service quality
- Report vulnerabilities promptly
- Keep vulnerability information confidential until fix is available"

Verify safe-harbor coverage before testing — disclose.io (https://disclose.io/) maintains a model VDP and a directory of programs that have adopted compatible safe-harbor terms.

Ethical Research Checklist​

Before testing:

  • Written authorization (scope, rules of engagement)
  • Understand legal boundaries (relevant statute(s) per jurisdiction)
  • Appropriate insurance (if applicable, especially for commercial pentest work)
  • Emergency contact for responsible disclosure

During research:

  • Only test authorized systems
  • Minimize impact (no DoS, don't access unnecessary data)
  • Document findings thoroughly
  • Protect sensitive data discovered

After discovery:

  • Report vulnerability to vendor promptly
  • Provide reasonable time for vendor to fix (90 days standard)
  • Don't publicly disclose until fix is available
  • Request CVE for tracking

Appendix: Vulnerability Classification​

CWE (Common Weakness Enumeration)​

CWE IDNameCategory
CWE-119Improper Restriction of Operations within the Bounds of a Memory BufferMemory Corruption
CWE-79Cross-Site ScriptingInjection
CWE-89SQL InjectionInjection
CWE-416Use After FreeMemory Corruption
CWE-787Out-of-bounds WriteMemory Corruption
CWE-20Improper Input ValidationInput Validation
CWE-125Out-of-bounds ReadInformation Disclosure
CWE-78OS Command InjectionInjection
CWE-190Integer OverflowNumeric Errors
CWE-862Missing AuthorizationAccess Control
CWE-1284Improper Validation of Specified Quantity in InputInput Validation
CWE-352Cross-Site Request ForgeryWeb

The annual CWE Top 25 Most Dangerous Software Weaknesses (https://cwe.mitre.org/top25/) is the standard reference for current CWE prevalence — re-pull each year when scoring.

OWASP Top 10 Mapping​

OWASP Top 10:2025 is the current published edition (see owasp.org/Top10/2025/). Both ID sets are tracked below because most security-tool findings (sqlmap, Nuclei, Burp, etc.) still emit 2021 IDs — confirm reporting alignment per engagement.

2025 ID2021 IDCategoryRelated CWEs
A01:2025A01:2021Broken Access ControlCWE-22, CWE-284, CWE-639
A02:2025A05:2021Security MisconfigurationCWE-16, CWE-611
A03:2025(new)Software Supply Chain FailuresCWE-1035, CWE-1104, CWE-829, CWE-494
A04:2025A02:2021Cryptographic FailuresCWE-259, CWE-327, CWE-916
A05:2025A03:2021InjectionCWE-79, CWE-89, CWE-94
A06:2025A04:2021Insecure DesignCWE-209, CWE-256, CWE-501
A07:2025A07:2021Authentication FailuresCWE-287, CWE-384
A08:2025A08:2021Software or Data Integrity FailuresCWE-502, CWE-829
A09:2025A09:2021Security Logging and Alerting FailuresCWE-117, CWE-223
A10:2025(new)Mishandling of Exceptional ConditionsCWE-755, CWE-248
(dropped)A10:2021Server-Side Request ForgeryCWE-918

Notable 2021 → 2025 changes: Security Misconfiguration jumped A05 → A02; A06:2021 Vulnerable Components broadened into A03:2025 Software Supply Chain Failures (covering build pipelines, package registries, and signed artefacts in addition to outdated libs); SSRF (A10:2021) dropped from the Top 10 (methodology still relevant — see web-application-security SOP); A10:2025 Mishandling of Exceptional Conditions is new (covers error-handling logic flaws).


Analysis:

Pentesting & Security:

Cross-cutting:


External & Reference Resources​

Vulnerability databases:

Standards & scoring:

Fuzzing & analysis:

Exploit dev & ROP:

Community & primary sources:


Version: 2.0 Last Updated: 2026-10-31 Review Frequency: Quarterly (fuzzing toolchain, mitigation landscape, CVE program updates)