
Sickle - 페이로드 개발 키트

Sickle은 원래 셸코드 개발과 이해를 보다 효과적으로 하기 위해 제가 직접 개발한 도구입니다. 그러나 개발 및 사용 과정을 거치면서 이 도구는 페이로드 개발 키트로 진화했습니다. 현재 모듈은 대부분 어셈블리를 대상으로 하지만, 이 도구는 셸코드에만 국한되지 않습니다.
현재 Sickle은 다음을 지원할 수 있습니다.
Sickle은 Keystone Engine을 통해 셸코드 생성을 지원합니다. 이 기능은 새로 추가된 기능이므로 페이로드 지원이 제한적입니다. 그러나 각 아키텍처와 플랫폼에 대한 기본 리버스 셸을 추가하는 것이 목표입니다.

Sickle에는 원래 셸코드 스텁 분석을 위해 설계된 “디핑(diffing)” 모듈이 포함되어 있습니다. 원래의 “asm” 모드는 어셈블리 언어 수준과 오퍼코드 수준에서 선형 디스어셈블리 차이를 각각 별도로 수행합니다.

또한 Sickle은 디핑을 수행할 수 있는 다양한 모드를 제공하므로 셸코드 개발 이외의 용도로도 유용합니다.

자주 수행하는 일반적인 작업 중 하나는 셸코드를 테스트하는 것입니다. 이 과정은 일반적으로 다음 단계로 이루어집니다:
이러한 단계는 사소해 보일 수 있지만, 반복해서 수행하면 시간이 많이 소요될 수 있습니다. Sickle은 빠른 테스트를 위해 셸코드를 자동으로 래핑하여 이 과정을 단순화하며, “run” 모듈은 현재 Windows와 Unix 시스템을 모두 지원합니다.

Sickle은 바이너리 파일을 추출된 오퍼코드(셸코드)로 변환한 다음, 이를 기계어 명령어(어셈블리)로 변환할 수도 있습니다. 이 과정은 원시 바이너리 파일에서만 작동하며, 현재 Capstone을 통해 선형 방식으로 디스어셈블리를 수행합니다.

위 예시에서 “disassemble” 모듈은 Stephen Fewer가 설계한 리버스 셸을 디스어셈블리하여 어셈블리 코드로 변환합니다.
셸코드 추출은 Sickle의 첫 번째 모듈이자 더 정확히는 핵심 기능이었습니다. 오퍼코드는 사용되는 래퍼에 따라 다르게 해석되기 때문입니다. 예를 들어 JavaScript는 C 프로그램과 동일한 방식으로 셸코드를 저장하고 해석하지 않습니다.

아마도 이 기능에 가장 큰 영감을 준 것은 msfvenom이었을 것입니다.
64비트 익스플로잇에서는 덜 일반적이지만, 익스플로잇이 특정 문자 사용을 제한하는 경우가 있을 수 있습니다. 이때 “pinpoint” 모듈이 탁월한 성능을 발휘합니다. 이 모듈은 식별된 배드 캐릭터를 유발하는 어셈블리 명령어를 직접 식별하여 강조 표시하기 때문입니다.

원래 이 도구는 단일 대형 스크립트로 시작되었습니다. 그러나 도구가 발전함에 따라 업데이트할 때마다 코드를 다시 익혀야 했습니다. 이 문제를 해결하기 위해 Sickle은 이제 모듈식 접근 방식을 따르며, 도구 설계를 다시 익히는 데 드는 시간을 최소화하면서 새로운 기능을 추가할 수 있습니다.
$ sickle-pdk -l
Shellcode Ring Description
--------- ---- -----------
windows/x64/virtualalloc_exec_tcp 3 A lightweight stager that connects to a handler via TCP over IPv4 to receive and execute shellcode
windows/x64/egghunter 3 Egghunter based on Hell's Gate and NtProtectVirtualMemory
windows/x64/virtualalloc_exec_https 3 A lightweight stager that connects to a handler over HTTPS to receive and execute shellcode
windows/x64/exec 3 Executes a command on the target host
windows/x64/reflective_pe_loader 3 Stageless Reflective PE Loader that takes an x64 binary and executes it in memory
windows/x64/shell_reverse_tcp 3 Reverse Shell via TCP over IPv4 that provides an interactive cmd.exe session
windows/aarch64/shell_reverse_tcp 3 Reverse Shell via TCP over IPv4 that provides an interactive cmd.exe session
windows/x86/shell_reverse_tcp 3 Reverse shell via TCP over IPv4 that provides an interactive cmd.exe session
windows/x64/kernel_token_stealer 0 Token stealing shellcode for privilege escalation
windows/x64/kernel_sysret 0 Generic method of returning from kernel space to user space
windows/x64/kernel_ace_edit 0 SID entry modifier for process injection
windows/x86/kernel_token_stealer 0 Token stealing shellcode for privilege escalation
linux/x64/memfd_reflective_elf_tcp 3 Staged Reflective ELF Loader via TCP over IPV4 which executes an ELF from a remote server
linux/aarch64/memfd_reflective_elf_tcp 3 Staged Reflective ELF Loader via TCP over IPv4 which executes an ELF from a remote server handler
linux/aarch64/shell_reverse_tcp 3 Reverse Shell via TCP over IPv4 that provides an interactive /bin/sh session
linux/x86/execve 3 Executes a shell session such as /bin/sh
linux/x86/shell_reverse_tcp 3 Reverse shell via TCP over IPV4 that provides an interactive /bin/sh session
Architectures
-------------
aarch64
x64
x86
Modules Description
------- -----------
disassemble Simple linear disassembler for multiple architectures
handler Module for handling payload distribution and session management
asm_shell Interactive assembler and disassembler
diff Bytecode diffing module for comparing two binaries (or shellcode)
pinpoint Highlights opcodes within a disassembly to identify instructions responsible for bad characters
run Wrapper used for executing bytecode (shellcode)
format Converts bytecode into a respective format (activated anytime '-f' is used)
badchar Produces a set of all potential invalid characters for validation purposes
Format Description
------ -----------
perl Format bytecode for Perl
python Format bytecode for Python
hex_space Format bytecode in hex, seperated by a space
nasm Format bytecode for NASM
java Format bytecode for Java
javascript Format bytecode for Javascript (Blob to send via XHR)
escaped Format bytecode for one-liner hex escape paste
rust Format bytecode for a Rust application
uint8array Format bytecode for Javascript as a Uint8Array directly
bash Format bytecode for bash script (UNIX)
powershell Format bytecode for Powershell
cs Format bytecode for C#
dword Format bytecode in dword
c Format bytecode for a C application
raw Format bytecode to be written to stdout in raw form
ruby Format bytecode for Ruby
num Format bytecode in num format
hex Format bytecode in hex
python3 Format bytecode for Python3
이러한 접근 방식을 통해 각 모듈은 자신의 기능에 대한 상세 문서를 생성할 수 있습니다.
$ sickle-pdk -m run -i
Usage information for run
Name: Shellcode Runner
Module: run
Architecture: Multi
Platform: Multi
Ring: 3
Author(s):
wetw0rk
Tested against:
Linux
Windows
Module Description:
Executes bytecode from a binary file (-r) or a payload module (-p) under the context
of the currently running operating system and architecture. Meaning if you are
running on AARCH64 bytecode will be interpreted as such and if you're on x64 it will
interpret it as x64 respectively.
Example:
/usr/local/bin/sickle-pdk -m run -r shellcode
이러한 접근 방식에는 셸코드 스텁에 대한 문서도 포함됩니다.
$ sickle-pdk -p windows/x64/egghunter -i
Usage information for windows/x64/egghunter
Name: Windows (x64) Hell's Gate based Egghunter
Module: windows/x64/egghunter
Architecture: x64
Platform: windows
Ring: 3
Author(s):
hvictor
Tested against:
Windows 11 (10.0.26100 N/A Build 26100)
Argument Information:
Name Description Optional
---- ----------- --------
TAG Egg (provide 4 bytes) yes
Module Description:
This egghunter iterates virtual memory addresses and before searching for the egg, it
performs a NtProtectVirtualMemory system call. This system call is similar to
VirtualProtect, and is parameterized to set the memory to be scanned to READ, WRITE,
EXECUTE. This way, when the egg is found, the shellcode after it is guaranteed to be
executable.
Example:
/usr/local/bin/sickle-pdk -p windows/x64/egghunter TAG=w00t