offensive-mitigations
Offensive-mitigations is a reference catalog documenting modern kernel exploit mitigations including ASLR, DEP/NX, RELRO, stack canaries, CFI, sandboxing, and seccomp, paired with known bypass techniques. Security researchers and penetration testers use this skill when assessing target system hardening levels or developing exploit strategies that circumvent specific mitigation controls.
git clone --depth 1 https://github.com/SnailSploit/Claude-Red /tmp/offensive-mitigations && cp -r /tmp/offensive-mitigations/Skills/exploit-dev/offensive-mitigations ~/.claude/skills/offensive-mitigationsSKILL.md
# SKILL: Modern Kernel Exploit Mitigations ## Metadata - **Skill Name**: security-mitigations - **Folder**: offensive-mitigations - **Source**: https://github.com/SnailSploit/offensive-checklist/blob/main/mitigations.md ## Description Security mitigation reference and bypass catalog: ASLR, DEP/NX, RELRO, stack canaries, CFI, sandboxing, seccomp. Covers both detection of enabled mitigations and known bypass techniques. Use when assessing target hardening or planning exploit mitigation bypasses. ## Trigger Phrases Use this skill when the conversation involves any of: `mitigations, ASLR bypass, DEP bypass, NX bypass, RELRO, stack canary bypass, CFI bypass, sandbox bypass, seccomp bypass, mitigation detection, checksec` ## Instructions for Claude When this skill is active: 1. Load and apply the full methodology below as your operational checklist 2. Follow steps in order unless the user specifies otherwise 3. For each technique, consider applicability to the current target/context 4. Track which checklist items have been completed 5. Suggest next steps based on findings --- ## Full Methodology # Modern Kernel Exploit Mitigations ## Memory-safety & Isolation ### Kernel Address Space Layout Randomization (KASLR) - Randomizes memory addresses where the kernel and its components are loaded. - Makes it difficult for attackers to predict kernel code and data locations. #### Bypass Techniques - **Information Leaks:** Exploiting vulnerabilities (e.g., uninitialized memory, side-channels) to leak kernel pointers and calculate the base address. - **Side-Channel Attacks:** Using timing, cache, or other microarchitectural side channels to infer memory layout. - **Prefetch Cache Timing:** Measures access speed across the kASLR range (0xfffff80000000000 to 0xfffff80800000000, ~0x8000 iterations with 0x100000 alignment). The fastest access indicates a cached address, revealing the actual kernel base. Uses `rdtscp` for timing, `mfence` for memory barriers, and `prefetchnta`/`prefetcht2` for cache manipulation. - **Targeting Non-Randomized Regions:** Exploiting data or code segments that are not fully randomized. - **Brute-Force:** Feasible in environments with limited entropy (e.g., some 32-bit systems or specific configurations). - **Intel LAM:** Linear Address Masking support exists on recent kernels/CPUs but may be disabled by default. Verify with kernel config, boot params, and CPU flags on your target. ### Kernel Page Table Isolation (KPTI) - Linux: - Separates user-space and kernel-space page tables. - Mitigates the Meltdown vulnerability by preventing user-space access to kernel memory. #### Bypass Techniques - **Side-Channel Attacks:** Exploiting microarchitectural side channels (e.g., TLB timing, cache attacks) that leak information across the isolation boundary. - **Hardware Vulnerabilities:** Exploiting CPU vulnerabilities (e.g., L1TF, MDS) that can bypass page table separation. - **Implementation Flaws:** Bugs in the KPTI implementation itself. #### Practitioner - Linux: check status via `/sys/devices/system/cpu/vulnerabilities/*` and `dmesg | grep -i kpti`. - Windows: verify meltdown/KVA shadowing with `Get-SpeculationControlSettings` PowerShell script from Microsoft. ### Supervisor Mode Access Prevention (SMAP) - Linux: - Hardware feature preventing unintended kernel access to user-space memory. - Protects against attacks exploiting improper memory accesses. #### Bypass Techniques - **ROP/JOP Gadgets:** Finding instruction sequences (gadgets) within kernel code that disable SMAP temporarily (e.g., via `stac` instruction) before accessing user memory. - **Data-Only Attacks:** Attacks that achieve their goal without directly accessing user-space data from the kernel inappropriately. - **Kernel Information Leaks:** Combining with KASLR bypasses to find suitable gadgets. #### Practitioner - Linux: confirm with `grep smap /proc/cpuinfo` and `cat /proc/cpuinfo | grep 'smep\|smap'`. - Check CR4 at runtime with `rdmsr`/`wrmsr` tools or `lscpu -e` on supported systems. ### Supervisor Mode Execution Protection (SMEP) - Linux/Windows: - Hardware feature preventing execution of user-space code when in supervisor mode. - Located in bit 20 of the CR4 control register. - Blocks certain privilege escalation attacks that rely on executing shellcode in user-mode memory. #### Bypass Techniques - **ROP/JOP Chains:** Constructing code reuse chains entirely from existing kernel code, avoiding execution of user-space code. - **Data-Only Attacks:** Exploiting vulnerabilities without needing to execute shellcode (e.g., overwriting kernel data structures). - **Disabling SMEP:** Finding gadgets or techniques to modify the CR4 control register to disable SMEP. - **Type Confusion Exploits:** Using type confusion vulnerabilities to gain control flow and build ROP chains for SMEP bypass. - **Page Table Manipulation:** Modifying page table entries (PTEs) to change user pages to supervisor pages, making user-space code executable in kernel context. - **Write-What-Where Primitives:** Using arbitrary write vulnerabilities to modify CR4 register or page table structures. #### Practitioner - Linux: `grep smep /proc/cpuinfo`; verify effective state via `dmesg | grep -i smep`. - Windows: SMEP is enforced when Memory Integrity/HVCI is enabled on modern systems. ### Kernel Data Protection (KDP) - Windows: - Marks certain kernel memory regions as read-only. - Prevents unauthorized modification of critical kernel data structures. #### Practitioner - Check with `Get-CimInstance -ClassName Win32_DeviceGuard` and `System Information → Device Guard properties` for KDP/HVCI/VBS. ### Memory Integrity (Core Isolation) - Windows: - Uses virtualization and HVCI to prevent malicious code alteration. - Guards against code injection or execution in kernel mode. #### Practitioner - Enable/verify: Windows Security → Device Security → Core isolation details. - PowerShell: `Get-ItemPropert
Active Directory attack methodology for internal network red team engagements. Covers reconnaissance (BloodHound, PowerView, ADExplorer), credential abuse (Kerberoasting, ASREProasting, NTLM relay, LLMNR/NBT-NS poisoning), privilege escalation (ACL abuse, GPO abuse, unconstrained/constrained delegation), lateral movement (Pass-the-Hash, Pass-the-Ticket, Overpass-the-Hash, WMI/WinRM/PsExec), persistence (Golden/Silver/Diamond Tickets, DCSync, DCShadow, AdminSDHolder, Skeleton Key), forest trust attacks, ADCS abuse (ESC1-ESC15), and modern MDI/Defender for Identity evasion. Use when assessing on-prem AD, hybrid AD/Entra ID environments, or ADCS deployments.
JWT attack methodology for penetration testers. Covers algorithm confusion (alg:none, RS256→HS256), weak HMAC secret brute force, kid parameter injection (SQLi, path traversal), jku/x5u/jwk header injection, JWKS cache poisoning, JWS/JWE confusion, timing attacks, and mobile JWT storage extraction. Use when testing JWT-based authentication, hunting auth bypass via token manipulation, or evaluating JWT implementation security in web or mobile apps.
Cloud security attack methodology covering AWS, Azure, and GCP. Includes credential harvesting (IMDS, ~/.aws, env vars, leaked CI secrets, instance roles), enumeration with cloud-specific tools (pacu, ScoutSuite, Prowler, ROADtools, gcp_enum), privilege escalation paths (IAM PassRole, AssumeRole chains, Lambda/Functions privilege flips, Azure Owner-on-self, GCP serviceAccountTokenCreator), persistence techniques (IAM user/key creation, AAD app registration, GCP svc account key creation, EventBridge/Logic Apps backdoors), data exfiltration (S3/Blob/GCS, snapshot share, RDS/CosmosDB/Cloud SQL exfil), cloud-native lateral movement (cross-account assume, Azure AD multi-tenant, GCP project hierarchy), serverless attacks (Lambda env vars, layer hijack, Step Functions), Kubernetes-on-cloud (EKS/AKS/GKE-specific paths to node and AWS metadata), and CSPM evasion (CloudTrail blind spots, GuardDuty mute, Sentinel rule shaping). Use when the engagement scope is cloud accounts, when you've stolen cloud credentials, or when assessing cloud posture.