HackThisSite - Basic Mission 5

posted
read
214 words · 1 min
contents

Challenge

Sam has gotten wise to all the people who wrote their own forms to get the password. Rather than actually learn the password, he decided to make his email program a little more secure.

Sam 发现很多人自己写表单来获取密码。他没有去真正学密码,而是让邮件程序变得更安全了一些。

Solution

这题和 Basic 4 基本一样,只是增加了 Referer 验证。服务端会检查请求来源是否来自 /missions/basic/5/ 页面本身。

解决方法完全相同,都是修改隐藏的 to 字段,但必须同时发送正确的 Referer:

Terminal window
$ curl -sL -b 'HackThisSite=YOUR_COOKIE' \
-e 'https://www.hackthissite.org/missions/basic/5/' \
-d 'to=YOUR_EMAIL' \
'https://www.hackthissite.org/missions/basic/5/level5.php'

-e 参数设置 Referer header。如果不带 Referer 或 Referer 不匹配,会返回 Invalid Referer 错误。

本题依赖的 Referer header 可以由客户端伪造,不能代替服务端鉴权。跨站请求防护还需要结合 CSRF token、SameSite cookie 等控制;Referer/Origin 检查仅是其中一层。

92bf24e2