> 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/linux-easy/blocky-hackthebox-writeup.md).

# Blocky HackTheBox Writeup

Blocky HackTheBox Easy Linux machine writeup covering WordPress Enumeration, Information Leakage, Analyzing a jar file - JD-Gui + SSH Access, Abusing Sudoers Privilege (Privilege Escalation), with pra

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

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

* WordPress Enumeration
* Information Leakage
* Analyzing a jar file - JD-Gui + SSH Access
* Abusing Sudoers Privilege (Privilege Escalation)
  {% 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-2df091155b769d42f9bff6272a11cdeacadc8c2e%2Fimage%20(952).png?alt=media" alt=""><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-8dbca5a16f847793dbb66da42156253baee475d2%2Fimage%20(953).png?alt=media" alt=""><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 --min-rate 5000 10.10.10.37 -oG allPorts
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-f832b5c76685f99ecb0a16b4dd6d220ce1a77ad9%2F%7BD8CC492B-5DFE-40C4-9CB5-074FECAB3AF3%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Analysis of open ports with extractport:** Using the extractport function to synthetically display open ports and copy them to the clipboard. (21.22.80,25565)

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

**Scanning the port version with Nmap:** Using Nmap to scan the port version and extracting the information into the "targeted" file:

```bash
nmap -sCV -p21,22,80,25565 10.10.10.37 -oN targeted
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-195dc27f4a509778a33fb4aacc13c13a68f7b45c%2Fimage%20(955).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-3e2ec2ee38f44230f36854b4da79268b27fa9a9a%2Fimage%20(956).png?alt=media" alt=""><figcaption></figcaption></figure>

### Port 80

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-c35cf77902efc22544732dc8091974f1f117fcd0%2F%7BFFA085C0-2D66-45F3-9B65-AEC3E396A7E2%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Enumeration of directories with Gobuster:**

We use **Gobuster** to enumerate directories on the target machine's web server.

```bash
gobuster dir -u http://blocky.htb/ -w /usr/share/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt -t 100
```

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

We discover a directory named **plugins**.

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

**Downloading and extracting the BlockyCore.jar file:**

We download the **BlockyCore.jar** file, which appears to be a custom plugin. Then we extract its contents.

```java
jar xf BlockyCore.jar
```

#### Decompiling the BlockyCore.class file

In the extracted file we find a **BlockyCore.class** file. We decompile it using **javap** to examine its contents

```bash
javap -c BlockyCore.class
```

We find a set of credentials for the database:

* **localhost**
* **root**
* **8YsqfCTnvxAUeduzjNSXe22**

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

#### Database access via PhpMyAdmin

Using the extracted credentials, we log in to **PhpMyAdmin** and discover a table in the database containing a user named **notch**.

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

**Connection by SSH:**

We use the password **`8YsqfCTnvxAUeduzjNSXe22`** for user **notch** and successfully log in.

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

### Flag User.txt

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

## Privilege Escalation

We notice that the user belongs to the **sudo** group, which allows us to use **sudo** to elevate our privileges

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

**Running the sudo su command:**/ We run the following command to get a root shell:

```bash
sudo su
8YsqfCTnvxAUeduzjNSXe22
```

### 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-50de6de688badbfdbca88bc01ba5b705ca38643e%2Fimage%20(964).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-fa69622a7b4769448941b8ac62086501491e9dc6%2F%7B395319FC-ACD2-4902-B2FA-A831B9E272FE%7D.png?alt=media" alt="" width="516"><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/linux-easy/blocky-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.
