SKILL: Bug Identification
Metadata
Description
Systematic bug identification methodology: source code review patterns, black-box testing strategies, taint analysis, dangerous function hunting, data flow tracing, and automated scanning setup. Use for code audits, bug bounty triage, or building vulnerability identification pipelines.
Trigger Phrases
Use this skill when the conversation involves any of:
bug identification, code review, taint analysis, dangerous functions, data flow, source audit, black box, vulnerability identification, static analysis, code audit, bug hunting
Instructions for Claude
When this skill is active:
- Load and apply the full methodology below as your operational checklist
- Follow steps in order unless the user specifies otherwise
- For each technique, consider applicability to the current target/context
- Track which checklist items have been completed
- Suggest next steps based on findings
Full Methodology
Bug Identification
Overview
Bug identification is the process of discovering potential vulnerabilities in software through various techniques including static analysis, dynamic analysis, and fuzzing. This document outlines methodologies and tools for effective vulnerability research.
For practical exploit development, see Exploit Development.
flowchart TD
BugId["Bug Identification"]
%% Main Methods
Static["Static Analysis"]
Dynamic["Dynamic Analysis"]
Fuzzing["Fuzzing"]
AI["AI-Assisted"]
%% Static Analysis Methods
CodeReview["Manual Code Review"]
RevEng["Reverse Engineering"]
PatchDiff["Patch Diffing"]
StaticTools["Static Analysis Tools"]
SBOM["Supply Chain Analysis"]
%% Dynamic Analysis Methods
DebugTrace["Debugging/Tracing"]
DBI["Dynamic Binary Instrumentation"]
Taint["Taint Analysis"]
SymExec["Symbolic Execution"]
Snapshot["Snapshot Analysis"]
%% Fuzzing Methods
DumbFuzz["Dumb Fuzzing"]
SmartFuzz["Smart Fuzzing"]
EvoFuzz["Evolutionary Fuzzing"]
LLMFuzz["LLM-Guided Fuzzing"]
%% AI Methods
LLMTriage["LLM Crash Triage"]
MLPattern["ML Pattern Recognition"]
AutoVariant["Automated Variant Analysis"]
%% Connections
BugId --> Static
BugId --> Dynamic
BugId --> Fuzzing
BugId --> AI
Static --> CodeReview
Static --> RevEng
Static --> PatchDiff
Static --> StaticTools
Static --> SBOM
Dynamic --> DebugTrace
Dynamic --> DBI
Dynamic --> Taint
Dynamic --> SymExec
Dynamic --> Snapshot
Fuzzing --> DumbFuzz
Fuzzing --> SmartFuzz
Fuzzing --> EvoFuzz
Fuzzing --> LLMFuzz
AI --> LLMTriage
AI --> MLPattern
AI --> AutoVariant
%% Combinations
Taint -.-> Fuzzing
SymExec -.-> Fuzzing
RevEng -.-> Fuzzing
AI -.-> Fuzzing
AI -.-> Static
class BugId primary
Vulnerability Research Methodology
Phase 1: Reconnaissance
- Target Enumeration: Identify version, dependencies, configuration
- Attack Surface Mapping: List all input vectors, APIs, protocols
- Documentation Review: RFCs, specifications, developer docs
- Prior Art Analysis: CVE database, exploit-db, bug trackers
Phase 2: Static Analysis
- Source Review: If available, focus on parsing/validation code
- Binary Analysis: Reverse engineering with Ghidra/IDA
- Patch Diffing: Compare vulnerable vs patched versions
- SBOM Analysis: Check third-party component vulnerabilities
Phase 3: Dynamic Analysis
- Behavioral Analysis: Monitor syscalls, network, file I/O
- Debugging: Trace execution paths with controlled input
- Instrumentation: Coverage-guided exploration
- Taint Analysis: Track input propagation
Phase 4: Fuzzing
- Corpus Generation: Create valid seed inputs
- Harness Development: Isolate target functionality
- Coverage Monitoring: Identify untested code paths
- Crash Triage: Classify and prioritize findings
Phase 5: Exploitation
- Primitive Development: Convert bug to reliable primitives
- Mitigation Bypass: Defeat ASLR, DEP, CFG, etc.
- Payload Development: Create working exploit
- Weaponization: Package for real-world use (if authorized)
Attack Surface Identification
Before diving into specific bug hunting techniques, it's essential to understand where to look for vulnerabilities.
Windows User Mode
- Shared Memory
- RPC
- Named Pipes
- File & Network IO
- Windows Messages
- For authentication-related vulnerabilities, see Windows Auth
Kernel
- Device Drivers
- Many third-party software with drivers to target
- Can accept arbitrary user input via the
IOCTL interface
- Also performs actions when we
open,close handles to it
- OS
- Drivers that handle hardware and user input
- Intercepts/transitions from user to kernel
- Modern Linux interfaces (hotspots)
- io_uring: SQE size/offset confusions, submission/completion race windows, kernel copy‑sizes derived from user buffers
- userfaultfd: cross‑thread write‑what‑where and TOCTOU primitives during fault handling
- seccomp user‑notifier: confused‑deputy patterns in broker processes; notifier time‑of‑check vs time‑of‑use gaps
- Hyper-V & VTL Interfaces – On many modern Windows 11 systems (especially 24H2 on supported hardware), Virtualization‑Based Security and VTL1 are enabled or easily enabled by policy. Treat the hypervisor surface (e.g.,
hvix64.exe and synthetic MSRs) as a common kernel target, and verify VBS/HVCI status on the host before assuming defaults.
Drivers
- DriverEntry: registers for any callbacks, setup structure, etc
- I/O Handlers: handlers that get called when a process attempts to
open,close,etc the driver, IOCTL allows driver functionality to be called from user processes
- Practical triage example (CVE‑2025‑8061):
- IOCTL handlers that accept a fixed‑size struct and pass a user‑controlled
PHYSICAL_ADDRESS directly to MmMapIoSpace
- then memcpy out/in mapped memory (sometimes via wrappers that swap src/dst) indicate physical memory read/write primitives.
- Similarly, unguarded MSR read/write paths yield
RDMSR/WRMSR primitives.
- See the Lenovo
LnvMSRIO.sys case study in windows-kernel.md
eBPF & XDP
- BPF helpers and verifier: pointer leaks, verifier bypass, JIT bugs
- User‑entry vectors:
bpf() syscall, privileged pods in Kubernetes, Cilium datapath
- Tooling:
bpftool, verifier logs, bpftrace scripts for quick triage
- CO‑RE skeletons (
bpftool gen skeleton) simplify packaging portable tracing probes.
- BPF LSM hooks allow low‑overhead coverage feedback on security‑critical kernel paths; export events with
trace_pipe.
Container & Micro‑VM Surface
- Namespace/cgroup escapes, device‑mapper abuse, races in snapshotting backends (e.g., overlayfs)
- Micro‑VM hypercalls in Firecracker, CloudHypervisor, Kata Containers
- For detailed container exploitation techniques, see Container
Cloud‑Native & IAM Bugs
- Misconfigured IAM policies, privilege‑escalating API actions (AWS
sts:AssumeRole, Azure Golden SAML)
- SSRF paths into metadata services (
169.254.169.254, IMDSv2 bypass techniques)
- Race conditions in managed control‑plane components (Kubernetes API server, AWS Lambda workers)
- Kubernetes Attack Vectors: look at kubernetes for a deeper checklist
- Serverless Vulnerabilities:
- Lambda layer poisoning
- Function URL authentication bypass
- Event injection through SQS/SNS/EventBridge
- Cold start race conditions
Network / Transport Protocol Parsers
- QUIC / HTTP/3: coalesced frames, reorder/timing corner cases; verify against RFC 9000 (QUIC) and RFC 9114 (HTTP/3)
- HTTP/2: stream state machine desync; flow‑control integer edge cases (RFC 7540)
- gRPC / Protobuf: length truncation across language FFI, map/list coercion; see gRPC framing and protobuf varint rules
- GraphQL: input coercion and resolver recursion limits; check GraphQL spec for type coercion semantics
WebAssembly Runtimes
- WASM JIT optimization bugs in V8, Wasmtime, Wasmer
- WASI sandbox escapes through host‑call interfaces
- Typed‑Func‑Refs, GC, Tail‑calls, Memory64 expand type/bounds confusion surface. See the WebAssembly proposals status page for current rollout and engine adoption.
- Checklist:
- validate table element types/import signatures/hostcall marshalling
- fuzz mixed 32/64-bit memories.
- Fuzzing tip: compile native libs to WASM for fast, deterministic mutation cycles
Browser / JS Engine Exploitation
Modern V8 Architecture (2024-2025)
V8 now uses a multi-tier JIT pipeline with distinct exploitation characteristics:
- Ignition (Interpreter): Bytecode interpreter; rarely targeted directly
- Maglev (Mid-tier JIT): Introduced Chrome 115+; simpler IR than TurboFan
- TurboFan (Optimizing JIT): Aggressive optimization; traditional exploitation target
- Turboshaft: New IR replacing TurboFan internals; different optimization patterns create new bug classes
- Type lattice changes affecting confusion bugs
- Maglev → Turboshaft transition paths expose state inconsistencies
- Node-based to block-based IR transition
V8 Maglev Exploitation
- Integer overflow in Maglev's fast-path arithmetic
- Corrupted HeapNumber backing store via Maglev bounds check bypass
- Map/ElementsKind confusion in polymorphic inline caches
WebAssembly JSPI (JavaScript Promise Integration)
- Stack Heap Spray: Suspended WASM stacks allocated on heap; predictable layout
- Type Confusion:
WebAssembly.Suspending wrapper type mismatch
- Info Leak: Stack pointers exposed through Promise resolution chains
- Sandbox Escape: JSPI bridges JS/WASM boundary; bypass traditional WASM isolation
Spectre-BHB Browser Mitigations
- Chrome 120+: Site Isolation per-frame; shared array buffer restrictions
- Firefox 122+: Process-per-site with BHI fences in JIT trampolines
- Safari 17.4+: WebKit JIT speculation guards on type checks
Site Isolation Plus
- Frame-level process isolation: Each cross-origin frame in separate process
- Cross-origin memory protection: Hardware-backed memory isolation
- New IPC attack surface: Mojo interface exploitation required for escapes
- Renderer → Browser requirements: Need Mojo race or type confusion
- New Info-Leak Requirements:
- Traditional
SharedArrayBuffer + Atomics timing attacks less reliable
- Need alternative side-channels: CSS timing, WebGL shader execution, AudioContext
- Cross-origin info leaks require chaining multiple primitives
Practical Browser Exploitation Workflow
Target Selection:
- V8 Maglev for Chrome/Edge (faster development cycle = more bugs)
- JSC for Safari (less scrutiny than V8)
- SpiderMonkey for Firefox (IonMonkey/Warp still viable)
Primitive Development:
addrof: Leak object addresses (info leak)
fakeobj: Craft fake object (type confusion)
arbread/arbwrite: Arbitrary memory access
shellcode: RWX page or WASM JIT abuse
Sandbox Escape:
- Mojo IPC race conditions
- GPU process exploitation via WebGL
- Utility process TOCTOU (Chrome's new architecture)
Post-Exploitation:
- Chrome: Target browser process via Mojo
- Safari: XPC service exploitation for sandbox escape
- Firefox: Target parent process via IPC
Firmware & Embedded
- UEFI DXE driver flaws, BMC web console auth bypass, ECU/CAN message injection
- BLE & Zigbee stack overflows, heap exploits in
btstack, lwIP
macOS / Apple‑Silicon Kernel
- IOKit user‑client input validation, IOMFB allocator corner‑cases
- Hypervisor.framework fuzzing with
hv_fuzz
Mobile Platforms (iOS/Android)
iOS 17+ Exploitation
- PAC Bypass: Pointer Authentication Code bypass via signing gadgets
- PPL Bypass: Page Protection Layer exploitation for kernel r/w
- Secure Enclave: SEP exploitation via malformed Mach messages
- Neural Engine: ANE kernel driver attack surface
Android 14+ Exploitation
- MTE (Memory Tagging): Probabilistic bypass with tag collisions
- GKI (Generic Kernel Image): Vendor hooks as attack surface
- Scudo Hardening: Heap exploitation with hardened allocator
- Hardware Attestation: Keymaster/StrongBox TEE attacks
Cross-Platform Mobile
- Flutter: Dart VM type confusion, FFI boundary issues
- React Native: JavaScript bridge serialization bugs
- Unity: IL2CPP memory corruption, native plugin vulnerabilities
Supply Chain Attack Surface
Package Manager Vulnerabilities
- Dependency Confusion: Internal vs public package name conflicts
- Typosquatting: Similar package names (numpy vs numpi)
- Manifest Manipulation: Lock file poisoning, version pinning bypass
- Build-time Injection: Malicious install scripts, post-install hooks
CI/CD Pipeline Analysis
- GitHub Actions: Workflow poisoning via PR from forked repos
- Jenkins: Groovy script injection, plugin vulnerabilities
- Docker: Build argument exploitation, base image substitution
- Secrets Exposure: Environment variables in build logs, artifact leakage
AI & LLM Application Security
- Prompt‑injection, sandbox boundary escapes, hidden‑channel data exfil
- See AI Security for a deeper checklist
Confidential‑Computing / TEE Surface
- Intel TDX: diff
tdx.ko or tdx_psci.c between kernel LTS branches to spot new GPA→HPA validation checks.
- AMD SEV‑SNP: look for unchecked
VMGEXIT leafs in PSP firmware; sevtool --decode helps locate IDA entry points.
- Arm CCA / RMM: analyze SMC handlers inside Realm Management Monitor (RMM) EL3 firmware.
- Cloud offerings (Azure CCE, Google C3): focus on paravirtualised MMIO and attestation report flows exposed to guests.
- For TEE-specific exploitation, see Secure Enclaves
GPU & vGPU Surface
- HGX HMC (verify CVE/advisories): research indicates malformed NVLINK‑C2C packets can corrupt HMC register space; confirm against vendor advisories for the specific platform.
- vGPU manager IOCTLs: diff
nvidia‑vgpu‑mgr monthly; watch VGPU_PLUGIN_IOCTL_GET_STATE and similar calls for unchecked buffers.
- LeftoverLocals info‑leak: contiguous VRAM allocations can leak data from prior tenants in multi‑tenant AI clusters.
Hardware Security Attack Surface
Side-Channel Analysis
- Power Analysis: DPA/SPA attacks on cryptographic operations
- Electromagnetic (EM): Near-field probing of processor emissions
- Timing Attacks: Cache timing, branch prediction analysis
- Acoustic: Key extraction via CPU sound emissions
Fault Injection
- Voltage Glitching: Brown-out attacks on secure boot
- Clock Glitching: Skip instruction execution
- Laser Fault Injection (LFI): Targeted bit flips
- EM Pulse Injection: Wider area fault induction
Hardware Implants & Supply Chain
- PCB Modification: Added components, trace rerouting
- Firmware Backdoors: UEFI/BMC persistent implants
- Hardware Trojans: Malicious logic in ICs
- DMA Attacks: PCIe, Thunderbolt, FireWire exploitation
EDR Driver Vulnerability Research
Common vulnerability types in EDR drivers
- Authorization bypass issues
- Memory corruption in IOCTL handlers
- Race conditions in driver communication
- Improper input validation
- For detailed EDR analysis techniques, see EDR
Research methodology
- Identify accessible driver interfaces
- Reverse engineer IOCTL/message handlers
- Analyze authorization mechanisms
- Test for input validation flaws
- Look for race conditions and memory corruption
Tools for driver analysis
- IDA Pro / Ghidra for reverse engineering
- WinDbg for dynamic analysis
- Process Monitor for behavior analysis
- Custom fuzzing tools for interface testing
Quick triage rubric (post‑crash)
- Buffer overflow vs UAF: check access type, allocation lifetime, and red‑zones (ASan/KASAN reports)
- Integer issues: trace size/length and allocation math; look for truncation/casts
- Logic bugs: unexpected state transitions without memory errors; validate auth/flags
- Info‑leaks: uninitialized reads, OOB reads, pointer/string formatters
Coverage‑first recon checklist
- Produce one baseline coverage run (e.g.,
drcov, Intel® PT, or Lighthouse import)
- Identify cold paths reachable from attacker inputs
- Seed corpus: include minimal valid examples that traverse target parsers
- Enable lightweight oracles (ASan/UBSan/KASAN) where feasible to maximize signal
Static Analysis Methods
Static analysis examines code without execution to identify potential vulnerabilities.
Manual Code Review
- Installing the target application and examining its structure
- Enumerating the ways to feed input to it
- Examine the file formats and network protocols that the application uses
- Locating logical vulnerabilities or memory corruptions
- For Windows-specific techniques, see Windows Kernel
- For Linux-specific techniques, see Linux
Patch Diffing
Patch diffing compares vulnerable and patched versions of binaries to identify security changes.
What is Patch Diffing
Patch diffing is a technique to identify changes across versions of binaries related to security patches. It compares a vulnerable version of a binary with a patched one to highlight the changes, helping to discover new, missing, and interesting functionality across versions.
Benefits
- Single Source of Truth: Without a CVE blog post or sample POC, a patch diff can be the only source of information to determine changes and deduce the original issue.
- Vulnerability Discovery: While understanding the original issue, you may discover additional vulnerabilities in the troubled code area.
- Skill Development: Patch diffing provides focused practice in reverse engineering and helps build mental models for various vulnerability classes.
Challenges
- Asymmetry: Small source code changes can drastically affect compiled binaries.
- Finding Security-Related Changes: Security patches often include other changes like new features, bug fixes, and performance improvements.
- Minimizing Noise:
- Diff the correct binaries to avoid analyzing unrelated updates
- Reduce the time delta between compared versions
- Use binary symbols when available to add precision to comparisons
Tools
- IDA Pro with plugins like DarunGrim and Diaphora
- BinDiff Works with analysis output from IDA or Ghidra
- Ghidriff: Ghidra binary diffing engine
- Radare2 (radiff2)
- Ghidra Version Tracking Tool
- Ghidra 11 built-in Partial Match Correlator
Patch Diffing Workflow
The process of patch diffing typically follows these steps:
Preparation
- Create a diffing session
- Load binary versions (vulnerable and patched)
- Ensure binaries pass preconditions
- Run auto-analysis on both binaries
Evaluation
- Run correlators to find similarities
- Generate associations between binaries
- Evaluate matches between functions
- Accept matching functions
- Analyze differences until sufficient understanding is reached
Function Analysis
- Identify new functions: Functions in the patched binary with no match in the original
- Identify deleted functions: Functions in the original binary with no match in the patched version
- Identify changed functions: Functions that exist in both versions but have been modified
- Focus on functions with security relevance (often indicated by their names or based on CVE descriptions)
Interpreting Results
- New functions often indicate added security checks or validation
- Changed functions may show modified logic for handling edge cases
- Correlate changes with public CVE information when available
- Remember that patches are not necessarily atomic - multiple issues may be fixed in one update
When using Ghidra's Version Tracking:
- Use "Show Only Unmatched Functions" filter to identify new or deleted functions
- Look for functions with a similarity score below 1.0 to find modified functions
- Examine the modified functions to understand what security checks were added
Starting with Ghidra 11 (December 2024) a built-in Partial Match Correlator covers most PatchDiffCorrelator use-cases; install the plugin only if you need bulk-mnemonics scoring.
Case Study: 7‑Zip Symlink Path Traversal
- Target: 7‑Zip 24.09 (vulnerable) → 25.00 (fixed)
- File of interest:
CPP/7zip/UI/Common/ArchiveExtractCallback.cpp
- High‑signal edits: absolute‑path detection and link‑path validation for WSL/Linux symlinks converted on Windows.
Minimal security‑relevant diff (simplified):
-bool IsSafePath(const UString &path)
+static bool IsSafePath(const UString &path, bool isWSL)
{
CLinkLevelsInfo levelsInfo;
- levelsInfo.Parse(path);
+ levelsInfo.Parse(path, isWSL);
return !levelsInfo.IsAbsolute
&& levelsInfo.LowLevel >= 0
&& levelsInfo.FinalLevel > 0;
}
+bool IsSafePath(const UString &path);
+bool IsSafePath(const UString &path)
+{
+ return IsSafePath(path, false); // isWSL
+}
-void CLinkLevelsInfo::Parse(const UString &path)
+void CLinkLevelsInfo::Parse(const UString &path, bool isWSL)
{
- IsAbsolute = NName::IsAbsolutePath(path);
+ IsAbsolute = isWSL ? IS_PATH_SEPAR(path[0]) : NName::IsAbsolutePath(path);
LowLevel = 0;
FinalLevel = 0;
}
Root cause (logic):
- Linux/WSL symlink data containing a Windows‑style path (e.g.,
C:\...) was treated as relative by the Linux absolute‑path check, setting linkInfo.isRelative = true.
SetFromLinkPath prefixed the symlink’s zip‑internal directory when building relatPath, letting IsSafePath(relatPath) pass despite an absolute Windows target.
- A subsequent “dangerous link” guard checked
_item.IsDir; non‑directory symlinks skipped the validation.
- Result: symlink creation to arbitrary absolute Windows paths; extracted files written into the link target.
Practical triage checklist:
- Search this file for:
IsSafePath, CLinkLevelsInfo::Parse, SetFromLinkPath, CloseReparseAndFile, FillLinkData, CLinkInfo::Parse, _ntOptions.SymLinks_AllowDangerous.
- Verify absolute‑path detection across OS semantics (Linux vs Windows) and that relative/absolute status cannot be desynced by mixed‑style paths.
- Ensure “dangerous link” checks run for both files and directories; avoid
_item.IsDir short‑circuiting validation for file symlinks.
- Confirm
IsSafePath evaluates the final target path after concatenations; normalize before validation.
Quick repro (Windows, developer mode or elevated):
- Create zip structure:
data/link → symlink to C:\Users\<USER>\Desktop
data/link\calc.exe → payload file
- If
link is extracted first, subsequent writes follow the symlink into the absolute target directory.
Apple Patch Diffing
- Identify a CVE of interest
- Download corresponding IPSW and update and N-1
- use ipsw.me to download those files
- convert the downloaded
.ipsw to .zip
- Determine changes for update
- Map binaries to CVE
- Extract the related file(s)
- Diff the binaries
- Root cause the vulnerability
# Downloading the correct IPSWs
ipsw download --device Macmini9,1 -V -b 23A344
ipsw download --device Macmini9,1 -V -b 23B74
# Comparing two different IPSWs
ipsw diff UniversalMac_14.0_23A344.ipsw UniversalMac_14.1_23B74.ipsw
# What is inside the DSC
ipsw extract -d IPSW
# Extracting files
ipsw extract -f -p file
# Extracting specific architecture file
ipsw macho lipo Contacts
Windows 11 Patch Diffing
This checklist mirrors the Apple IPSW workflow but uses Microsoft tooling and build numbers.
Identify the target update
- Open Settings → Windows Update → Update history or consult the Windows Release Health dashboard to note the KB and OS build numbers (e.g., KB5037778 → build 22631.3525).
- Record the previous build you want to diff against (e.g., 22631.3447).
Collect the binaries
winbindex download tcpip.sys 10.0.22631.3447 10.0.22631.3525
mkdir pre,post
wget -Uri https://www.catalog.update.microsoft.com/Download.aspx?q=KB5037778 -OutFile kb.msu
expand -F:* .\kb.msu .\post
# repeat for the older KB into .\pre
# Download both *UUP* bundles, then run
uup_download_windows.cmd --extract
# and copy changed PE files to *pre* / *post*
- Fetch matching symbols
# Requires Debugging Tools for Windows
foreach ($ver in '3447','3525') {
symchk /r .\$ver /s SRV*https://msdl.microsoft.com/download/symbols
}
Load in the disassembler
- Open tcpip.sys from both pre and post folders in IDA 8+ or Ghidra 11; ensure PDB symbols resolve.
- Save the IDA databases (e.g.,
tcpip_3447.i64, tcpip_3525.i64).
Run the diff
Triage the results
- Sort by Similarity % ascending; investigate anything below 95 %.
- Focus on functions with names like
Validate, Parse, Copy, Check, or protocol‑specific handlers (IppReceiveEsp, Ipv6pFragmentReassemble, etc.).
- Determine whether changes add bounds checks, size validations, or privilege checks.
Validate in a lab VM
- Snapshot two Windows 11 VMs (build 3447 and 3525).
- Attach WinDbg (kernel mode) using
bcdedit /dbgsettings net hostip:<IP> port:<PORT>.
- Reproduce the issue against the pre‑patch VM; confirm no crash or breakpoint triggers in the post‑patch VM.
Automate monthly
- Schedule a PowerShell script that, every Patch Tuesday (second Tuesday), downloads the latest Cumulative Update, extracts changed PE files, retrieves symbols, and launches a headless Diaphora diff.
- Email the generated HTML report to quickly spot new attack surface.
[!TIP]
For large modules like ntoskrnl.exe, diff only the .text section to save RAM:
bindiff --primary ntoskrnl_pre.i64 --secondary ntoskrnl_post.i64 --section .text
Linux Kernel Patch Diffing
Patch‑diffing Linux kernels is often faster at the source level, but for binary‑only targets (vendor kernels, modules) function‑level diffing is still practical.
Identify target builds
- Note distro and kernel build (e.g., Ubuntu
6.8.0-47-generic, RHEL 5.14.0-503).
- Capture both pre and post versions (package changelogs or CVE bulletins help).
Fetch kernel images and debug info
- Ubuntu/Debian:
# Discover versions
apt list -a linux-image-generic | cat
# Download image + modules dirs (repeat for both versions)
apt-get download linux-image-unsigned-<ver>-generic linux-modules-<ver>-generic
# Debug symbols via debuginfod (preferred to ddebs)
export DEBUGINFOD_URLS="https://debuginfod.ubuntu.com https://debuginfod.debian.net"
- Fedora/RHEL/CentOS:
dnf download kernel-core-<ver> kernel-debuginfo-<ver>
rpm2cpio kernel-core-<ver>.rpm | cpio -idmv
rpm2cpio kernel-debuginfo-<ver>.rpm | cpio -idmv
Extract vmlinux
# If only vmlinuz is present, use the upstream helper
/usr/src/linux-headers-<ver>/scripts/extract-vmlinux /boot/vmlinuz-<ver> > vmlinux-<ver>
# Or take vmlinux directly from debuginfo package tree
Identify changed modules quickly
# Compare module trees (pre vs post)
rsync -rcn --delete /lib/modules/<pre>/ /lib/modules/<post>/ | grep -E "\.ko$" | sed 's/^/chg: /'
Function‑level binary diff
- Open
vmlinux-<pre> and vmlinux-<post> in Ghidra 11/IDA 8 and run Diaphora/BinDiff/Ghidriff.
- For hot subsystems (e.g.,
io_uring, net/ipv6, fs/overlayfs), diff only the relevant .ko pairs to reduce noise.
Source‑level triage (when sources are available)
# Ubuntu example: unpack both source trees, then
git diff --no-index -- function.c.orig function.c.patched | less
# Or use diffoscope for enriched reports
Symbolization and crash mapping (cheat‑sheet)
# Decode kernel oops backtraces to lines
./scripts/decode_stacktrace.sh vmlinux /lib/modules/<ver>/build < dmesg.log
# Map PC to file:line quickly
addr2line -e vmlinux-<ver> 0xffffffff81234567
[!TIP]
For modern distros built with Clang: KCFI and fine‑grained CFI thunks create many small stub changes; filter by real function body deltas to focus on security‑relevant logic.
[!NOTE]
Syzkaller routinely bisects kernel bugs; consult syzbot reports for reproducers and fix commits, then confirm your diff isolates the same region before deeper RE.
Kernel network parser identification heuristics (SMB2-inspired, broadly applicable)
Cross-field invariants (length/offset/next)
- Always validate
(offset + length) <= remaining_buffer and <= total_buffer using a widened type (e.g., u64) before arithmetic; reject on overflow with check_add_overflow()/array_size() helpers.
- For chained entries with a
next field, assert: next >= sizeof(entry_header), next <= remaining_buffer, and that pointer advancement actually makes progress. For entries carrying sub-lengths (e.g., name_len, value_len), assert header + name_len + value_len <= next.
- Do not cast to a struct until the full header is present and aligned; gate recasts with a prior
buf_len check.
Fixed-size buffers vs variable-length payloads
- Ban unbounded copies/crypto/decompression into fixed-size arrays. Require
len <= sizeof(array) (or clamp with min_t() and bail) when writing into in-struct arrays.
- Crypto transforms are just writes with extra steps: if using ARC4/AES helpers that copy
len bytes into a fixed buffer (e.g., session keys), bound len against a named maximum constant and prefer allocating a buffer sized from validated len.
Type/width hazards
- Normalize parser math to a wide unsigned type before comparisons; avoid truncating
u32/u64 fields into u16 for size checks. Favor size_t/u64 for offset+len arithmetic, then compare to buf_len of the same width.
Loop structure around next
- Pattern to flag:
e = (struct entry *)((char *)e + next); without a preceding block that revalidates buf_len and the entry’s internal sub-lengths.
- Ensure a break condition on exhaustion and reject zero/negative progress values to avoid infinite loops or pointer stagnation.
Allocation-size correlation
- When parser-controlled
len influences a subsequent write into an object from a fixed SLUB cache (e.g., kmalloc-512), ensure the write length is bounded by the destination object field, not just the incoming length.
Patch-diff signals to prioritize
- Newly added guards like
if (len > CONST) return -EINVAL;, if (buf_len < sizeof(struct foo)) return -EINVAL;, or conversions to min_t(size_t, len, sizeof(...)).
- Insertions of
check_add_overflow(offset, len, &sum) or array_size(n, sz) helpers in hot parse paths.
Static query seeds (Semgrep/CodeQL), to tune per codebase
- Unbounded copies into struct fields:
rules:
- id: c-fixed-array-unbounded-copy
languages: [c, cpp]
patterns:
- pattern: memcpy($DST, $SRC, $LEN)
- pattern-inside: |
struct $S { ... char $BUF[$N]; ... };
...
$DST = &...->$BUF
- pattern-not: memcpy($DST, $SRC, MIN($LEN, sizeof(*$DST)))
message: Unbounded copy into fixed-size struct field
severity: WARNING
- Dangerous
next-driven pointer arithmetic without bounds checks:- id: c-parser-next-missing-bounds
languages: [c, cpp]
pattern: |
$E = (struct $T *)((char *)$E + $NEXT);
message: Parser advances by user-controlled 'next' without prior buf_len/sizeof checks
severity: WARNING
- Crypto/decompression writes to fixed arrays (seed with function names in your tree, e.g.,
*_crypt, *_decrypt, decompress_*).
Dynamic confirmation (cheap)
- Grammar fuzz small invariants: send
next < header, next > remaining, name_len + value_len > next, and len > MAX_CONST variants; expect -EINVAL/reject. If not, investigate.
- Use TUN/TAP + KCOV to drive packet/SMB request paths; enable KASAN/KMSAN to surface overflows/leaks early.
Reference (motivating example)
- Lessons distilled from a 2025 ksmbd remote chain writeup combining a fixed-buffer overflow in NTLM auth with an EA
next validation issue — see Will’s Root: Eternal‑Tux: KSMBD 0‑Click RCE (https://www.willsroot.io/2025/09/ksmbd-0-click.html).
Case Study: EvilESP Vulnerability (CVE-2022-34718)
This case study demonstrates real-world patch diffing to identify a Windows TCP/IP RCE vulnerability.
Vulnerability Overview
- CVE-2022-34718: Critical RCE in
tcpip.sys discovered in September 2022
- An unauthenticated attacker could send specially crafted IPv6 packets to Windows nodes with IPsec enabled
- Affects the handling of ESP (Encapsulating Security Payload) packets in IPv6 fragmentation
Patch Diffing Process
Binary Acquisition
- Used Winbindex to obtain sequential versions of
tcpip.sys (pre-patch and post-patch)
- Loaded both files in Ghidra with PDB symbols
Diff Analysis
- Used BinDiff to compare the binaries
- Identified only two functions with less than 100% similarity:
IppReceiveEsp and Ipv6pReassembleDatagram
Code Analysis
- Ipv6pReassembleDatagram: Added bounds check comparing
nextheader_offset against the header buffer length
- IppReceiveEsp: Added validation for the Next Header field of ESP packets
Root Cause Identification
- Found an out-of-bounds 1-byte write vulnerability
- ESP Next Header field is located after the encrypted payload data
- A malicious packet could cause
nextheader_offset to exceed the allocated buffer size
(Update: Server 2022 build 20349.2300, May 2024, hardened this code path; the original PoC needs a 2-byte pad tweak to reproduce the crash.)
Exploitation
- Required setting up IPsec security association on the victim
- Created fragmented IPv6 packets encapsulated in ESP
- Controlled the offset of the out-of-bounds write through payload and padding size
- Value written is controllable via the Next Header field
- Limited to writing to addresses that are 4n-1 aligned (where n is an integer)
- Initially achieved DoS with potential for RCE through further exploitation
Lessons Learned
- Binary patch diffing effectively identified the vulnerability location and nature
- Understanding protocol specifications (ESP and IPv6 fragmentation) was critical
- Simple buffer checks are still overlooked in complex networking code
- Even limited primitives (single byte overwrite at constrained offsets) can be dangerous
- For modern exploitation techniques, see Modern Samples
- For mitigation bypass techniques, see Modern Mitigations
When applying patch diffing to networking protocols:
- Understand the protocol specifications thoroughly
- Look for missing bounds checks in data processing
- Pay attention to buffer size calculations
- Check for proper validation of protocol field values and locations
- Consider evasion techniques for exploit deployment - see EDR
- Specs: ESP (RFC 4303) and IPv6 (RFC 8200) are essential references when reasoning about header placement and bounds
Semi-Automatic Patch Diffing
Manual Patch Diffing
- Microsoft releases patches on the second Tuesday of each month
- For Windows you can go to update catalog and search for the product version (for example
2022-10 x64 "Windows 10" 22H2)
- Try to look for smaller updates
mkdir 2022-09
mv *.msu 2022-09
cd 2022-09
mkdir extract
mkdir patch
expand -F:* .\*.msu .\extract
expand -F:* .\extract\<largest>.cab .\patch
expand -F:* .\patch\<largest>.cab .\patch
expand -F:* .\patch\Cab_* .\patch\
You can use Patch Extract instead
gci -Recurse c:\windows\WinSxS\ -Filter ntdll.dll
# copy the biggest file somewhere
.\delta_patch.py -i .\NTDLL\ntdll.dll -o ntdll.2020-10.dll .\NTDLL\r\ntdll.dll .\2020-10\x64\ntdll_<stuff>\f\ntdll.dll
.\delta_patch.py -i .\NTDLL\ntdll.dll -o ntdll.2020-11.dll .\NTDLL\r\ntdll.dll .\2020-11\x64\ntdll_<stuff>\f\ntdll.dll
Open unpatched version in IDA as the primary and the second, after that use BinDiff add-on to find the differences between them
then right click on a different matched function and see the visual diff in bin diff
also you can uncheck proximity browsing to see the entire function
look at red blocks and then yellow blocks
With patch clean script you can only see the actual changed files
Static Analysis Tools
IDA Pro and Rust Tools for Vulnerability Research
rhabdomancer: IDA Pro headless plugin that locates calls to potentially insecure API functions in binary files
- Helps auditors backtrace from candidate points to find pathways allowing access from untrusted input
- Generates JSON/SARIF reports containing vulnerable function calls and their details
- Written in Rust using IDA Pro 9 idalib and Binarly's idalib Rust bindings
haruspex: IDA Pro headless plugin that extracts pseudo-code generated by IDA Pro's decompiler
- Exports pseudo-code in a format suitable for IDEs or static analysis tools like Semgrep/weggli
- Creates individual files for each function with their pseudo-code
- Can be used as a library by third-party crates
augur: IDA Pro headless plugin that extracts strings and related pseudo-code from binary files
- Stores pseudo-code of functions that reference strings in an organized directory tree
- Helps trace how strings are used within the application
- Complements other reverse engineering tools
Modern Static Analysis Tools
- Semgrep Pro – Cloud-augmented SAST with custom rule sharing, LLM-assisted rule writing
- CodeQL – GitHub's semantic code analysis, excellent for variant analysis
- Weggli – Fast semantic search for C/C++ (better than grep for code patterns)
- Joern – Code property graph analysis for vulnerability discovery
- Ghidra 11.2+ – Built-in ML-powered function signature recognition
- Binary Ninja 4.0 – Cloud collaboration, improved HLIL decompilation
…(truncated)
1---2name: offensive-bug-identification3description: Systematic bug identification methodology: source code review patterns, black-box testing strategies, taint analysis, dangerous function hunting, data flow tracing, and automated scanning setup. Use for code audits, bug bounty triage, or building vulnerability identification pipelines. Use only for authorized security research, training, or assessment.4license: MIT5---6# SKILL: Bug Identification78## Metadata9- **Skill Name**: bug-identification10- **Folder**: offensive-bug-identification11- **Source**: https://github.com/SnailSploit/offensive-checklist/blob/main/bug-identification.md1213## Description14Systematic bug identification methodology: source code review patterns, black-box testing strategies, taint analysis, dangerous function hunting, data flow tracing, and automated scanning setup. Use for code audits, bug bounty triage, or building vulnerability identification pipelines.1516## Trigger Phrases17Use this skill when the conversation involves any of:18`bug identification, code review, taint analysis, dangerous functions, data flow, source audit, black box, vulnerability identification, static analysis, code audit, bug hunting`1920## Instructions for Claude2122When this skill is active:231. Load and apply the full methodology below as your operational checklist242. Follow steps in order unless the user specifies otherwise253. For each technique, consider applicability to the current target/context264. Track which checklist items have been completed275. Suggest next steps based on findings2829---3031## Full Methodology3233# Bug Identification3435## Overview3637Bug identification is the process of discovering potential vulnerabilities in software through various techniques including static analysis, dynamic analysis, and fuzzing. This document outlines methodologies and tools for effective vulnerability research.3839For practical exploit development, see [Exploit Development](/exploit/development.md).4041```mermaid42flowchart TD43 BugId["Bug Identification"]4445 %% Main Methods46 Static["Static Analysis"]47 Dynamic["Dynamic Analysis"]48 Fuzzing["Fuzzing"]49 AI["AI-Assisted"]5051 %% Static Analysis Methods52 CodeReview["Manual Code Review"]53 RevEng["Reverse Engineering"]54 PatchDiff["Patch Diffing"]55 StaticTools["Static Analysis Tools"]56 SBOM["Supply Chain Analysis"]5758 %% Dynamic Analysis Methods59 DebugTrace["Debugging/Tracing"]60 DBI["Dynamic Binary Instrumentation"]61 Taint["Taint Analysis"]62 SymExec["Symbolic Execution"]63 Snapshot["Snapshot Analysis"]6465 %% Fuzzing Methods66 DumbFuzz["Dumb Fuzzing"]67 SmartFuzz["Smart Fuzzing"]68 EvoFuzz["Evolutionary Fuzzing"]69 LLMFuzz["LLM-Guided Fuzzing"]7071 %% AI Methods72 LLMTriage["LLM Crash Triage"]73 MLPattern["ML Pattern Recognition"]74 AutoVariant["Automated Variant Analysis"]7576 %% Connections77 BugId --> Static78 BugId --> Dynamic79 BugId --> Fuzzing80 BugId --> AI8182 Static --> CodeReview83 Static --> RevEng84 Static --> PatchDiff85 Static --> StaticTools86 Static --> SBOM8788 Dynamic --> DebugTrace89 Dynamic --> DBI90 Dynamic --> Taint91 Dynamic --> SymExec92 Dynamic --> Snapshot9394 Fuzzing --> DumbFuzz95 Fuzzing --> SmartFuzz96 Fuzzing --> EvoFuzz97 Fuzzing --> LLMFuzz9899 AI --> LLMTriage100 AI --> MLPattern101 AI --> AutoVariant102103 %% Combinations104 Taint -.-> Fuzzing105 SymExec -.-> Fuzzing106 RevEng -.-> Fuzzing107 AI -.-> Fuzzing108 AI -.-> Static109110 class BugId primary111```112113## Vulnerability Research Methodology114115### Phase 1: Reconnaissance116117- **Target Enumeration:** Identify version, dependencies, configuration118- **Attack Surface Mapping:** List all input vectors, APIs, protocols119- **Documentation Review:** RFCs, specifications, developer docs120- **Prior Art Analysis:** CVE database, exploit-db, bug trackers121122### Phase 2: Static Analysis123124- **Source Review:** If available, focus on parsing/validation code125- **Binary Analysis:** Reverse engineering with Ghidra/IDA126- **Patch Diffing:** Compare vulnerable vs patched versions127- **SBOM Analysis:** Check third-party component vulnerabilities128129### Phase 3: Dynamic Analysis130131- **Behavioral Analysis:** Monitor syscalls, network, file I/O132- **Debugging:** Trace execution paths with controlled input133- **Instrumentation:** Coverage-guided exploration134- **Taint Analysis:** Track input propagation135136### Phase 4: Fuzzing137138- **Corpus Generation:** Create valid seed inputs139- **Harness Development:** Isolate target functionality140- **Coverage Monitoring:** Identify untested code paths141- **Crash Triage:** Classify and prioritize findings142143### Phase 5: Exploitation144145- **Primitive Development:** Convert bug to reliable primitives146- **Mitigation Bypass:** Defeat ASLR, DEP, CFG, etc.147- **Payload Development:** Create working exploit148- **Weaponization:** Package for real-world use (if authorized)149150## Attack Surface Identification151152Before diving into specific bug hunting techniques, it's essential to understand where to look for vulnerabilities.153154### Windows User Mode155156- Shared Memory157- RPC158- Named Pipes159- File & Network IO160- Windows Messages161- For authentication-related vulnerabilities, see [Windows Auth](/exploit/windows-auth.md)162163### Kernel164165- _Device Drivers_166 - Many third-party software with drivers to target167 - Can accept arbitrary user input via the `IOCTL` interface168 - Also performs actions when we `open,close` handles to it169- _OS_170 - Drivers that handle hardware and user input171 - Intercepts/transitions from user to kernel172- _Modern Linux interfaces (hotspots)_173 - **io_uring**: SQE size/offset confusions, submission/completion race windows, kernel copy‑sizes derived from user buffers174 - **userfaultfd**: cross‑thread write‑what‑where and TOCTOU primitives during fault handling175 - **seccomp user‑notifier**: confused‑deputy patterns in broker processes; notifier time‑of‑check vs time‑of‑use gaps176- _Hyper-V & VTL Interfaces_ – On many modern Windows 11 systems (especially 24H2 on supported hardware), Virtualization‑Based Security and VTL1 are enabled or easily enabled by policy. Treat the hypervisor surface (e.g., `hvix64.exe` and synthetic MSRs) as a common kernel target, and verify VBS/HVCI status on the host before assuming defaults.177178### Drivers179180- _DriverEntry_: registers for any callbacks, setup structure, etc181- _I/O Handlers_: handlers that get called when a process attempts to `open,close,etc` the driver, `IOCTL` allows driver functionality to be called from user processes182- Practical triage example (CVE‑2025‑8061):183 - IOCTL handlers that accept a fixed‑size struct and pass a user‑controlled `PHYSICAL_ADDRESS` directly to `MmMapIoSpace`184 - then memcpy out/in mapped memory (sometimes via wrappers that swap src/dst) indicate physical memory read/write primitives.185 - Similarly, unguarded MSR read/write paths yield `RDMSR/WRMSR` primitives.186- See the Lenovo `LnvMSRIO.sys` case study in [windows-kernel.md](/exploit/windows-kernel.md)187188### eBPF & XDP189190- **BPF helpers and verifier**: pointer leaks, verifier bypass, JIT bugs191- **User‑entry vectors**: `bpf()` syscall, privileged pods in Kubernetes, Cilium datapath192- **Tooling**: `bpftool`, verifier logs, `bpftrace` scripts for quick triage193- **CO‑RE skeletons** (`bpftool gen skeleton`) simplify packaging portable tracing probes.194- **BPF LSM** hooks allow low‑overhead coverage feedback on security‑critical kernel paths; export events with `trace_pipe`.195196### Container & Micro‑VM Surface197198- Namespace/cgroup escapes, device‑mapper abuse, races in snapshotting backends (e.g., overlayfs)199- Micro‑VM hypercalls in Firecracker, CloudHypervisor, Kata Containers200- For detailed container exploitation techniques, see [Container](/exploit/container.md)201202### Cloud‑Native & IAM Bugs203204- Misconfigured IAM policies, privilege‑escalating API actions (AWS `sts:AssumeRole`, Azure Golden SAML)205- SSRF paths into metadata services (`169.254.169.254`, IMDSv2 bypass techniques)206- Race conditions in managed control‑plane components (Kubernetes API server, AWS Lambda workers)207- Kubernetes Attack Vectors: look at [kubernetes](/pentest/kubernetes.md) for a deeper checklist208- **Serverless Vulnerabilities:**209 - Lambda layer poisoning210 - Function URL authentication bypass211 - Event injection through SQS/SNS/EventBridge212 - Cold start race conditions213214### Network / Transport Protocol Parsers215216- **QUIC / HTTP/3**: coalesced frames, reorder/timing corner cases; verify against RFC 9000 (QUIC) and RFC 9114 (HTTP/3)217- **HTTP/2**: stream state machine desync; flow‑control integer edge cases (RFC 7540)218- **gRPC / Protobuf**: length truncation across language FFI, map/list coercion; see gRPC framing and protobuf varint rules219- **GraphQL**: input coercion and resolver recursion limits; check GraphQL spec for type coercion semantics220221### WebAssembly Runtimes222223- WASM JIT optimization bugs in V8, Wasmtime, Wasmer224- WASI sandbox escapes through host‑call interfaces225- Typed‑Func‑Refs, GC, Tail‑calls, Memory64 expand type/bounds confusion surface. See the WebAssembly proposals status page for current rollout and engine adoption.226- **Checklist**:227 - validate table element types/import signatures/hostcall marshalling228 - fuzz mixed 32/64-bit memories.229 - _Fuzzing tip_: compile native libs to WASM for fast, deterministic mutation cycles230231### Browser / JS Engine Exploitation232233#### Modern V8 Architecture (2024-2025)234235V8 now uses a multi-tier JIT pipeline with distinct exploitation characteristics:236237- **Ignition (Interpreter):** Bytecode interpreter; rarely targeted directly238- **Maglev (Mid-tier JIT):** Introduced Chrome 115+; simpler IR than TurboFan239- **TurboFan (Optimizing JIT):** Aggressive optimization; traditional exploitation target240- **Turboshaft:** New IR replacing TurboFan internals; different optimization patterns create new bug classes241 - Type lattice changes affecting confusion bugs242 - Maglev → Turboshaft transition paths expose state inconsistencies243 - Node-based to block-based IR transition244245#### V8 Maglev Exploitation246247- Integer overflow in Maglev's fast-path arithmetic248- Corrupted HeapNumber backing store via Maglev bounds check bypass249- Map/ElementsKind confusion in polymorphic inline caches250251#### WebAssembly JSPI (JavaScript Promise Integration)252253- **Stack Heap Spray:** Suspended WASM stacks allocated on heap; predictable layout254- **Type Confusion:** `WebAssembly.Suspending` wrapper type mismatch255- **Info Leak:** Stack pointers exposed through Promise resolution chains256- **Sandbox Escape:** JSPI bridges JS/WASM boundary; bypass traditional WASM isolation257258#### Spectre-BHB Browser Mitigations259260- **Chrome 120+:** Site Isolation per-frame; shared array buffer restrictions261- **Firefox 122+:** Process-per-site with BHI fences in JIT trampolines262- **Safari 17.4+:** WebKit JIT speculation guards on type checks263264#### Site Isolation Plus265266- **Frame-level process isolation:** Each cross-origin frame in separate process267- **Cross-origin memory protection:** Hardware-backed memory isolation268- **New IPC attack surface:** Mojo interface exploitation required for escapes269- **Renderer → Browser requirements:** Need Mojo race or type confusion270- New Info-Leak Requirements:271 - Traditional `SharedArrayBuffer + Atomics` timing attacks less reliable272 - Need alternative side-channels: CSS timing, WebGL shader execution, AudioContext273 - Cross-origin info leaks require chaining multiple primitives274275#### Practical Browser Exploitation Workflow2762771. **Target Selection:**278 - V8 Maglev for Chrome/Edge (faster development cycle = more bugs)279 - JSC for Safari (less scrutiny than V8)280 - SpiderMonkey for Firefox (IonMonkey/Warp still viable)2812822. **Primitive Development:**283 - `addrof`: Leak object addresses (info leak)284 - `fakeobj`: Craft fake object (type confusion)285 - `arbread/arbwrite`: Arbitrary memory access286 - `shellcode`: RWX page or WASM JIT abuse2872883. **Sandbox Escape:**289 - Mojo IPC race conditions290 - GPU process exploitation via WebGL291 - Utility process TOCTOU (Chrome's new architecture)2922934. **Post-Exploitation:**294 - Chrome: Target browser process via Mojo295 - Safari: XPC service exploitation for sandbox escape296 - Firefox: Target parent process via IPC297298### Firmware & Embedded299300- UEFI DXE driver flaws, BMC web console auth bypass, ECU/CAN message injection301- BLE & Zigbee stack overflows, heap exploits in `btstack`, `lwIP`302303### macOS / Apple‑Silicon Kernel304305- IOKit user‑client input validation, IOMFB allocator corner‑cases306- Hypervisor.framework fuzzing with `hv_fuzz`307308### Mobile Platforms (iOS/Android)309310#### iOS 17+ Exploitation311312- **PAC Bypass:** Pointer Authentication Code bypass via signing gadgets313- **PPL Bypass:** Page Protection Layer exploitation for kernel r/w314- **Secure Enclave:** SEP exploitation via malformed Mach messages315- **Neural Engine:** ANE kernel driver attack surface316317#### Android 14+ Exploitation318319- **MTE (Memory Tagging):** Probabilistic bypass with tag collisions320- **GKI (Generic Kernel Image):** Vendor hooks as attack surface321- **Scudo Hardening:** Heap exploitation with hardened allocator322- **Hardware Attestation:** Keymaster/StrongBox TEE attacks323324#### Cross-Platform Mobile325326- **Flutter:** Dart VM type confusion, FFI boundary issues327- **React Native:** JavaScript bridge serialization bugs328- **Unity:** IL2CPP memory corruption, native plugin vulnerabilities329330### Supply Chain Attack Surface331332#### Package Manager Vulnerabilities333334- **Dependency Confusion:** Internal vs public package name conflicts335- **Typosquatting:** Similar package names (numpy vs numpi)336- **Manifest Manipulation:** Lock file poisoning, version pinning bypass337- **Build-time Injection:** Malicious install scripts, post-install hooks338339#### CI/CD Pipeline Analysis340341- **GitHub Actions:** Workflow poisoning via PR from forked repos342- **Jenkins:** Groovy script injection, plugin vulnerabilities343- **Docker:** Build argument exploitation, base image substitution344- **Secrets Exposure:** Environment variables in build logs, artifact leakage345346### AI & LLM Application Security347348- Prompt‑injection, sandbox boundary escapes, hidden‑channel data exfil349- See [AI Security](/pentest/ai.md) for a deeper checklist350351### Confidential‑Computing / TEE Surface352353- **Intel TDX**: diff `tdx.ko` or `tdx_psci.c` between kernel LTS branches to spot new GPA→HPA validation checks.354- **AMD SEV‑SNP**: look for unchecked `VMGEXIT` leafs in PSP firmware; `sevtool --decode` helps locate IDA entry points.355- **Arm CCA / RMM**: analyze SMC handlers inside Realm Management Monitor (RMM) EL3 firmware.356- **Cloud offerings (Azure CCE, Google C3)**: focus on paravirtualised MMIO and attestation report flows exposed to guests.357- For TEE-specific exploitation, see [Secure Enclaves](/exploit/secure-enclaves.md)358359### GPU & vGPU Surface360361- **HGX HMC (verify CVE/advisories)**: research indicates malformed NVLINK‑C2C packets can corrupt HMC register space; confirm against vendor advisories for the specific platform.362- **vGPU manager IOCTLs**: diff `nvidia‑vgpu‑mgr` monthly; watch `VGPU_PLUGIN_IOCTL_GET_STATE` and similar calls for unchecked buffers.363- **LeftoverLocals info‑leak**: contiguous VRAM allocations can leak data from prior tenants in multi‑tenant AI clusters.364365### Hardware Security Attack Surface366367#### Side-Channel Analysis368369- **Power Analysis:** DPA/SPA attacks on cryptographic operations370- **Electromagnetic (EM):** Near-field probing of processor emissions371- **Timing Attacks:** Cache timing, branch prediction analysis372- **Acoustic:** Key extraction via CPU sound emissions373374#### Fault Injection375376- **Voltage Glitching:** Brown-out attacks on secure boot377- **Clock Glitching:** Skip instruction execution378- **Laser Fault Injection (LFI):** Targeted bit flips379- **EM Pulse Injection:** Wider area fault induction380381#### Hardware Implants & Supply Chain382383- **PCB Modification:** Added components, trace rerouting384- **Firmware Backdoors:** UEFI/BMC persistent implants385- **Hardware Trojans:** Malicious logic in ICs386- **DMA Attacks:** PCIe, Thunderbolt, FireWire exploitation387388### EDR Driver Vulnerability Research389390#### Common vulnerability types in EDR drivers391392- Authorization bypass issues393- Memory corruption in IOCTL handlers394- Race conditions in driver communication395- Improper input validation396- For detailed EDR analysis techniques, see [EDR](/exploit/edr.md)397398#### Research methodology3994001. Identify accessible driver interfaces4012. Reverse engineer IOCTL/message handlers4023. Analyze authorization mechanisms4034. Test for input validation flaws4045. Look for race conditions and memory corruption405406#### Tools for driver analysis407408- IDA Pro / Ghidra for reverse engineering409- WinDbg for dynamic analysis410- Process Monitor for behavior analysis411- Custom fuzzing tools for interface testing412413#### Quick triage rubric (post‑crash)414415- Buffer overflow vs UAF: check access type, allocation lifetime, and red‑zones (ASan/KASAN reports)416- Integer issues: trace size/length and allocation math; look for truncation/casts417- Logic bugs: unexpected state transitions without memory errors; validate auth/flags418- Info‑leaks: uninitialized reads, OOB reads, pointer/string formatters419420#### Coverage‑first recon checklist421422- Produce one baseline coverage run (e.g., `drcov`, Intel® PT, or Lighthouse import)423- Identify cold paths reachable from attacker inputs424- Seed corpus: include minimal valid examples that traverse target parsers425- Enable lightweight oracles (ASan/UBSan/KASAN) where feasible to maximize signal426427## Static Analysis Methods428429Static analysis examines code without execution to identify potential vulnerabilities.430431### Manual Code Review432433- Installing the target application and examining its structure434- Enumerating the ways to feed input to it435- Examine the file formats and network protocols that the application uses436- Locating logical vulnerabilities or memory corruptions437- For Windows-specific techniques, see [Windows Kernel](/exploit/windows-kernel.md)438- For Linux-specific techniques, see [Linux](/exploit/linux.md)439440### Patch Diffing441442Patch diffing compares vulnerable and patched versions of binaries to identify security changes.443444#### What is Patch Diffing445446Patch diffing is a technique to identify changes across versions of binaries related to security patches. It compares a vulnerable version of a binary with a patched one to highlight the changes, helping to discover new, missing, and interesting functionality across versions.447448##### Benefits449450- **Single Source of Truth**: Without a CVE blog post or sample POC, a patch diff can be the only source of information to determine changes and deduce the original issue.451- **Vulnerability Discovery**: While understanding the original issue, you may discover additional vulnerabilities in the troubled code area.452- **Skill Development**: Patch diffing provides focused practice in reverse engineering and helps build mental models for various vulnerability classes.453454##### Challenges455456- **Asymmetry**: Small source code changes can drastically affect compiled binaries.457- **Finding Security-Related Changes**: Security patches often include other changes like new features, bug fixes, and performance improvements.458- **Minimizing Noise**:459 - Diff the correct binaries to avoid analyzing unrelated updates460 - Reduce the time delta between compared versions461 - Use binary symbols when available to add precision to comparisons462463#### Tools464465- IDA Pro with plugins like DarunGrim and Diaphora466- BinDiff Works with analysis output from IDA or Ghidra467- [Ghidriff](https://github.com/clearbluejar/ghidriff): Ghidra binary diffing engine468- Radare2 (radiff2)469- Ghidra Version Tracking Tool470- Ghidra 11 built-in Partial Match Correlator471472#### Patch Diffing Workflow473474The process of patch diffing typically follows these steps:4754761. **Preparation**477 - Create a diffing session478 - Load binary versions (vulnerable and patched)479 - Ensure binaries pass preconditions480 - Run auto-analysis on both binaries4814822. **Evaluation**483 - Run correlators to find similarities484 - Generate associations between binaries485 - Evaluate matches between functions486 - Accept matching functions487 - Analyze differences until sufficient understanding is reached4884893. **Function Analysis**490 - **Identify new functions**: Functions in the patched binary with no match in the original491 - **Identify deleted functions**: Functions in the original binary with no match in the patched version492 - **Identify changed functions**: Functions that exist in both versions but have been modified493 - Focus on functions with security relevance (often indicated by their names or based on CVE descriptions)4944954. **Interpreting Results**496 - New functions often indicate added security checks or validation497 - Changed functions may show modified logic for handling edge cases498 - Correlate changes with public CVE information when available499 - Remember that patches are not necessarily atomic - multiple issues may be fixed in one update500501When using Ghidra's Version Tracking:502503- Use "Show Only Unmatched Functions" filter to identify new or deleted functions504- Look for functions with a similarity score below 1.0 to find modified functions505- Examine the modified functions to understand what security checks were added506507Starting with Ghidra 11 (December 2024) a built-in _Partial Match Correlator_ covers most PatchDiffCorrelator use-cases; install the plugin only if you need bulk-mnemonics scoring.508509#### Case Study: 7‑Zip Symlink Path Traversal510511- Target: 7‑Zip 24.09 (vulnerable) → 25.00 (fixed)512- File of interest: `CPP/7zip/UI/Common/ArchiveExtractCallback.cpp`513- High‑signal edits: absolute‑path detection and link‑path validation for WSL/Linux symlinks converted on Windows.514515##### Minimal security‑relevant diff (simplified):516517```cpp518-bool IsSafePath(const UString &path)519+static bool IsSafePath(const UString &path, bool isWSL)520{521 CLinkLevelsInfo levelsInfo;522- levelsInfo.Parse(path);523+ levelsInfo.Parse(path, isWSL);524 return !levelsInfo.IsAbsolute525 && levelsInfo.LowLevel >= 0526 && levelsInfo.FinalLevel > 0;527}528529+bool IsSafePath(const UString &path);530+bool IsSafePath(const UString &path)531+{532+ return IsSafePath(path, false); // isWSL533+}534535-void CLinkLevelsInfo::Parse(const UString &path)536+void CLinkLevelsInfo::Parse(const UString &path, bool isWSL)537{538- IsAbsolute = NName::IsAbsolutePath(path);539+ IsAbsolute = isWSL ? IS_PATH_SEPAR(path[0]) : NName::IsAbsolutePath(path);540 LowLevel = 0;541 FinalLevel = 0;542}543```544545##### Root cause (logic):546547- Linux/WSL symlink data containing a Windows‑style path (e.g., `C:\...`) was treated as relative by the Linux absolute‑path check, setting `linkInfo.isRelative = true`.548- `SetFromLinkPath` prefixed the symlink’s zip‑internal directory when building `relatPath`, letting `IsSafePath(relatPath)` pass despite an absolute Windows target.549- A subsequent “dangerous link” guard checked `_item.IsDir`; non‑directory symlinks skipped the validation.550- Result: symlink creation to arbitrary absolute Windows paths; extracted files written into the link target.551552##### Practical triage checklist:553554- Search this file for: `IsSafePath`, `CLinkLevelsInfo::Parse`, `SetFromLinkPath`, `CloseReparseAndFile`, `FillLinkData`, `CLinkInfo::Parse`, `_ntOptions.SymLinks_AllowDangerous`.555- Verify absolute‑path detection across OS semantics (Linux vs Windows) and that relative/absolute status cannot be desynced by mixed‑style paths.556- Ensure “dangerous link” checks run for both files and directories; avoid `_item.IsDir` short‑circuiting validation for file symlinks.557- Confirm `IsSafePath` evaluates the final target path after concatenations; normalize before validation.558559##### Quick repro (Windows, developer mode or elevated):560561- Create zip structure:562 - `data/link` → symlink to `C:\Users\<USER>\Desktop`563 - `data/link\calc.exe` → payload file564- If `link` is extracted first, subsequent writes follow the symlink into the absolute target directory.565566#### Apple Patch Diffing567568- Identify a CVE of interest569- Download corresponding IPSW and update and N-1570 - use [ipsw.me](https://ipsw.me/) to download those files571 - convert the downloaded `.ipsw` to `.zip`572- Determine changes for update573 - you can use [IPSW tool](https://github.com/blacktop/ipsw) to download and diff574- Map binaries to CVE575- Extract the related file(s)576- Diff the binaries577 - In Ghidra set Decompiler Parameter ID to true578 - Leverage [IDAObjectTypes](https://github.com/PoomSmart/IDAObjcTypes)579- Root cause the vulnerability580581```bash582# Downloading the correct IPSWs583ipsw download --device Macmini9,1 -V -b 23A344584ipsw download --device Macmini9,1 -V -b 23B74585586# Comparing two different IPSWs587ipsw diff UniversalMac_14.0_23A344.ipsw UniversalMac_14.1_23B74.ipsw588589# What is inside the DSC590ipsw extract -d IPSW591592# Extracting files593ipsw extract -f -p file594595# Extracting specific architecture file596ipsw macho lipo Contacts597```598599#### Windows 11 Patch Diffing600601This checklist mirrors the Apple IPSW workflow but uses Microsoft tooling and build numbers.6026031. Identify the target update604 - Open **Settings → Windows Update → Update history** or consult the Windows Release Health dashboard to note the **KB** and **OS build** numbers (e.g., _KB5037778 → build 22631.3525_).605 - Record the previous build you want to diff against (e.g., _22631.3447_).6066072. Collect the binaries608609```bash610winbindex download tcpip.sys 10.0.22631.3447 10.0.22631.3525611612mkdir pre,post613wget -Uri https://www.catalog.update.microsoft.com/Download.aspx?q=KB5037778 -OutFile kb.msu614expand -F:* .\kb.msu .\post615# repeat for the older KB into .\pre616# Download both *UUP* bundles, then run617uup_download_windows.cmd --extract618# and copy changed PE files to *pre* / *post*619```6206213. Fetch matching symbols622623```powershell624# Requires Debugging Tools for Windows625foreach ($ver in '3447','3525') {626 symchk /r .\$ver /s SRV*https://msdl.microsoft.com/download/symbols627}628```6296304. Load in the disassembler631 - Open _tcpip.sys_ from both **pre** and **post** folders in **IDA 8+** or **Ghidra 11**; ensure PDB symbols resolve.632 - Save the IDA databases (e.g., `tcpip_3447.i64`, `tcpip_3525.i64`).6336345. Run the diff635 - **BinDiff 7**: _Tools → BinDiff → Diff Database…_ and select the two IDBs to generate a `.BinDiff` report.636 - **Ghidriff** (headless):637 ```bash638 ghidriff diff pre/tcpip.sys post/tcpip.sys -o tcpip.diff639 ```6406416. Triage the results642 - Sort by _Similarity %_ ascending; investigate anything below **95 %**.643 - Focus on functions with names like `Validate`, `Parse`, `Copy`, `Check`, or protocol‑specific handlers (`IppReceiveEsp`, `Ipv6pFragmentReassemble`, etc.).644 - Determine whether changes add bounds checks, size validations, or privilege checks.6456467. Validate in a lab VM647 - Snapshot two Windows 11 VMs (build **3447** and **3525**).648 - Attach WinDbg (kernel mode) using `bcdedit /dbgsettings net hostip:<IP> port:<PORT>`.649 - Reproduce the issue against the **pre‑patch** VM; confirm no crash or breakpoint triggers in the **post‑patch** VM.6506518. Automate monthly652 - Schedule a PowerShell script that, every Patch Tuesday (second Tuesday), downloads the latest Cumulative Update, extracts changed PE files, retrieves symbols, and launches a headless **Diaphora** diff.653 - Email the generated HTML report to quickly spot new attack surface.654655> [!TIP]656> For large modules like **ntoskrnl.exe**, diff only the `.text` section to save RAM: 657> bindiff --primary ntoskrnl_pre.i64 --secondary ntoskrnl_post.i64 --section .text658659#### Linux Kernel Patch Diffing660661Patch‑diffing Linux kernels is often faster at the source level, but for binary‑only targets (vendor kernels, modules) function‑level diffing is still practical.6626631. Identify target builds664 - Note distro and kernel build (e.g., Ubuntu `6.8.0-47-generic`, RHEL `5.14.0-503`).665 - Capture both pre and post versions (package changelogs or CVE bulletins help).6666672. Fetch kernel images and debug info668 - Ubuntu/Debian:669 ```bash670 # Discover versions671 apt list -a linux-image-generic | cat672 # Download image + modules dirs (repeat for both versions)673 apt-get download linux-image-unsigned-<ver>-generic linux-modules-<ver>-generic674 # Debug symbols via debuginfod (preferred to ddebs)675 export DEBUGINFOD_URLS="https://debuginfod.ubuntu.com https://debuginfod.debian.net"676 ```677 - Fedora/RHEL/CentOS:678 ```bash679 dnf download kernel-core-<ver> kernel-debuginfo-<ver>680 rpm2cpio kernel-core-<ver>.rpm | cpio -idmv681 rpm2cpio kernel-debuginfo-<ver>.rpm | cpio -idmv682 ```6836843. Extract `vmlinux`685686 ```bash687 # If only vmlinuz is present, use the upstream helper688 /usr/src/linux-headers-<ver>/scripts/extract-vmlinux /boot/vmlinuz-<ver> > vmlinux-<ver>689 # Or take vmlinux directly from debuginfo package tree690 ```6916924. Identify changed modules quickly693694 ```bash695 # Compare module trees (pre vs post)696 rsync -rcn --delete /lib/modules/<pre>/ /lib/modules/<post>/ | grep -E "\.ko$" | sed 's/^/chg: /'697 ```6986995. Function‑level binary diff700 - Open `vmlinux-<pre>` and `vmlinux-<post>` in Ghidra 11/IDA 8 and run Diaphora/BinDiff/Ghidriff.701 - For hot subsystems (e.g., `io_uring`, `net/ipv6`, `fs/overlayfs`), diff only the relevant `.ko` pairs to reduce noise.7027036. Source‑level triage (when sources are available)704705 ```bash706 # Ubuntu example: unpack both source trees, then707 git diff --no-index -- function.c.orig function.c.patched | less708 # Or use diffoscope for enriched reports709 ```7107117. Symbolization and crash mapping (cheat‑sheet)712713 ```bash714 # Decode kernel oops backtraces to lines715 ./scripts/decode_stacktrace.sh vmlinux /lib/modules/<ver>/build < dmesg.log716 # Map PC to file:line quickly717 addr2line -e vmlinux-<ver> 0xffffffff81234567718 ```719720> [!TIP]721> For modern distros built with Clang: KCFI and fine‑grained CFI thunks create many small stub changes; filter by real function body deltas to focus on security‑relevant logic.722723> [!NOTE]724> Syzkaller routinely bisects kernel bugs; consult syzbot reports for reproducers and fix commits, then confirm your diff isolates the same region before deeper RE.725726#### Kernel network parser identification heuristics (SMB2-inspired, broadly applicable)727728##### Cross-field invariants (length/offset/next)729730- Always validate `(offset + length) <= remaining_buffer` and `<= total_buffer` using a widened type (e.g., `u64`) before arithmetic; reject on overflow with `check_add_overflow()`/`array_size()` helpers.731- For chained entries with a `next` field, assert: `next >= sizeof(entry_header)`, `next <= remaining_buffer`, and that pointer advancement actually makes progress. For entries carrying sub-lengths (e.g., `name_len`, `value_len`), assert `header + name_len + value_len <= next`.732- Do not cast to a struct until the full header is present and aligned; gate recasts with a prior `buf_len` check.733734##### Fixed-size buffers vs variable-length payloads735736- Ban unbounded copies/crypto/decompression into fixed-size arrays. Require `len <= sizeof(array)` (or clamp with `min_t()` and bail) when writing into in-struct arrays.737- Crypto transforms are just writes with extra steps: if using ARC4/AES helpers that copy `len` bytes into a fixed buffer (e.g., session keys), bound `len` against a named maximum constant and prefer allocating a buffer sized from validated `len`.738739##### Type/width hazards740741- Normalize parser math to a wide unsigned type before comparisons; avoid truncating `u32/u64` fields into `u16` for size checks. Favor `size_t/u64` for `offset+len` arithmetic, then compare to `buf_len` of the same width.742743##### Loop structure around `next`744745- Pattern to flag: `e = (struct entry *)((char *)e + next);` without a preceding block that revalidates `buf_len` and the entry’s internal sub-lengths.746- Ensure a break condition on exhaustion and reject zero/negative progress values to avoid infinite loops or pointer stagnation.747748##### Allocation-size correlation749750- When parser-controlled `len` influences a subsequent write into an object from a fixed SLUB cache (e.g., `kmalloc-512`), ensure the write length is bounded by the destination object field, not just the incoming length.751752##### Patch-diff signals to prioritize753754- Newly added guards like `if (len > CONST) return -EINVAL;`, `if (buf_len < sizeof(struct foo)) return -EINVAL;`, or conversions to `min_t(size_t, len, sizeof(...))`.755- Insertions of `check_add_overflow(offset, len, &sum)` or `array_size(n, sz)` helpers in hot parse paths.756757##### Static query seeds (Semgrep/CodeQL), to tune per codebase758759- Unbounded copies into struct fields:760 ```yaml761 rules:762 - id: c-fixed-array-unbounded-copy763 languages: [c, cpp]764 patterns:765 - pattern: memcpy($DST, $SRC, $LEN)766 - pattern-inside: |767 struct $S { ... char $BUF[$N]; ... };768 ...769 $DST = &...->$BUF770 - pattern-not: memcpy($DST, $SRC, MIN($LEN, sizeof(*$DST)))771 message: Unbounded copy into fixed-size struct field772 severity: WARNING773 ```774- Dangerous `next`-driven pointer arithmetic without bounds checks:775 ```yaml776 - id: c-parser-next-missing-bounds777 languages: [c, cpp]778 pattern: |779 $E = (struct $T *)((char *)$E + $NEXT);780 message: Parser advances by user-controlled 'next' without prior buf_len/sizeof checks781 severity: WARNING782 ```783- Crypto/decompression writes to fixed arrays (seed with function names in your tree, e.g., `*_crypt`, `*_decrypt`, `decompress_*`).784785##### Dynamic confirmation (cheap)786787- Grammar fuzz small invariants: send `next < header`, `next > remaining`, `name_len + value_len > next`, and `len > MAX_CONST` variants; expect `-EINVAL`/reject. If not, investigate.788- Use TUN/TAP + KCOV to drive packet/SMB request paths; enable KASAN/KMSAN to surface overflows/leaks early.789790##### Reference (motivating example)791792- Lessons distilled from a 2025 ksmbd remote chain writeup combining a fixed-buffer overflow in NTLM auth with an EA `next` validation issue — see Will’s Root: Eternal‑Tux: KSMBD 0‑Click RCE (`https://www.willsroot.io/2025/09/ksmbd-0-click.html`).793794#### Case Study: EvilESP Vulnerability (CVE-2022-34718)795796This case study demonstrates real-world patch diffing to identify a Windows TCP/IP RCE vulnerability.797798##### Vulnerability Overview799800- CVE-2022-34718: Critical RCE in `tcpip.sys` discovered in September 2022801- An unauthenticated attacker could send specially crafted IPv6 packets to Windows nodes with IPsec enabled802- Affects the handling of ESP (Encapsulating Security Payload) packets in IPv6 fragmentation803804##### Patch Diffing Process8058061. **Binary Acquisition**807 - Used Winbindex to obtain sequential versions of `tcpip.sys` (pre-patch and post-patch)808 - Loaded both files in Ghidra with PDB symbols8098102. **Diff Analysis**811 - Used BinDiff to compare the binaries812 - Identified only two functions with less than 100% similarity: `IppReceiveEsp` and `Ipv6pReassembleDatagram`8138143. **Code Analysis**815 - **Ipv6pReassembleDatagram**: Added bounds check comparing `nextheader_offset` against the header buffer length816 - **IppReceiveEsp**: Added validation for the Next Header field of ESP packets8178184. **Root Cause Identification**819 - Found an out-of-bounds 1-byte write vulnerability820 - ESP Next Header field is located after the encrypted payload data821 - A malicious packet could cause `nextheader_offset` to exceed the allocated buffer size822823_(Update: Server 2022 build 20349.2300, May 2024, hardened this code path; the original PoC needs a 2-byte pad tweak to reproduce the crash.)_824825##### Exploitation826827- Required setting up IPsec security association on the victim828- Created fragmented IPv6 packets encapsulated in ESP829- Controlled the offset of the out-of-bounds write through payload and padding size830- Value written is controllable via the Next Header field831- Limited to writing to addresses that are 4n-1 aligned (where n is an integer)832- Initially achieved DoS with potential for RCE through further exploitation833834##### Lessons Learned835836- Binary patch diffing effectively identified the vulnerability location and nature837- Understanding protocol specifications (ESP and IPv6 fragmentation) was critical838- Simple buffer checks are still overlooked in complex networking code839- Even limited primitives (single byte overwrite at constrained offsets) can be dangerous840- For modern exploitation techniques, see [Modern Samples](/exploit/modern-samples.md)841- For mitigation bypass techniques, see [Modern Mitigations](/exploit/modern-mitigations.md)842843When applying patch diffing to networking protocols:8448451. Understand the protocol specifications thoroughly8462. Look for missing bounds checks in data processing8473. Pay attention to buffer size calculations8484. Check for proper validation of protocol field values and locations8495. Consider evasion techniques for exploit deployment - see [EDR](/exploit/edr.md)8506. Specs: ESP (RFC 4303) and IPv6 (RFC 8200) are essential references when reasoning about header placement and bounds851852#### Semi-Automatic Patch Diffing853854- Use [WinbIndex](https://winbindex.m417z.com/) to download the changed binary and then use [BinDiff](https://www.zynamics.com/bindiff.html) or [Ghidriff](https://github.com/clearbluejar/ghidriff) to actually see the diff itself855- You can also use [Diaphora](https://github.com/joxeankoret/diaphora) instead of BinDiff856857#### Manual Patch Diffing858859- Microsoft releases patches on the second Tuesday of each month860- For Windows you can go to [update catalog](https://www.catalog.update.microsoft.com/Search.aspx) and search for the product version (for example `2022-10 x64 "Windows 10" 22H2`)861- Try to look for smaller updates862863```shell864mkdir 2022-09865mv *.msu 2022-09866cd 2022-09867mkdir extract868mkdir patch869expand -F:* .\*.msu .\extract870expand -F:* .\extract\<largest>.cab .\patch871expand -F:* .\patch\<largest>.cab .\patch872expand -F:* .\patch\Cab_* .\patch\873```874875You can use [Patch Extract](https://gist.github.com/abzcoding/f6191c3aa9ca6d019f360b429d6b510f) instead876877```shell878gci -Recurse c:\windows\WinSxS\ -Filter ntdll.dll879# copy the biggest file somewhere880.\delta_patch.py -i .\NTDLL\ntdll.dll -o ntdll.2020-10.dll .\NTDLL\r\ntdll.dll .\2020-10\x64\ntdll_<stuff>\f\ntdll.dll881.\delta_patch.py -i .\NTDLL\ntdll.dll -o ntdll.2020-11.dll .\NTDLL\r\ntdll.dll .\2020-11\x64\ntdll_<stuff>\f\ntdll.dll882```883884Open unpatched version in IDA as the primary and the second, after that use BinDiff add-on to find the differences between them885then right click on a different matched function and see the visual diff in bin diff886also you can uncheck proximity browsing to see the entire function887look at red blocks and then yellow blocks888889With patch clean script you can only see the actual changed files890891### Static Analysis Tools892893#### IDA Pro and Rust Tools for Vulnerability Research894895- [rhabdomancer](https://github.com/0xdea/rhabdomancer): IDA Pro headless plugin that locates calls to potentially insecure API functions in binary files896 - Helps auditors backtrace from candidate points to find pathways allowing access from untrusted input897 - Generates JSON/SARIF reports containing vulnerable function calls and their details898 - Written in Rust using IDA Pro 9 idalib and Binarly's idalib Rust bindings899900- [haruspex](https://github.com/0xdea/haruspex): IDA Pro headless plugin that extracts pseudo-code generated by IDA Pro's decompiler901 - Exports pseudo-code in a format suitable for IDEs or static analysis tools like Semgrep/weggli902 - Creates individual files for each function with their pseudo-code903 - Can be used as a library by third-party crates904905- [augur](https://github.com/0xdea/augur): IDA Pro headless plugin that extracts strings and related pseudo-code from binary files906 - Stores pseudo-code of functions that reference strings in an organized directory tree907 - Helps trace how strings are used within the application908 - Complements other reverse engineering tools909910#### Modern Static Analysis Tools911912- **Semgrep Pro** – Cloud-augmented SAST with custom rule sharing, LLM-assisted rule writing913- **CodeQL** – GitHub's semantic code analysis, excellent for variant analysis914- **Weggli** – Fast semantic search for C/C++ (better than grep for code patterns)915- **Joern** – Code property graph analysis for vulnerability discovery916- **Ghidra 11.2+** – Built-in ML-powered function signature recognition917- **Binary Ninja 4.0** – Cloud collaboration, improved HLIL decompilation918919920…(truncated)