# \[ByteBandits CTF 2023] Writeup Web

## Improper Error Handling

Mở đầu bài chúng ta sẽ có bài giao diện như này:&#x20;

<figure><img src="/files/IBqkTsmtzlTNve8lPCZ0" alt=""><figcaption></figcaption></figure>

Cần nhập password, khi nhập pass thì mình thử nhập một pass bất kỳ nhưng nó ghi là pass quá ngắn và mình nghĩ tới SQL Injection nhưng không đúng nhưng sau khi check một lúc thì challenge này chỉ cần nhập pass đủ dài thì có pass

Ví dụ như: asdfghjklzxcvvbnnmmkjhgfdsasdfgh -> đủ 32 ký tự là được

<figure><img src="/files/f5NGa8NQ3jkTxIILPaFT" alt=""><figcaption></figcaption></figure>

## Hi-Score

<figure><img src="/files/Ks9NhBpNIJlJ87cIx4hQ" alt=""><figcaption></figcaption></figure>

Bài này cần một lần 100 click mỗi giây thì sẽ lấy ra flag, lúc đầu mình nghĩ sẽ viết lại một đoạn JS up lên console để overwrite lại  hàm Click() nhưng sau một lúc mở source thì có một link tới JS của web. Mình dùng console để console.log ra và flag nằm ở đây:&#x20;

<figure><img src="/files/G9PyXs3k4O9VqTjoi24x" alt=""><figcaption></figcaption></figure>

Flag: `flag{THAtS_15_A_SM4rT_m0ve}`

## Hash Browns

<figure><img src="/files/9B1dvzFc7cbEciIKzd81" alt=""><figcaption></figcaption></figure>

Vào trang web này chả có gì, xem một lúc thì có cookie với key là garlic

<pre class="language-http" data-overflow="wrap"><code class="lang-http"><strong>garlic:cmztpaurxxnoqz3p2on73msbohg5sk74l2fxnxp27gky6cdjqzqq6nad
</strong></code></pre>

Với các cookie này mình chả biết làm gì cả , một lúc research lâu cũng không nghĩ vấn đề nằm ở đâu một điều nữa mình check garlic lên thì nó chỉ hiện hình ảnh củ tỏi, một lúc lâu không có team nào solve được bài này thì admin tung hint ra:&#x20;

<figure><img src="/files/T24Y1LyX1rs4OMF0gPvK" alt=""><figcaption></figcaption></figure>

Nhìn hình mình nhớ tới trình duyệt Tor, rồi cũng k biết cho Tor để làm gì. Sau khi tải Tor về mình chạy challenges trên trình duyệt này cũng không có gì bất thường. Chợt nhận ra cookie là garlic có giá trị một mã không xác định, một lúc sau từ sự gợi ý của một người bạn thì mình nhận ra ở Tor có cách chạy ẩn mà không bị theo dõi qua .onion(the onion router):&#x20;

```
http://http://3g2upl4pq6kufc4m.onion
```

Mình dùng value của garlic nối thêm .onion nữa để chạy:&#x20;

<figure><img src="/files/V1B7yzeGoma2zFemZrPZ" alt=""><figcaption></figcaption></figure>

Xem source để xem flag:

<figure><img src="/files/BuMbl53j6OdSX5LxhWh6" alt=""><figcaption></figcaption></figure>

Có một cách khác nếu không dùng Tor Browser thì có thể code tool gửi tới Tor như sau:

```python
import requests

def get_tor_session():
    session = requests.session()
    # Tor uses the 9050 port as the default socks port
    session.proxies = {'http':  'socks5://127.0.0.1:9050',
                       'https': 'socks5://127.0.0.1:9050'}
    return session

# Following prints your normal public IP
print(requests.get("http://web.bbctf.fluxus.co.in:1004").headers)

# Make a request through the Tor connection
# IP visible through Tor
session = get_tor_session()
print(session.get("http://cmztpaurxxnoqz3p2on73msbohg5sk74l2fxnxp27gky6cdjqzqq6nad.onion/").content)
# Above should print an IP different than your public IP
```

Cảm ơn mọi người đã đọc bài, hẹn mọi người wu các giải tiếp theo!!


---

# Agent Instructions: 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:

```
GET https://shangs.gitbook.io/shine/write-up-ctf/ctf-competitions/bytebandits-ctf-2023-writeup-web.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
