### Web Hacking Challenge - WOWHacker CTF

This post is about challenge 8 which made gamma95 and I feel so lost when it comes to web hacking. Challenge 8 (not accessible atm) is the only web hacking challenge in WOWHacker's CTF. In hindsight it's not very difficult, but in fact it took us almost 1 day to solve it. This is a classic PHP local file inclusion attack. If you set the parameter ty and the cookie 71860c77c6745379b0d44304d66b6a13 to the same file name, the vulnerable PHP script in challenge 8 would try to include that file. Here's what the code looks like:
$ty =$_GET["ty"];
$page =$_COOKIE["71860c77c6745379b0d44304d66b6a13"];
if ($ty !=$page)
{
echo "Error!";
}
else
{
if (include($ty) != 'OK') { echo "Can't find that page!"; } } Update: gamma95 has just noticed me this challenge may not be a PHP local file inclusion attack. Maybe it's just a vulnerable readfile call like this:$ty = $_GET["ty"];$page = $_COOKIE["71860c77c6745379b0d44304d66b6a13"]; if ($ty != $page) { echo "Error!"; } else { if (file_exists($ty))
{