Recovering injected code and shellcode

From meltedinhex/analyst-ai-pack · View interactive version

Recovering injected code and shellcode is an AI agent skill from the GitHub repository meltedinhex/analyst-ai-pack. Carves 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.

How to use this skill

Skill file

Recovering Injected Code and Shellcode

When to Use

payload — an injected PE or raw shellcode.

Do not use this to execute the payload — it prepares code for static disassembly/emulation in

a controlled tool, not for running.

Prerequisites

Safety & Handling

Workflow

Step 1: Identify payload type

python scripts/analyst.py identify region.bin

Detects an embedded MZ/PE (with offset) versus raw shellcode, and reports the PE's architecture

if present.

Step 2: Locate shellcode entry hints

Finds common position-independent code markers: GetPC stubs (call $+5/fldz/fnstenv), PEB

access (fs:[30]/gs:[60]), and API-hashing loops.

Step 3: Extract for analysis

Carve the PE at its offset (or keep the raw shellcode) and hand it to a disassembler/emulator at

the detected base/entry.

Step 4: Document

Record offsets, architecture, and entry hints for the downstream RE workflow.

Validation

Pitfalls

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.