HackThisSite - Basic Mission 10
Challenge
This time Sam used a more temporary and "hidden" approach to authenticating users, but he didn't think about whether or not those users knew their way around javascript...
Sam 使用了一种更临时、更"隐蔽"的方式来认证用户,但他没考虑到用户是否懂 JavaScript。
页面有一个密码输入框。
Solution
访问页面时,服务器会设置一个 cookie:
1 | Set-Cookie: level10_authorized=no |
提交密码时,服务器检查这个 cookie 的值。如果
level10_authorized=no,则拒绝访问。
解法:将 cookie 值改为 yes,然后提交表单。
方式一:浏览器开发者工具 Console:
1 | document.cookie = "level10_authorized=yes"; |
方式二:curl:
1 | $ curl -sL \ |
核心知识点:Cookie 是存储在客户端的,用户可以随意修改。不要依赖客户端 cookie 来做安全认证决策。任何存储在客户端的状态都可以被篡改。