首页 > 解决方案 > MariaDB 给我一个错误,在 ctf 中显示 'WHERE '1'='1''

问题描述

我正在浏览初学者hackerone ctfs,并试图破解Micro-CMS v2。有一个容易受到 SQL 注入攻击的登录页面。查询是这样的:

'SELECT password FROM admins WHERE username=\'%s\'' % request.form['username'].replace('%', '%%')

在我输入的用户名字段中,' UNION SELECT '123' AS password WHERE '1'='1但随后返回此错误

ProgrammingError: (1064, "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 'WHERE '1'='1'' at line 1")

我尝试用 --' 或使用 gWHERE 1=1'来评论它,但没有任何东西可以工作

标签: sqlcode-injectionctf

解决方案


推荐阅读