KhiZaRix Posted April 8, 2015 Report Posted April 8, 2015 -----BEGIN PGP SIGNED MESSAGE-----Hash: SHA512Product: phpTrafficAProduct page: phpTrafficA HomepageAffected versions: Up to and including 2.3 (latest as of writing).Description:The user agent string provided by the browser is not sanitized norescaped when handled. This string is then outputting into HTML code onthe "Latest visitors > Details" page, leading to HTML injection that canbe abused to perform XSS. For example, the following user agent willcause a JavaScript dialogbox to pop up as soon as the page is visited:"><script>alert();</script>This page can be hidden from the public, in which case only admins canvisit it. However, the script still executes when they do, which couldenable a malicious user agent to steal the phpTrafficA cookie (noexpiry) or other admin credentials.Proposed fix:Escape the HTML characters with htmlspecialchars before outputting theuser agent string.In: Php/stats/statsRecent.inc.phpLine 304:echo "<tr class=\"data av $even $clrobots $clreturn\"><tdnowrap>$end</td><td> $dur</td><tdalign=\"center\"> ".format_float($hits)." </td><td> <ahref=\"./index.php?mode=stats&sid=$sid&show=clickstream?=$lang&ip=$ip\"title=\"".$strings['Moreinfovisitor']."\"class=\"basic\">$ipText</a> </td><tdalign=\"center\"> ".format_float($visits)." </td><td>".countryFlag($country)."</td><td>".osImg($os,'')."</td><td>".browserImg($wb,$agent)."</td><td>$page</td><td>$refString</td></tr>\n";becomes:echo "<tr class=\"data av $even $clrobots $clreturn\"><tdnowrap>$end</td><td> $dur</td><tdalign=\"center\"> ".format_float($hits)." </td><td> <ahref=\"./index.php?mode=stats&sid=$sid&show=clickstream?=$lang&ip=$ip\"title=\"".$strings['Moreinfovisitor']."\"class=\"basic\">$ipText</a> </td><tdalign=\"center\"> ".format_float($visits)." </td><td>".countryFlag($country)."</td><td>".osImg($os,'')."</td><td>".browserImg($wb,htmlspecialchars($agent))."</td><td>$page</td><td>$refString</td></tr>\n";Line 369:$echo = "<tr><td valign=\"top\" colspan=\"3\">$ip($whoislink$baniplink)<br>$host<br>$labelTxt<tableclass=\"basic\"><tr><td>".countryNameFlag($country)."</td></tr></table></td><tdvalign=\"top\" colspan=\"2\">".$strings['Agent'].": $thisagent<br><tableclass=\"basic\"><tr><td>".osImgName($os)."</td><td>".browserImgName($wb)."</td></tr></table>".$strings['Referrer'].":";becomes:$echo = "<tr><td valign=\"top\" colspan=\"3\">$ip($whoislink$baniplink)<br>$host<br>$labelTxt<tableclass=\"basic\"><tr><td>".countryNameFlag($country)."</td></tr></table></td><tdvalign=\"top\" colspan=\"2\">".$strings['Agent'].":".htmlspecialchars($thisagent)."<br><tableclass=\"basic\"><tr><td>".osImgName($os)."</td><td>".browserImgName($wb)."</td></tr></table>".$strings['Referrer'].":";Best regards,Daniel Geerts-----BEGIN PGP SIGNATURE-----Version: GnuPG/MacGPG2 v2.0.22 (Darwin)Comment: GPGTools - https://gpgtools.orgiQIcBAEBCgAGBQJVJPGzAAoJEHn1bVIKHk5N5egP/0FRgNCiTwYyFwmqgcNLxOQ5yuJtnGdGFvH0axXlvm+AgVYOtmM4erduSR3hCaSx4ER7f30SZkRCUuaW8aR1/TowbdYzLXNHcY21gXkhHt+bWH7ZkEpUWxXR6ZzrwL5QO3Ez+QkDr1HUmg8QQPUia8QkKGY+dbkRXqVR7MYRGjAbyceOEXpxpOtxaZ9UTSmQTGW31Upu+dmqkkOTbvV20tEjN07T4UwMffCGNWloeuXg8QvIlvwe22kV3+frA2qGxdWKHVl66iJAV0pQ+bxDgoxeY3JsYKdeIhB6T0Yt7rpEbzlgaupQ9pg279bzGVVD4Z+AuNhvDY/4K6RZsFB11DGveY4VR8KLyNuw5N/wLBGf9ZSL9dLBGatYxi0HoQtrmFqLppo1x6nhEV6A0gRulWRa9L04PdWKmv+2/prwW9ygT7UFIdApT1q3Uljq9QQIWmdDxGx3YxFmvMVpC5NThtxOElN8fhQpUKFss439qiLaGEMKO/D4bNC71Ydo6jvZOWQ+9eBxmMUT7XfK6fnB811cRTRON1SG73AWcbfpIJ/dM+g0jm6bcvVVQxNmaARdlf+E2ihXnMPU2k39ndfV/vqD7iuZQraH1ZrQJAqjVmzHWvEfEPyeaiJPRguu1kmnG8QkSMDtBHIpGvvHCHSU4ioF+wxMYqlgbfJGakc4s5RO=wCVy-----END PGP SIGNATURE-----Source: http://packetstorm.wowhacker.com/1504-exploits/phptraffica23-xss.txt Quote