meltedinhex/analyst-ai-pack / skills/recovering-injected-code-and-shellcode
recovering-injected-code-and-shellcode
VerifiedCarves injected PE images and position-independent shellcode from a memory dump or carved region, identifies the payload type, and prepares it for disassembly or emulation. Activates for requests to recover injected code, carve shellcode from memory, or reconstruct a dumped payload for analysis.
| File | Kind | Size |
|---|---|---|
| LICENSE | other | 340 B |
| SKILL.md | skill md | 2.8 KB |
| references/api-reference.md | markdown | 1.2 KB |
| scripts/analyst.py | script | 2.3 KB |
references/api-reference.md
View on GitHub# API Reference: Recovering Injected Code and Shellcode
## Overview
`scripts/analyst.py` triages a carved memory region: it locates embedded MZ/PE headers (validating
`e_lfanew` → `PE\0\0` and reading the Machine field) and scans for position-independent code
markers. It reads bytes statically and executes nothing.
## Dependencies
| Package | Version | Purpose |
|---------|---------|---------|
| (stdlib) | — | struct, JSON, file IO |
## Core functions
### `identify(path)`
Returns embedded PE offsets/architecture, shellcode hint flags, and whether the region is likely
raw shellcode.
### `_pe_at(data, off)`
Validates an MZ/PE header at an offset and returns its architecture.
## PIC markers detected
- GetPC stubs (`call $+5`, `fnstenv`)
- PEB access (`fs:[30]` x86, `gs:[60]` x64)
- API-hashing loops (`lodsb` + `ror 13`)
## Usage
```bash
python scripts/analyst.py identify region.bin
```
## Sources
- MITRE ATT&CK T1620 Reflective Code Loading — https://attack.mitre.org/techniques/T1620/
- MITRE ATT&CK T1055 Process Injection — https://attack.mitre.org/techniques/T1055/
- PE/COFF specification (e_lfanew, Machine values); ror13 API-hash pattern from public shellcode research
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |