
포스트 익스플로잇 자격 증명 수집 툴킷으로, DLL 프록시, COM 하이재킹, AppDomainManager 주입을 통해 비밀번호 관리자 및 Windows 유틸리티에 주입하여 자격 증명을 획득합니다.
ThievingFox는 다양한 비밀번호 관리자 및 Windows 유틸리티로부터 자격 증명을 수집하는 사후 침투 도구 모음입니다. 각 모듈은 특정 방법을 사용하여 대상 프로세스에 인젝션한 후, 내부 함수를 후킹하여 자격 증명을 수집합니다.
관련 블로그 포스트는 여기에서 확인할 수 있습니다.
Rustup을 설치해야 합니다. 여기 있는 지침을 따르세요: https://rustup.rs/
mingw-w64 패키지를 설치해야 합니다. Debian에서는 다음 명령어로 설치할 수 있습니다:
apt install mingw-w64
Rust의 경우 x86 및 x86_64 Windows 대상이 모두 설치되어 있어야 합니다:
rustup target add x86_64-pc-windows-gnu
rustup target add i686-pc-windows-gnu
Mono와 Nuget도 설치해야 합니다. 설치 지침은 여기에서 확인할 수 있습니다: https://www.mono-project.com/download/stable/#download-lin
Mono 리포지토리를 추가한 후, Nuget은 apt를 사용하여 설치할 수 있습니다:
apt install nuget
마지막으로, Python 종속성을 설치해야 합니다:
pip install -r client/requirements.txt
ThievingFox는 python >= 3.11에서 작동합니다.
Rustup을 설치해야 합니다. 여기 있는 지침을 따르세요: https://rustup.rs/
Rust의 경우 x86 및 x86_64 Windows 대상이 모두 설치되어 있어야 합니다:
rustup target add x86_64-pc-windows-msvc
rustup target add i686-pc-windows-msvc
또한 .NET 개발 환경을 설치해야 합니다. Visual Studio에서 도구 > 도구 및 기능 가져오기 > ".NET 데스크톱 개발" 설치로 이동하세요.
마지막으로, Python 종속성을 설치해야 합니다:
pip install -r client/requirements.txt
ThievingFox는 python >= 3.11에서 작동합니다.
참고 : Windows 호스트에서 KeePass 모듈을 사용하려면 msbuild가 PATH에 있어야 합니다. Visual Studio 개발자 PowerShell(도구 > 명령줄 > 개발자 PowerShell) 내에서 클라이언트를 실행하면 이 작업을 수행할 수 있습니다.
모든 모듈은 다음 Windows 버전에서 테스트되었습니다:
| Windows 버전 |
|---|
| Windows Server 2022 |
| Windows Server 2019 |
| Windows Server 2016 |
| Windows Server 2012R2 |
| Windows 10 |
| Windows 11 |
[!CAUTION] 다른 버전에서는 모듈이 테스트되지 않았으며, 작동하지 않을 것으로 예상됩니다.
[!CAUTION] 이 도구들이 대상 애플리케이션의 안정성에 영향을 미치지 않도록 노력했지만, 인라인 후킹 및 라이브러리 인젝션은 안전하지 않으며 크래시나 애플리케이션 불안정을 초래할 수 있습니다. 그런 경우, 대상에서
cleanup모듈을 실행하면 다음 애플리케이션 실행 시 인젝션/후킹이 수행되지 않도록 해야 합니다.
ThievingFox에는 poison, cleanup, collect의 세 가지 주요 모듈이 있습니다.
명령줄 매개변수에 지정된 각 애플리케이션에 대해 poison 모듈은 하이재킹될 원본 라이브러리를 검색하고(COM 하이재킹 및 DLL 프록싱의 경우), 원본 DLL의 속성과 일치하는 라이브러리를 컴파일한 후 서버에 업로드하며, COM 하이재킹을 수행하기 위해 필요한 경우 레지스트리를 수정합니다.
모든 라이브러리의 컴파일 프로세스 속도를 높이기 위해 client/cache/에 캐시가 유지됩니다.
--mstsc, --rdcman, --mobaxterm은 각각 --mstsc-poison-hkcr, --rdcman-poison-hkcr, --mobaxterm-poison-hkcr과 같은 특정 옵션이 있습니다. 이러한 옵션 중 하나가 지정되면 COM 하이재킹이 HKCR 하이브의 레지스트리 키를 대체하여 모든 사용자에게 영향을 미칩니다. 기본적으로는 현재 로그인한 모든 사용자만 영향을 받습니다(HKCU 하이브가 있는 모든 사용자).
--keepass 및 --keepassxc에는 이들 애플리케이션이 설치된 위치를 지정하는 --keepass-path, --keepass-share, --keepassxc-path, --keepassxc-share 옵션이 있습니다(기본 설치 경로가 아닌 경우). 다른 애플리케이션은 COM 하이재킹을 사용하므로 필요하지 않습니다.
KeePass 모듈은 대상에 Visual C++ 재배포 가능 패키지가 설치되어 있어야 합니다.
여러 애플리케이션을 한 번에 지정하거나 --all 플래그를 사용하여 모든 애플리케이션을 대상으로 지정할 수 있습니다.
[!IMPORTANT]
--tempdir매개변수를 변경한 경우 디렉터리 이름이 네이티브 DLL에 포함되어 있으므로 캐시를 정리해야 합니다.
$ python3 client/ThievingFox.py poison -h
usage: ThievingFox.py poison [-h] [-hashes HASHES] [-aesKey AESKEY] [-k] [-dc-ip DC_IP] [-no-pass] [--tempdir TEMPDIR] [--keepass] [--keepass-path KEEPASS_PATH]
[--keepass-share KEEPASS_SHARE] [--keepassxc] [--keepassxc-path KEEPASSXC_PATH] [--keepassxc-share KEEPASSXC_SHARE] [--mstsc] [--mstsc-poison-hkcr]
[--consent] [--logonui] [--rdcman] [--rdcman-poison-hkcr] [--mobaxterm] [--mobaxterm-poison-hkcr] [--all]
target
positional arguments:
target Target machine or range [domain/]username[:password]@<IP or FQDN>[/CIDR]
options:
-h, --help show this help message and exit
-hashes HASHES, --hashes HASHES
LM:NT hash
-aesKey AESKEY, --aesKey AESKEY
AES key to use for Kerberos Authentication
-k Use kerberos authentication. For LogonUI, mstsc and consent modules, an anonymous NTLM authentication is performed, to retrieve the OS version.
-dc-ip DC_IP, --dc-ip DC_IP
IP Address of the domain controller
-no-pass, --no-pass Do not prompt for password
--tempdir TEMPDIR The name of the temporary directory to use for DLLs and output (Default: ThievingFox)
--keepass Try to poison KeePass.exe
--keepass-path KEEPASS_PATH
The path where KeePass is installed, without the share name (Default: /Program Files/KeePass Password Safe 2/)
--keepass-share KEEPASS_SHARE
The share on which KeePass is installed (Default: c$)
--keepassxc Try to poison KeePassXC.exe
--keepassxc-path KEEPASSXC_PATH
The path where KeePassXC is installed, without the share name (Default: /Program Files/KeePassXC/)
--keepassxc-share KEEPASSXC_SHARE
The share on which KeePassXC is installed (Default: c$)
--mstsc Try to poison mstsc.exe
--mstsc-poison-hkcr Instead of poisonning all currently logged in users' HKCU hives, poison the HKCR hive for mstsc, which will also work for user that are currently not
logged in (Default: False)
--consent Try to poison Consent.exe
--logonui Try to poison LogonUI.exe
--rdcman Try to poison RDCMan.exe
--rdcman-poison-hkcr Instead of poisonning all currently logged in users' HKCU hives, poison the HKCR hive for RDCMan, which will also work for user that are currently not
logged in (Default: False)
--mobaxterm Try to poison MobaXTerm.exe
--mobaxterm-poison-hkcr
Instead of poisonning all currently logged in users' HKCU hives, poison the HKCR hive for MobaXTerm, which will also work for user that are currently not
logged in (Default: False)
--all Try to poison all applications
명령줄 매개변수에 지정된 각 애플리케이션에 대해 cleanup 모듈은 먼저 대상 애플리케이션이 후킹 라이브러리를 로드하도록 강제하는 포이즈닝 아티팩트를 제거합니다. 그런 다음 원격 호스트에 업로드된 라이브러리를 삭제하려고 시도합니다.
HKCU 및 HKCR 하이브 모두에 포이즈닝을 지원하는 애플리케이션의 경우 두 하이브 모두 정리됩니다.
여러 애플리케이션을 한 번에 지정하거나 --all 플래그를 사용하여 모든 애플리케이션을 정리할 수 있습니다.
원격 호스트에서 추출된 자격 증명은 정리하지 않습니다.
[!IMPORTANT]
cleanup모듈이 실행되는 동안 대상 애플리케이션이 사용 중이면 대상에 드롭된 DLL을 삭제할 수 없습니다. 그럼에도 불구하고cleanup모듈은 인젝션을 활성화하는 구성을 되돌리므로, 다음 애플리케이션 실행 시 인젝션이 수행되지 않도록 해야 합니다.ThievingFox가 삭제할 수 없는 파일은 로깅됩니다.
$ python3 client/ThievingFox.py cleanup -h
usage: ThievingFox.py cleanup [-h] [-hashes HASHES] [-aesKey AESKEY] [-k] [-dc-ip DC_IP] [-no-pass] [--tempdir TEMPDIR] [--keepass] [--keepass-share KEEPASS_SHARE]
[--keepass-path KEEPASS_PATH] [--keepassxc] [--keepassxc-path KEEPASSXC_PATH] [--keepassxc-share KEEPASSXC_SHARE] [--mstsc] [--consent] [--logonui]
[--rdcman] [--mobaxterm] [--all]
target
positional arguments:
target Target machine or range [domain/]username[:password]@<IP or FQDN>[/CIDR]
options:
-h, --help show this help message and exit
-hashes HASHES, --hashes HASHES
LM:NT hash
-aesKey AESKEY, --aesKey AESKEY
AES key to use for Kerberos Authentication
-k Use kerberos authentication. For LogonUI, mstsc and consent modules, an anonymous NTLM authentication is performed, to retrieve the OS version.
-dc-ip DC_IP, --dc-ip DC_IP
IP Address of the domain controller
-no-pass, --no-pass Do not prompt for password
--tempdir TEMPDIR The name of the temporary directory to use for DLLs and output (Default: ThievingFox)
--keepass Try to cleanup all poisonning artifacts related to KeePass.exe
--keepass-share KEEPASS_SHARE
The share on which KeePass is installed (Default: c$)
--keepass-path KEEPASS_PATH
The path where KeePass is installed, without the share name (Default: /Program Files/KeePass Password Safe 2/)
--keepassxc Try to cleanup all poisonning artifacts related to KeePassXC.exe
--keepassxc-path KEEPASSXC_PATH
The path where KeePassXC is installed, without the share name (Default: /Program Files/KeePassXC/)
--keepassxc-share KEEPASSXC_SHARE
The share on which KeePassXC is installed (Default: c$)
--mstsc Try to cleanup all poisonning artifacts related to mstsc.exe
--consent Try to cleanup all poisonning artifacts related to Consent.exe
--logonui Try to cleanup all poisonning artifacts related to LogonUI.exe
--rdcman Try to cleanup all poisonning artifacts related to RDCMan.exe
--mobaxterm Try to cleanup all poisonning artifacts related to MobaXTerm.exe
--all Try to cleanup all poisonning artifacts related to all applications
명령줄 매개변수에 지정된 각 애플리케이션에 대해 collect 모듈은 원격 호스트에서 애플리케이션에 해당하는 C:\Windows\Temp\<tempdir> 안에 저장된 출력 파일을 검색하고 복호화합니다. 파일은 원격 호스트에서 삭제되며, 검색된 데이터는 client/ouput/에 저장됩니다.
여러 애플리케이션을 한 번에 지정하거나 --all 플래그를 사용하여 모든 애플리케이션의 로그를 수집할 수 있습니다.
$ python3 client/ThievingFox.py collect -h
usage: ThievingFox.py collect [-h] [-hashes HASHES] [-aesKey AESKEY] [-k] [-dc-ip DC_IP] [-no-pass] [--tempdir TEMPDIR] [--keepass] [--keepassxc] [--mstsc] [--consent]
[--logonui] [--rdcman] [--mobaxterm] [--all]
target
positional arguments:
target Target machine or range [domain/]username[:password]@<IP or FQDN>[/CIDR]
options:
-h, --help show this help message and exit
-hashes HASHES, --hashes HASHES
LM:NT hash
-aesKey AESKEY, --aesKey AESKEY
AES key to use for Kerberos Authentication
-k Use kerberos authentication. For LogonUI, mstsc and consent modules, an anonymous NTLM authentication is performed, to retrieve the OS version.
-dc-ip DC_IP, --dc-ip DC_IP
IP Address of the domain controller
-no-pass, --no-pass Do not prompt for password
--tempdir TEMPDIR The name of the temporary directory to use for DLLs and output (Default: ThievingFox)
--keepass Collect KeePass.exe logs
--keepassxc Collect KeePassXC.exe logs
--mstsc Collect mstsc.exe logs
--consent Collect Consent.exe logs
--logonui Collect LogonUI.exe logs
--rdcman Collect RDCMan.exe logs
--mobaxterm Collect MobaXTerm.exe logs
--all Collect logs from all applications
| 애플리케이션 | 인젝션 방식 |
|---|
| KeePass.exe | AppDomainManager 인젝션 |
| KeePassXC.exe | DLL 프록싱 |
| LogonUI.exe (Windows 로그인 화면) | COM 하이재킹 |
| consent.exe (Windows UAC 팝업) | COM 하이재킹 |
| mstsc.exe (Windows 기본 RDP 클라이언트) | COM 하이재킹 |
| RDCMan.exe (Sysinternals RDP 클라이언트) | COM 하이재킹 |
| MobaXTerm.exe (타사 RDP 클라이언트) | COM 하이재킹 |