> For the complete documentation index, see [llms.txt](https://gitbook-88.gitbook.io/ctf-writeup/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook-88.gitbook.io/ctf-writeup/2019/2019-gxyctf/babysqli.md).

# BabySQli

网页源码可以看到有search.php，访问后提示wrong user，回显一段加密的字符串。base32+base64解密：

```
select * from user where username = '$name'
```

变量直接引用提示注入点。

SQLMAP可以看到表结构

这里有一个知识点：**当查询的数据不存在的时候，联合查询就会构造一个虚拟的数据。**

在联合查询并不存在的数据时，联合查询就会构造一个虚拟的数据。这时候直接在pass框里面输入密码的md5解密结果就可以了。

构造这样的payload：

```
username栏：admin' and 0 union select '1','admin','e809578d0b633a6db7de68749308f476
password栏：oatmeal
```
