
مجموعة أدوات ما بعد الاستغلال لجمع البيانات الاعتمادية، تحقن في مديري كلمات المرور وأدوات ويندوز لالتقاط البيانات الاعتمادية عبر DLL proxying وCOM hijacking وحقن AppDomainManager.
ثعلب_السرقة (ThievingFox) هي مجموعة من أدوات ما بعد الاستغلال لجمع بيانات الاعتماد من مُختلف مديري كلمات المرور وأدوات ويندوز المساعدة. كل وحدة (module) تستخدم طريقة محددة للحقن في العملية المستهدفة، ثم تقوم بتعليق (hooking) الدوال الداخلية لجمع بيانات الاعتماد.
يمكن العثور على المقال المُرفق بالمدونة هنا
يجب تثبيت Rustup، اتبع التعليمات المتوفرة هنا: https://rustup.rs/
يجب تثبيت حزمة mingw-w64. على Debian، يمكن القيام بذلك باستخدام:
apt install mingw-w64
يجب تثبيت أهداف ويندوز لكل من x86 و x86_64 لـ Rust:
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
أخيرًا، يجب تثبيت تبعيات بايثون:
pip install -r client/requirements.txt
يعمل ThievingFox مع python >= 3.11.
يجب تثبيت Rustup، اتبع التعليمات المتوفرة هنا: https://rustup.rs/
يجب تثبيت أهداف ويندوز لكل من x86 و x86_64 لـ Rust:
rustup target add x86_64-pc-windows-msvc
rustup target add i686-pc-windows-msvc
يجب أيضًا تثبيت بيئة تطوير .NET. من Visual Studio، انتقل إلى Tools > Get Tools And Features > Install ".NET desktop development"
أخيرًا، يجب تثبيت تبعيات بايثون:
pip install -r client/requirements.txt
يعمل ThievingFox مع python >= 3.11
ملاحظة: على مضيف Windows، لاستخدام وحدة KeePass، يجب أن يكون msbuild متاحًا في PATH. يمكن تحقيق ذلك عن طريق تشغيل العميل (client) من داخل Visual Studio Developer PowerShell (Tools > Command Line > Developer PowerShell)
تم اختبار جميع الوحدات على إصدارات ويندوز التالية:
| إصدار Windows |
|---|
| Windows Server 2022 |
| Windows Server 2019 |
| Windows Server 2016 |
| Windows Server 2012R2 |
| Windows 10 |
| Windows 11 |
[!CAUTION] لم يتم اختبار الوحدات على إصدارات أخرى، ومن المتوقع ألا تعمل.
[!CAUTION] على الرغم من أنني حاولت التأكد من أن هذه الأدوات لا تؤثر على استقرار التطبيقات المستهدفة، إلا أن التعليق الداخلي (inline hooking) وحقن المكتبات غير آمنين وقد يؤدي ذلك إلى تعطل التطبيق أو عدم استقراره. إذا حدث ذلك، فإن استخدام وحدة
cleanupعلى الهدف يجب أن يكون كافيًا لضمان أنه في المرة التالية التي يتم فيها تشغيل التطبيق، لن يتم إجراء أي حقن أو تعليق.
يحتوي ThievingFox على 3 وحدات رئيسية: poison و cleanup و collect.
لكل تطبيق محدد في معلمات سطر الأوامر، تقوم وحدة poison باسترداد المكتبة الأصلية التي سيتم اختطافها (لاختصاد COM ووكيل DLL)، وتجميع مكتبة تتطابق مع خصائص DLL الأصلية، ورفعها إلى الخادم، وتعديل السجل إذا لزم الأمر لتنفيذ اختطاف COM.
لتسريع عملية تجميع جميع المكتبات، يتم الاحتفاظ بذاكرة تخزين مؤقت (cache) في 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++ Redistributable على الهدف.
يمكن تحديد تطبيقات متعددة في وقت واحد، أو يمكن استخدام العلم --all لاستهداف جميع التطبيقات.
[!IMPORTANT] تذكر تنظيف الذاكرة المؤقتة إذا قمت بتغيير المعلمة
--tempdir، لأن اسم الدليل مضمّن داخل DLLs الأصلية.
$ 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 أولاً بإزالة آثار التسميم (poisonning) التي تجبر التطبيق المستهدف على تحميل مكتبة التعليق (hooking). ثم تحاول حذف المكتبات التي تم رفعها إلى المضيف البعيد.
بالنسبة للتطبيقات التي تدعم تسميم كل من خلايا HKCU و HKCR، يتم تنظيف كليهما بغض النظر.
يمكن تحديد تطبيقات متعددة في وقت واحد، أو يمكن استخدام العلم --all لتنظيف جميع التطبيقات.
لا تقوم بتنظيف بيانات الاعتماد المستخرجة على المضيف البعيد.
[!IMPORTANT] إذا كان التطبيق المستهدف قيد الاستخدام أثناء تشغيل وحدة
cleanup، فلا يمكن حذف DLLs التي تم إسقاطها على الهدف. ومع ذلك، ستقوم وحدة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 (DLL Proxying) |
| LogonUI.exe (شاشة تسجيل الدخول لنظام ويندوز) | اختطاف COM |
| consent.exe (منبثقة UAC في ويندوز) | اختطاف COM |
| mstsc.exe (عميل RDP الافتراضي لويندوز) | اختطاف COM |
| RDCMan.exe (عميل RDP من Sysinternals) | اختطاف COM |
| MobaXTerm.exe (عميل RDP تابع لطرف ثالث) | اختطاف COM |