본문으로 건너뛰기
Skillpedia
보안10k · #11960

offensive-shellcode

하는 일

이 스킬은 x86과 x64 시스템용 저수준 셸코드 작성을 위한 참고 자료입니다. 위치 독립 코드와 로더를 다룹니다. 승인된 프로젝트에서 작업하는 보안 연구자와 익스플로잇 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓x86이나 x64 시스템에서 승인된 익스플로잇 개발 연구를 할 때.
  • ✓보안 연구 프로젝트를 위해 위치 독립 코드를 이해해야 할 때.
  • ✓방어적 분석을 위해 로더와 단계식 페이로드가 어떻게 작동하는지 연구할 때.

스킬 링크

https://github.com/SnailSploit/Claude-Red/blob/main/Skills/infrastructure/offensive-shellcode/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/SnailSploit/Claude-Red/blob/main/Skills/infrastructure/offensive-shellcode/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“승인된 보안 연구실에서 x64 Windows의 위치 독립 코드를 설명해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

이 스킬은 대상 플랫폼을 정하는 것부터 통제된 환경에서 위치 독립 어셈블리를 작성하고 테스트하는 작업 흐름을 설명합니다. Windows의 기본 메모리 처리 개념도 다룹니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Shellcode Development Workflow

  1. Define concept and target platform (x86/x64, Windows/Linux/macOS)
  2. Write assembly using position-independent techniques
  3. Extract binary and test in controlled environment
  4. Apply null byte avoidance and optimizations
  5. Encode/encrypt to evade static detection
  6. Package with loader and choose delivery method

Basic Concepts

Execution Pattern (Allocate-Write-Execute)

Avoid direct PAGE_EXECUTE_READWRITE — prefer:

  1. Allocate with PAGE_READWRITE
  2. Write shellcode to allocated region
  3. Call VirtualProtect to switch to PAGE_EXECUTE_READ
char *dest = VirtualAlloc(NULL, 0x1234, MEM_COMMIT|MEM_RESERVE, PAGE_READWRITE);
memcpy(dest, shellcode, 0x1234);
VirtualProtect(dest, 0x1234, PAGE_EXECUTE_READ, &old);
((void(*)())dest)();

Position-Independent Code (PIC) Techniques

Method Platform Notes
Call/Pop Windows Push next addr, pop into register
FPU state Windows fstenv saves instruction pointer
SEH Windows Exception handler stores EIP
GOT Linux Global Offset Table
VDSO Linux Kernel-provided shared object

Windows API Resolution (PEB Walk)

Identifying kernel32.dll without imports:

  1. Get PEB via gs:[0x60] (x64) or fs:[0x30] (x86)
  2. Walk PEB->Ldr.InMemoryOrderModuleList — order: exe → ntdll → kernel32
  3. Hash-compare module names to locate kernel32
  4. Parse the Export Address Table (EAT)
  5. Find GetProcAddress by name hash, then resolve LoadLibraryA
  6. Use LoadLibraryA to load WS2_32.dll, resolve Winsock functions

WinDbg helpers for debugging PEB walk:

dt nt!_TEB -y ProcessEnvironmentBlock @$teb
dt nt!_PEB -y Ldr <peb_addr>
dt -r _PEB_LDR_DATA <ldr_addr>
dt _LDR_DATA_TABLE_ENTRY (<init_flink_addr> - 0x10)
lm m kernel32   # verify base address
r @r8           # check register

Shellcode Loaders

Loader Responsibilities

  • Environment verification / keying (sandbox detection)
  • Shellcode decryption
  • Safe memory allocation and injection
  • Ends its duties after injecting

Recommended languages: Zig (small, no runtime), Rust (secure), Nim, Go (watch for runtime signatures)

Allocation Phase

Avoid RWX allocations — use two-step:

  • VirtualAllocEx / NtAllocateVirtualMemory — allocate RW
  • ZwCreateSection + NtMapViewOfSection — alternative approach
  • After writing: VirtualProtectEx to switch to RX

Other options: code caves, stack/heap (with DEP disabled)

Write Phase

  • WriteProcessMemory / NtWriteVirtualMemory
  • memcpy to mapped section

Evasion tips:

  • Prepend shellcode with dummy opcodes
  • Split into chunks, write in randomized order
  • Add delays between writes

Execute Phase

Most scrutinized step — EDR checks thread start address against image-backed memory:

Technique Notes
CreateRemoteThread / ZwCreateThreadEx Loud, heavily monitored
NtSetContextThread Hijack suspended thread
NtQueueApcThreadEx APC injection
API trampolines Overwrite function prologue
ThreadlessInject No new threads created

Indirect execution resources:


PE-to-Shellcode Conversion

Tool Purpose
Donut EXE/DLL → shellcode
sRDI DLL → position-independent shellcode
Pe2shc PE → shellcode
Amber Reflective PE packer

Open-source loaders:

  • ScareCrow
  • NimPackt-v1
  • NullGate — indirect syscalls + junk-write sequencing
  • DripLoader — chunked RW writes + direct syscalls + JMP trampoline
  • ProtectMyTooling — chain multiple protections
  • Direct-syscall helpers: SysWhispers3, FreshyCalls (now baseline requirements)

Shellcode Storage & Hiding

Location Risk Notes
Hardcoded in .text Medium Requires recompile; stored RW/RO
PE Resources (RCDATA) High Most sc
자주 묻는 질문

어떤 플랫폼을 다루나요?

x86과 x64에서 Windows, Linux, macOS를 다룹니다.

연구실에서만 쓰나요?

스킬은 승인을 받고 통제된 환경에서 테스트하는 것을 전제로 합니다.

파일 변환도 다루나요?

네. 연구를 위해 PE 파일을 셸코드로 변환하는 것도 다룹니다.

상세 정보

작성자의 원본 설명

Shellcode development reference for offensive security engagements. Use when writing custom x86/x64 shellcode, implementing position-independent code (PIC), building shellcode loaders, evading AV/EDR detection, or converting PE files to shellcode. Covers null byte avoidance, API hashing, encoder/decoder patterns, staged vs stageless payloads, Windows PEB traversal, and cross-platform shellcode techniques.

repo: SnailSploit/Claude-Red

인기도

GitHub 스타
10k
순위
#11960
라이선스
MIT
업데이트
2026. 10. 12.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬