> For the complete documentation index, see [llms.txt](https://ajaykumar-kanthi.gitbook.io/write-ups/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ajaykumar-kanthi.gitbook.io/write-ups/hack-the-box-oscp-machines/htb-help.md).

# HTB - Help

## Enumeration and Foothold

### NMAP

```bash
PORT     STATE SERVICE VERSION
22/tcp   open  ssh     OpenSSH 7.2p2 Ubuntu 4ubuntu2.6 (Ubuntu Linux; protocol 2.0)
80/tcp   open  http    Apache httpd 2.4.18
3000/tcp open  http    Node.js Express framework
Service Info: Host: 127.0.1.1; OS: Linux; CPE: cpe:/o:linux:linux_kernel
```

### HTTP

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2Fy8Sqw06T0cY7r4Yk4Ecw%2Fimage.png?alt=media&amp;token=16b2e004-a42a-4515-b65b-2e5aa39088ce" alt=""><figcaption></figcaption></figure>

add domain to hosts file for accessing the website.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FFfW7sT4EWZkPMJh08amN%2Fimage.png?alt=media&amp;token=2b02e1b9-b7f8-47dc-9230-74153710be4d" alt=""><figcaption></figcaption></figure>

also port 3000 displays the below message

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FCePJElv66jC7l7kvcwpM%2Fimage.png?alt=media&amp;token=110915df-d504-45cd-8f24-fe8cd76a8228" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FnHjqV8oCjbXRMw6a0KZc%2Fimage.png?alt=media&amp;token=709f0df9-9b42-4245-9190-a107449eab23" alt=""><figcaption></figcaption></figure>

ferox found some interesting directories accessing any of it keeps buffering but nothing interesting.

the only thing that sounds interesting is the username revealed on port 3000 called shiv.

Looking at the data on port 3000 i guess there is an hidden api endpoint.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FMaHTdOhT0hexhksXnjrc%2Fimage.png?alt=media&amp;token=18f3f2b2-fb15-4cd9-925b-cd7d2b0b1249" alt=""><figcaption></figcaption></figure>

accessing a graphql endpoint it responds with below message

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2Fj5lz4F6zEzRtJwKR9tSE%2Fimage.png?alt=media&amp;token=06c0288a-abbb-444b-901b-b579de3da585" alt=""><figcaption></figcaption></figure>

That confirms it  `/graphql` exists and is expecting a GET request with a `query` parameter. This matches the earlier hint about "credentials with given query."

### Enumerating Qraphql

{% embed url="<https://graphql.org/learn/introspection/>" %}

The above blog post can be helpful in enumerating the graphql.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FxAEi2Lfp4KxG6HSk14j3%2Fimage.png?alt=media&amp;token=033502a6-9993-4cc8-8ee1-3c52d22924a9" alt=""><figcaption></figcaption></figure>

Introspection is enabled and confirmed  there's a `Query` type and a `User` type.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2Fd9wNlkjJrZjCUs8La17u%2Fimage.png?alt=media&amp;token=14d52f7c-99cb-4bb3-be8d-c6488badaaa9" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FaDjTFTWIY1qbQ6dnDLiN%2Fimage.png?alt=media&amp;token=d05fb732-9f1c-44da-8221-6662d8f42660" alt=""><figcaption></figcaption></figure>

user field takes two arguments username and password lets pull that data.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FvKu5BjWscmola2Vg8lJt%2Fimage.png?alt=media&amp;token=5cbd6a8a-0173-4d89-863b-d507dd024344" alt=""><figcaption></figcaption></figure>

Found the above credentials, crackstation cracked the password

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FmmIhtAd7w7ZbXQFE9Np9%2Fimage.png?alt=media&amp;token=03e7b86e-9bd1-4610-91c7-caca618b6fb5" alt=""><figcaption></figcaption></figure>

the password doesnt work for both helpme and shiv user.

That said i need to find something where i can use the credentials.

the earlier directory enumeration on port 80 revealed a hidden directory called /support&#x20;

it did not load earlier but now it does.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FVbHaX2yiLzUQEIaUZjMX%2Fimage.png?alt=media&amp;token=d16b44c6-b871-410f-8c35-1cf70cfdef79" alt=""><figcaption></figcaption></figure>

i can use the credentials here to login.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FqlEU2y75ajUW0tgZs9UB%2Fimage.png?alt=media&amp;token=ede47a7a-77f9-48b5-b88b-70f967a8ca85" alt=""><figcaption></figcaption></figure>

got successful authentication.

i dont know the exact version of the helpdesk being used but poking around google i found there is a sql injection vulnerability in version 1.0.2 which i can try here.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2Fck4nT8l47mzlH41WNtRD%2Fimage.png?alt=media&amp;token=9b30010c-ccc2-4d34-8b76-96aa8cbfcbd7" alt=""><figcaption></figcaption></figure>

the flaw is in the ticket viewing and attachment. so i will try to create a ticket see whats going around.

{% embed url="<https://www.exploit-db.com/exploits/41200>" %}

poc explains the vulnerability and exploitation steps.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2F1jNVHvelN8fI5q3NmGIM%2Fimage.png?alt=media&amp;token=e5db7fc5-c79b-46ea-8a64-635772ab7410" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FCczenM6HuOqVOxTBxdN9%2Fimage.png?alt=media&amp;token=3ea76241-a399-4727-9a6a-ace9b1e4902f" alt=""><figcaption></figcaption></figure>

i will upload a junk file as attachment and submit the ticket.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2F8Eu0SIOHvgpnuSm8WTEN%2Fimage.png?alt=media&amp;token=b5f5f393-86ea-415c-8cbe-8d9c61039c06" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FPAKQheBAvy4QpNHUfXi9%2Fimage.png?alt=media&amp;token=e466491a-bddd-42ba-8624-c6e04f579db5" alt=""><figcaption></figcaption></figure>

this is the vulnerable request the exploit is talking about.

the vulnerability is in the `param[]` parameter that said i will use sqlmap to test it.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2F8KbMEnkaqRdj8tGfAio9%2Fimage.png?alt=media&amp;token=32379db4-ba9b-49ef-ad9d-757c889a7aed" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FHjCQZPhvCEs7QBC15AAQ%2Fimage.png?alt=media&amp;token=c4725287-f4a5-4f82-8229-6cacef7f9a22" alt=""><figcaption></figcaption></figure>

## Shell as Help

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FdIWWiOzbM1EhtKF9vNQJ%2Fimage.png?alt=media&amp;token=9f523d81-193c-4953-9ffe-172c734968e4" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FCWOITmm1J1E8dEvboKqK%2Fimage.png?alt=media&amp;token=7e2891de-4979-408f-9def-9549003472e7" alt=""><figcaption></figcaption></figure>

**4.4.0-116-generic** is vulnerable to the classic **eBPF local privilege escalation, CVE-2017-16995**

### **eBPF local privilege escalation**

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FcMgOh8vVR6avQ1WxOL7t%2Fimage.png?alt=media&amp;token=a57e3128-8cca-49d8-82c4-bd834b5cce86" alt=""><figcaption></figcaption></figure>

transfer the file to the victim

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FWCS0uFcGjLIgF6vvZmjw%2Fimage.png?alt=media&amp;token=f6f41f01-97d7-44cb-b600-13bbfaaf9bbb" alt=""><figcaption></figcaption></figure>

compile and run

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FEZ4MvBBVOHxcV2uC4WO2%2Fimage.png?alt=media&amp;token=e3f5bea1-1795-4150-8019-8d07e6a419d5" alt=""><figcaption></figcaption></figure>

## Shell as Root

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FcWwIPAeNt1mVx3hegxBW%2Fimage.png?alt=media&amp;token=125646fc-c7cc-4fb1-981c-0634aec0db50" 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 dynamically by asking a question.

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

```
GET https://ajaykumar-kanthi.gitbook.io/write-ups/hack-the-box-oscp-machines/htb-help.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 `build a script that syncs our docs to a CMS` 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.
