HackTheBox : Cicada

0liverFlow
10 min readMar 3, 2025

--

Cicada is a beginner-friendly windows machine that covers some interesting techniques. To get our initial access, we took advantage of a SMB guest session. This guest session then allowed us to access a readable public share that contained the company default password. To be able to authenticate, we needed to find a list of usernames that we obtained after performing a RID cycling attack. Using this first set of credentials, we have been able to enumerate other domain information and found a password in the description field of another domain user. With this new password, we got read access to a new share that stored the credentials of another user in a powershell script. After some enumeration, we noticed that this new user was part of the Backup Operators group which allowed us to backup any file in the domain included the SAM and NTDS.dit databases which stores sensitive information such as NT hashes. Once the NT hashes extracted, we performed a pass-the-hash attack and fully compromised the domain.

That being said, in this box you will learn the following techniques :

→ Enumerate guest/null sessions using enum4linux-ng

→ Enumerate SMB shares with netexec and manspider

→ Perform a RID cycling attack using netxec and impacket’s lookupsid.py

→ Perform password spraying attack

→ Collect domain information with rusthound

→ Extract useful domain information using bloodhound-quickwin

→ Extract SAM and SYSTEM files from the hive using living off the land technique

→ Perform a pass-the-hash attack

Reconnaissance

Nmap

Tcp full scan
Udp top 50 ports scan

DNS — TCP/53

Let’s first query all the domain entries using dig :

Querying all DNS entries

We got a new domain : cicada-dc.cicada.htb

Let’s add that to our /etc/hosts file :

Adding domains to /etc/hosts

Once done, let’s try to perform a DNS zone transfer against cicada.htb :

Attempting a DNS zone transfer

The DNS zone transfer failed !

Let’s now move on with SMB enumeration.

SMB — TCP/445

In this section, we will first run enum4linux-ng. This tool will perform various checks like enumerating null/guest sessions, domain information (domain name, FQDN), RPC information (users, groups, password policy, OS information, printer information) and so on :

Enumerating SMB with enum4linux-ng
Enum4linux-ng output

The -A and -C options are respectively used to perform all simple enumeration and services enumeration.

Note : If you run enum4linux-ng without providing any option, it will automatically use the -A option to perform all simple enumeration.

From the output above, you can see that the server allows SMB guest session. This is quite different from SMB null session. Feel free to read this blog post if you want to learn more about the topic.

That said, let’s check the guest session using netexec :

SMB guest session succeeded

Here, we can try to enumerate the shares :

Enumerating SMB shares

Interesting ! We have read permission over the HR share which is not a default share on Active Directory. Let’s take a look at its content :

Downloading the HR share

After downloading the HR share, we can check if it stores any sensitive information that could help us get higher privileges :

Company default password found in HR share

Awesome ! The share stores the company default plaintext password. Nevertheless, we don’t have a list of usernames against which we can check this password. Therefore, our next goal will be to find a way of getting usernames. For instance, we can try to enumerate users using rpcclient :

Enumerating users with rpcclient

Unfortunately, this method failed !

Another method consists of performing a RID cycling attack. Simply put, this is how it works :

By default, every domain account or group has a Security IDentifier (SID). This is a unique identifier that is issued by the domain controller to differentiate different domain accounts. Generic accounts such as Administrator and Guest are part of a list of well-known SIDs that you can find here. To picture that, let’s take a look at the figure below :

Converting names to SIDs

As illustrated on the figure above, we used a rpcclient’s command called lookupnames that allowed us to convert account usernames to SIDs. We could even convert group names if we wanted to :

Converting groups to SIDs

Here is a quick breakdown of the different parts of an SID :

  • S : stands for SID
  • 1 : the SID version (1 in modern Windows machines)
  • 5 : an identifier authority
  • 21–917908876–1423158569–315903872 : represents the domain identifier (unique for each domain)
  • 513 : the Relative IDentifer (RID) which identifies a specific user, group, or system account. This identifier is unique within a domain.

That said, we can reverse the lookup process which means that we can also convert SIDs to names. This is where things get really interesting. Indeed, we can perform an attack called RID cycling which consists of adding random RIDs to the end of an SID and hope to come across a valid domain object (user, group, alias, etc). The rpcclient command to do that is called lookupsids. For instance, on the figure below I tried to lookup different RIDs like 501, 1000, and 1200 :

Converting SIDs to names

As you can see, the latest RID (1200) provided me nothing. Instead of doing that manually, we can use nxc to automate the process :

Performing RID cycling attack using nxc

Our attack worked and we’ve been able to get a list of usernames, groups and aliases.

Note : By default, nxc performs a rid cycling against the 4000 first RIDs.

Here is another way of performing a RID cycling attack using impacket’s lookupsid :

Performing RID cycling attack with impacket’s lookupsid

Well, let’s now try to perform a password spraying attack using the list of usernames we enumerated above and the password found in the HR share :

Password spraying attack

Note : I used the --continue-on-success flag to prevent nxc to stop the attack after finding a valid credential.

Great ! We obtained a valid credential for the user michael.wrightson.

Let’s check if we can authenticate to other open ports to see if we can eventually get a shell :

Checking authentication to other open ports

Unfortunately, the authentication failed for WinRM. Nevertheless, we can still do more with this access. For instance, we can try to enumerate michael.wrightson’s shares :

Enumerating shares

We have read access to Netlogon and Sysvol shares. However, after checking their content, I found nothing interesting. We can also try enumerating michael.wrightson’s group membership :

Enumerating michael.wrightson’s group membership

Well, this led nowhere. Let’s try to collect the domain information using rusthound. RustHound is a cross-platform bloodhound collector written in Rust programming language. It comes in two versions : Rusthound legacy for bloodhound legacy version and Rusthound-CE for bloodhound Community Edition. Here, I used the latter one because I use bloodhound Community Edition :

Collecting domain information using rusthound

Once the execution done, RustHound will generate a zip file containing json files that we can then upload in Bloodhound.

Prior uploading the zip file in Bloodhound, I will show you a quick way to enumerate the collected domain information. To do that, I will use a great tool called bloodhound-quickwin :

bloodhound-quickwin help menu

Make sure to start your neo4j database before running bloodhound-quickwin.

Starting neo4j database

Once done, you can run bloodhound-quickwin as follows :

1/ Enumerate all available domains

Enumerating all available domains

2/ Running bloodhound-quickwin against a specific domain :

bloodhound-quickwin output

This didn’t retrieve anything really interesting but it is worth knowing this tool as it can be useful in other scenarios. Let’s now check what we can find in bloodhound :

Visualizing domain information in Bloodhound

Seeing all these certificates made me think of AD CS. Let’s try to enumerate vulnerable templates using certipy :

Enumerating vulnerable templates

No vulnerable template was found !

We can also enumerate users’ description field as it sometimes contains sensitive information stored by admins :

Enumerating user’s description field

Interesting ! A password is stored in the description field of the user david.orelious. Let’s check if this password is still valid :

Checking if david.orelious’ password is valid

Awesome, the password is valid.

Now let’s check if we can authenticate on other open ports :

Checking authentication against other open ports

As you can see, the authentication only worked for LDAP.

That said, let’s enumerate the shares :

Enumerating shares

David.orelious has read access to the DEV share.

Let’s check the content of this share using smbclient.py :

Accessing DEV share content

Awesome ! We found a password that seems to belong to the user emily.oscars. Let’s check if these credentials are valid :

Checking emily.oscars’ credentials

Hoorah, the credentials are valid.

Note : Rather than enumerating the DEV share manually, we could use a great tool called manspider to automate the research of sensitive information in shares. Here is how to use it :

Looking for sensitive information in DEV share

That said, let’s try to authenticate against other open ports :

Checking emily.oscars’ credentials against other open ports

This time, we got a successful authentication for winrm which mean that we can get a shell for emily.oscars. That said, let’s authenticate to winrm using evil-winrm :

Attempting winrm authentication as emily.oscars

Haha, emily.oscars is part of the Backup Operators group. Users of this group can backup any file they want in the domain included sensitive files such as SAM or NTDS.dit. This means that it’s game over !! Furthermore, you can see below that we have the SeBackupPrivilege and SeRestorePrivilege which are generally related to Backup Operators. Here is great resource that explains it.

Well, let’s first retrieve the user flag :

user.txt

Privilege Escalation

In this section, we are going to escalate our privileges by taking advantage of being part of the Backup Operators group.

Let’s first try to download the SAM and SYSTEM registry files :

Launching SMB server
Transferring SAM and SYSTEM files to the attacker machines
Extracting NT hashes from SAM and SYSTEM files

Let’s check if we can authenticate as Administrator using the above NT hash :

Checking authentication against the Administrator account

Wonderful ! It works !

Let’s authenticate to the Administrator account using evil-winrm :

Well, let’s retrieve now the root flag :

root.txt

Wrap Up

That’s it guys. Congrats on having made it so far 👏

I hope you enjoyed the writeup and learned new techniques.

That said, do not forget to click on the little clap icon below to support me and subscribe to my newsletter to keep up with my latest articles !

--

--

0liverFlow
0liverFlow

Written by 0liverFlow

Pentester | Enjoy breaking and building stuffs

No responses yet

Write a response