UNION SQL Injections - A Cure All Once & For All
Date: Thursday, April 22 @ 23:47:05 CEST
Topic: Security


I've seen many examples to stop the UNION SQL Injections for PHP-Nuke. I've been quite the busy bee and unable to offer more than I already have in the past that have covered UNION injections, cross site scripting (XSS), admin.php IMG hacks, the list goes on. Well, I read from the staff tonight that sites are still getting hacked by kiddies using Base64 encoding. I'd like to offer a very beta single line of code that may resolve this issue once and for all. I ran some tests at one of the subdomains successfully using UNION, the base64 of UNION, and all the sql injection in base64. The single line of code stopped them all. [Note, it also covers all possible upper and lower case permutations.] Please note, that it works so well, it may be catching false positives. To help debug it, I need full reports. But if you want to be ultra cautious, it appears from testing this single line of code does the trick. So here it is pro bono:

Open mainfile.php and anywhere in the very beginning add the following code:

//Copyright Zhen-Xjell 2004 http://nukecops.com
//Beta Code to prevent UNION SQL Injections
if (preg_match("/([dnW5uIpb2N4VUJT0iO]{5})/", $_SERVER["QUERY_STRING"])) { die("YOU ARE SLAPPED BY <a href=\"http://nukecops.com\">NUKECOPS</a>"); }

As with anything else, I highly recommend you test it before applying it in production, also see the AUP.

ADMIN'S NOTE:If you are looking for this quality of protection, but still would like to use Raven's hack alert script so that you are notified, you can see an example of a hybrid here in the Nuke Security forum.





This article comes from NukeCops
http://www.nukecops.com

The URL for this story is:
http://www.nukecops.com/modules.php?name=News&file=article&sid=1969