Prioritise
In this challenge you will explore some less common SQL Injection techniques. - by congon4tor
Recon
┌──(kali㉿kali)-[~/Documents/tryhackme/prioritise]
└─$ nmap -sT 10.10.146.190
Starting Nmap 7.93 ( https://nmap.org ) at 2023-05-17 21:13 EDT
Nmap scan report for 10.10.146.190
Host is up (0.052s latency).
Not shown: 998 closed tcp ports (conn-refused)
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
Nmap done: 1 IP address (1 host up) scanned in 0.88 seconds
The Website greets us with a todo list, with the options to add entries, delete entries and sorting those by status, date or title.

Checking sqli on order by
Guessing the table todos with the column date reveals that the order by function is injectiable, by using the following two sql statements which evaluates and sorting the entries either way by title or date

To find the flag, try to get the sql schemata
Frist of all check the used database
Oracle Server Error 500
(CASE WHEN(SELECT table_name FROM dba_tables WHERE table_name IS NOT NULL) THEN date ELSE title END)
MySQL Server Error 500
(CASE WHEN(SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME IS NOT NULL) THEN date ELSE title END)
SQLITE executes without a Server Error
(CASE WHEN(SELECT name FROM sqlite_schema WHERE name not null) THEN date ELSE title END)
To get the sql schemata we guess the characters leading to the case ordered by the title.
To avoid special characters like \n CHAR(10) \r CHAR(13) \t CHAR(9) those will be replace by + and -.
Dont forget to use group_concat to receive not just the first entry.
This Script failed unfortunatly, because it stopped due to a character which was not in probe, maybe a special character I did not consider.
But there is another way to enumerate the db, by just getting the tables of the database:
There we have a table named flag. Lets enumerate its columns
Getting the flag
So we know now, that the table flag, contains a field named flag, which might contains the flag...

Last updated
Was this helpful?