type
status
date
slug
summary
tags
category
icon
password
@ZZHow(ZZHow1024)
SQL Injection(SQL注入)类
含义:把SQL命令插入到Web表单递交或输入域名或页面请求的查询字符串,欺骗服务器执行恶意的SQL命令。
思路:判断是否存在注入,注入命令查询数据
实操:
1、启动靶机,观察题目界面
![[极客大挑战 2019]EasySQL 1题目界面](https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F4b165318-6383-451c-8845-110b786c9f0a%2Fbc189399-cfea-4e71-a428-40f68c1b7532%2F1699921011934.jpg?table=block&id=b65571a7-1316-4735-9298-1b3bae9e09ef&t=b65571a7-1316-4735-9298-1b3bae9e09ef&width=2559&cache=v2)
- 发现是一个用户登录界面。
- 怀疑可能是爆破?或者SQL注入?好吧,标题已经说了是EasySQL。
2、尝试猜一次
- 先随便试试,万一猜对了呢。
- 尝试常见用户名和密码。
- 用户名:admin
- 密码:password

- 好好好,果然没这么简单。
3、在密码结尾加上’(单引号),判断是不是SQL,且是否可以注入
- 构建用户名和密码。
- 用户名:admin
- 密码:password’
- 发现URL栏后多了/check.php?username=admin&password=password’,但没有报错!?
- 没关系知道了是GET方法,尝试使用Hackbar构建一个URL并访问。
- 构建URL。
- http://d6a6b81b-d998-4ce6-b153-62fd39e02a59.node4.buuoj.cn:81/check.php?username=admin&password=password'
- 点击 “EXECUTE”!
- 出现SQL报错。
- “You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''password''' at line 1”

- 证明可以尝试SQL注入
4、尝试构建万能密码
- 考虑到密码允许输入字母+数字,判断为字符型注入。
- password' or '1'='1'--+(在这道题会报错)
- 或password' or '1'='1
逻辑或运算,假 or 真 = 真
- 构建URL。
- http://d6a6b81b-d998-4ce6-b153-62fd39e02a59.node4.buuoj.cn:81/check.php?username=admin&password=password' or '1'='1
- 点击 “EXECUTE”!
5、解题成功!

Login Success!
- 获得Flag!