/secskills-defense:analyzing-shellcodefrom secskills-defense
Analyzes raw shellcode by extracting bytes, guessing architecture, disassembling, decoding stubs, resolving hashed Windows APIs, and pulling C2 IOCs.
Ships in secskills-defense. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Shellcode is code with no container — no PE/ELF header, no imports table, no fixed load address — so it must find everything it needs at runtime. That self-reliance is exactly what gives it away: the PEB walk, the API hashing, the position-independent GetPC trick are structural fingerprints you can read even before you know what the payload does.
\x-escaped, 0x-prefixed, base64, or XOR-obfuscated byte bufferanalyzing-binaries for the loader-backed disassembly workflowanalyzing-malware;
come here only for the raw payload stage inside itunpacking-protected-binaries to unwrap it firstanalyzing-memory-images to locate and extract the region, then return herereverse-engineering is not a
skill; route sustained disassembly work back to analyzing-binariesShellcode arrives wrapped. Normalize it to a flat binary before anything else.
# \x-escaped or 0x C-array pasted from an exploit → raw bytes
python3 -c "import sys,re; d=open('sc.txt').read(); \
b=bytes(int(x,16) for x in re.findall(r'(?:0x|\\\\x)([0-9a-fA-F]{2})',d)); \
open('sc.bin','wb').write(b); sys.stderr.write(f'{len(b)} bytes\n')"
# base64 buffer
base64 -d payload.b64 > sc.bin
# single-byte XOR brute (find the key that yields printable / low entropy)
python3 -c "import sys; d=open('sc.bin','rb').read(); \
[print(k, bytes(c^k for c in d[:16]).hex()) for k in range(256)]"
Then sniff what you have before disassembling:
file sc.bin && wc -c < sc.bin # size: stagers ~200-800B, stages tens of KB
ent sc.bin 2>/dev/null || binwalk -E sc.bin # high entropy → encoded/self-decoder
For document- and capture-borne shellcode, extract first: olevba --deobf
for Office macros (analyzing-malware covers this), and carve from PCAP with
tshark -r c.pcap --export-objects http,out/ or a tcp.stream follow, then
treat the bytes as above.
xxd sc.bin | head -40
Read the head for structure, not meaning:
55 8B EC prologues, 64 A1 30 00 /
64 8B (fs:[0x30]) PEB access, and E8 00000000 5x call/pop. x64 shows
65 48 8B (gs:[0x60]), REX-prefixed 48 ..., and RSP alignment 48 83 EC.
ARM/AArch64 is uniform 4-byte words with no x86 prologue signature.E8 00 00 00 00 58/59/5A/5B/5E (call $+5 then pop) or the
fnstenv / D9 EE D9 74 24 F4 5B FPU trick recovers EIP for
position-independence. Its presence means the code relocates itself and a
decoder often follows.w00tw00t (77 30 30 74
×2) is an egg-hunter searching memory for the real payload.00 bytes, or all-printable bytes, means
an encoder stub (Metasploit alpha_mixed, shikata_ga_nai) wraps the real
code — you are looking at the decoder, not the payload.The single most common mistake is disassembling at the wrong architecture or mid-instruction. Try both widths and read which one produces a sane prologue.
# objdump on a raw blob — set the arch explicitly, Intel syntax
objdump -D -b binary -m i386 -M intel sc.bin # 32-bit
objdump -D -b binary -m i386:x86-64 -M intel sc.bin # 64-bit
# ndisasm — quick, and -e skips a leading offset if the entry is not at 0
ndisasm -b 32 sc.bin
ndisasm -b 64 sc.bin
# rizin / radare2: assemble/disassemble a blob directly
rasm2 -a x86 -b 32 -d "$(xxd -p sc.bin | tr -d '\n')"
r2 -a x86 -b 32 -m 0x400000 sc.bin # load raw at a base
# e asm.arch=x86 ; e asm.bits=32 ; s 0 ; pd 60 disassemble entry
# pdf @ 0 treat entry as a function
To load raw shellcode in Ghidra/IDA/Cutter: import as a raw binary, set the processor (x86:LE:32 or x86:LE:64), pick a base address, and define an entry point / disassemble at the true first instruction — not offset 0 if a length prefix or junk sled precedes it. Without a defined entry the auto-analyzer will disassemble data as code and the listing is noise.
Encoded shellcode is a small decoder stub followed by an encrypted body. Do not try to read the body statically — disassemble only the stub, then let it run.
xor/add/sub/rol against a
running pointer, a length counter, and a key or key schedule. The loop's tail
jumps back until the counter hits zero, then falls through into the decoded
body.# scdbg dumps the decoded buffer and unpacks the second stage for x86 Windows
scdbg -f sc.bin -s -1 # -s -1 lifts the step limit (default 2M)
scdbg -f sc.bin -d # dump self-modified/decoded memory
Shellcode has no imports, so it walks the loaded-module list and resolves APIs by a hash of their names. Recognizing this is often the whole analysis.
fs:[0x30] (x86) or gs:[0x60] (x64) loads the PEB, then
PEB->Ldr->InMemoryOrderModuleList is traversed to find kernel32.dll (or
ntdll.dll) without a hardcoded address.ror13 additive (the classic Metasploit block_api) or djb2 — and compares
against a 4-byte constant. The constant is the API name, once you invert it.# Reproduce Metasploit block_api ror13 — the constant is hash(module)+hash(name)
python3 - <<'PY'
def ror13(b):
h=0
for c in b:
h=((h>>13)|(h<<19))&0xffffffff; h=(h+c)&0xffffffff
return h
mod=ror13("KERNEL32.DLL\0".encode('utf-16le')) # module: UTF-16LE, uppercased
for api in ("LoadLibraryA","GetProcAddress","WinExec","VirtualAlloc"):
print(hex((ror13((api+"\0").encode('ascii'))+mod)&0xffffffff), api)
PY
Tools: scdbg prints resolved API calls with arguments as it emulates;
jmp2it/blob_runner under a debugger let you break at the resolver; export
tables come from dllexp or rabin2 -E kernel32.dll. When the hash algorithm
is custom, lift it into the Python harness and brute the export lists.
For Windows x86 shellcode, emulation resolves the APIs, decodes the stages, and prints the behavior in seconds — reach for it before manual tracing.
# scdbg — emulates x86 Windows shellcode, reports API calls, C2, and stages
scdbg -f sc.bin # default trace of resolved API calls
scdbg -f sc.bin /findsc # brute-force the correct start offset
scdbg -f sc.bin -foff 0x1a # force entry at a known offset
# speakeasy — emulate x86/x64 shellcode or a raw module
speakeasy -t sc.bin --raw --arch x86 # --raw shellcode, --arch x86|amd64
speakeasy -t sc.bin --raw --arch amd64 -o report.json
For custom logic or non-Windows targets, build a harness:
code/mem events, run,
and read the decoded region back. Best when you need to script the decode.VirtualAlloc/WinExec behave, with a rootfs and syscall interception.blob_runner, shellcode2exe, or jmp2it wrap the
blob into a loadable stub; open it in x32dbg/x64dbg, set EIP/RIP to the
entry, and single-step through the decoder to the live stage.reverse_tcp builds a socket then recvs a second
stage into RWX memory and jumps to it; reverse_https uses WinInet
(InternetOpen/HttpOpenRequest). scdbg/speakeasy surface the connect
address and port directly.analyzing-malware.call4_dword_xor, alpha_mixed,
and the block_api resolver have recognizable shapes; matching one names the
toolkit and tells you what the following bytes must be.Emulation is safe; actually running the shellcode is detonation. Apply the same
containment analyzing-malware requires.
Collect the durable indicators as you decode: C2 host/IP, port, request URI and
user-agent, mutex names, the decoder key or hash constants, and the egg tag.
Rank them as analyzing-malware does — behavior and config outlive rotating
hosts.
Then route the work:
writing-yara-rules
(author the rule), then engineering-detections (deploy it)analyzing-malwareanalyzing-binariesreporting-security-findings/findsc or read for the true
first instruction.Generated from secskills-core/ttp-index.json — edit that file, then run
python3 scripts/sync_attack.py --write. Re-verify IDs against the
current ATT&CK release before citing them in a report.
Defense Evasion (TA0005)
analyzing-malware, analyzing-binariesanalyzing-malware, analyzing-binariesanalyzing-malwareDetection content for any of these: engineering-detections. Proactive search: hunting-threats. Post-compromise: responding-to-incidents.
analyzing-binaries — disassembler workflow for the decoded stageanalyzing-malware — sample triage, containment, family ID, and the dropped stageanalyzing-memory-images — carving shellcode out of a memory dump firstwriting-yara-rules — authoring a durable signature for the decoder or decoded stageengineering-detections — turning a decoder/resolver signature into deployed rulesreporting-security-findings — writing up the analysisrasm2/pd), Cutter for static disassembly of raw blobsWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub gztes/security-for-platforms --plugin trilwu-secskills-defense22 skills in this plugin
/analyzing-disk-imagesPerform dead-disk forensics on an acquired disk image using The Sleuth Kit, Plaso, and bulk_extractor — verify integrity and mount read-only, map partitions, recover deleted files, build a file-system and super-timeline, carve unallocated space, mine registry hives and OS artifacts, and detect anti-forensics. Use when handed a .E01/.dd/.raw/.vmdk/.vhdx disk image or forensic acquisition to examine, recovering deleted files, building a file-system timeline, or carving artifacts from unallocated space./analyzing-linux-persistenceSystematically identify and analyze persistence mechanisms on Linux systems during DFIR investigations -- sweep systemd units, cron jobs, shell initialization, SSH config, kernel modules, LD_PRELOAD, package manager hooks, udev rules, container entrypoints, and XDG autostart entries. Use when investigating a compromised Linux host, performing forensic analysis of a Linux disk image, looking for backdoors or unauthorized access mechanisms, or determining how an attacker maintained access./analyzing-malwareAnalyze suspected malware safely — containment, static triage, sandboxed detonation, unpacking, capability and C2 extraction, IOC production, and YARA rule authoring. Use when handed a suspicious file, hash, or sample, when triaging an alert artifact, or when producing detection content from a specimen./analyzing-memory-imagesAnalyze volatile memory images (RAM dumps) using Volatility 3 — process enumeration, injected code detection, credential extraction, network artifacts, rootkit analysis, and timeline construction from memory-resident data. Use when examining a memory capture from a compromised host, hunting for injected code or hollowed processes, extracting credentials or network state from RAM, or detecting kernel-level rootkits./analyzing-network-trafficAnalyze packet captures and network telemetry for intrusion evidence — capture and handling, the Wireshark/tshark triage funnel, Zeek log mining, Suricata rule runs, beacon and DNS-tunnel detection, TLS/JA3 fingerprinting, HTTP and file carving, exfiltration hunting, and IOC handoff. Use when a `.pcap` or `.pcapng` capture lands on your desk, when a suspected C2 beacon needs confirming, when there is data exfiltration to investigate, when malware network behaviour must be characterized from what it emitted, when a Zeek or Suricata alert needs running down, or when DNS tunneling or unusual TLS is suspected./analyzing-phishing-emailsTriage and forensically analyze reported phishing safely — extract the raw message, read the Received chain, verify SPF/DKIM/DMARC, detect display-name and lookalike spoofing, unwrap redirects and SafeLinks/URLDefense, decode quishing QR codes, triage attachments, and pull IOCs for hunting. Use when handed a reported phishing email, a suspicious .eml or .msg file, a set of email headers to analyze, a malicious attachment or link to triage, or a business email compromise or spoofing case.2 plugins ship this exact skill · first indexed Jul 31, 2026
Other plugins' skills for the same job