The anti-spam plugins have stopped being effective. Registration is back to requiring approval. After registering, you must ALSO email me with your username, so that I can manually approve your account.

Main Menu


Started by Miluette, June 20, 2009, 05:10:07 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


HEY, so suddenly I found out that every PHP file I have uploaded throughout all my sites has had something like this appended to the top of the file:


I reinstalled my Wordpress installs and am reuploading everything else. I found this out when suddenly files I was uploading were smaller than live files, and when someone pointed out that all the text on my sites looked like spam text on his phone browser. :[

How do you think this happened? I still gotta fix my oekaki and news files too, gah.
Arggh, and my forum too. Can you have SMF forums auto-reinstall like Wordpress? (Well, I just updated it 1.1.9, but there're still some old hacked files.)

Gah, even my plugins are haxed. D:

EDIT: Okay, I reuploaded everything but my plugins and forum themes. Guh.

Someone's explaining how this could have happened: "shared server php upload and/or append hack" Just when I thought I never had to worry about permissions!
He says the hack may be this:
And looks like this decoded: or something
If that helps.

Actually, looking more closely at that, it mentions the directory of a forum theme I wasn't even using and thought I had deleted. I bet one of the forum accounts that signed up but never posted did this. e__e

Note that I think this happened on the 15th and again on the 17th, since that's when all my files were modified on the server despite my having not touched them in ages.
And wasn't it you who told me,
"The sun would always chase the day"?


Well, due to the way the server is set up, and provided you hadn't changed the permissions on any files to be world writable (chmod 777, which you should NEVER need to do here) the hack had to have come from an exploit on your own site. Most likely wordpress or another similar PHP package. This sort of thing is VERY common. I see it all the time at work, and it's the reason I've designed the server's systems in the way I have, so that if one account gets exploited, the exploit shouldn't be able to affect anyone else.

Now, as to fixing it... I do make nightly backups of everything in all accounts, so I can revert your files to the day before the hack if you want. At that point you can proceed to upgrade everything and try to secure it. I don't know if it will break stuff in wordpress since you've already upgraded the database possibly.

I see dozens of exploit attempts in the logs (which isn't surprising) and specifically these from the 15th - - [15/Jun/2009:03:39:03 +0000] "GET /index.php?action= HTTP/1.1" 200 29380 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)" - - [15/Jun/2009:12:54:14 +0000] "GET /index2.php?page= HTTP/1.1" 200 20875 "-" "libwww-perl/5.76" - - [15/Jun/2009:18:48:33 +0000] "GET /index.php?board= HTTP/1.1" 200 29379 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)"

Now, because of the way you have rewrites set up, that could've been the root of any one of your sites. Basically, they're trying to trick the code into loading the remote code in the URL they give.

Anyway, let me know if you want me to restore backups of anything. I can put it in a separate folder to let you pick through things if you want. Also, you'll want to make sure to login to and change your password, as any hack that can change your PHP files could possibly have read your database password from the configuration for a forum or wordpress, etc.


Okay, I just checked. It looks like huge amounts of your files are world and group writable. So the exploit could theoretically be on someone else's site, but only infected yours because that's all it could write to. It's very important NOT to chmod 777 anything. In fact, files should always be 600, and directories 700. I've reset all the files in your public_html folder for you.


Here's a list of files that are still infected...


All found with

find -iname "*.php" -exec fgrep 'eval(base64' -l \{\} \;


Thank you! I never manually change any of my files' permissions - except a few days ago I DID chmod a folder to 777, which only had some thumbnail files in it, and probably forgot to change it back to 700. 'Zat bad? D:

It's possible that some of my files were still world and group writable from waaay before the server upgrade, back when I had to fix permissions for my PHP files after uploading them, or something. (Actually, maybe not. I've changed pretty much everything since then.) But I know most of them were 700, and all of them were affected, lol. So you reset aaaall the sites' permissions? Yay! All should be well if I just upload things and leave them alone, then?

And yeah, don't revert anything. I did a good bit of unrelated modding after trying to undo this hack last night (and since the 15th, even), and I can't specifically remember what I'd need to redo, lol...

When I change my password, will all my database-based things break until I edit their config files?
And wasn't it you who told me,
"The sun would always chase the day"?


Xepher, can't you just change the permissions for the user home directories to help prevent this from other infected sites in the future?
(\_/)    ~Relakuyae D'Selemae
(")_(")  [Libre Office] [Chrome]


I have changed them so that everything is 700, and the default is 700. However, a lot of CMS install instructions say "chmod 777 this file..." or some such. Nothing should EVER make stuff world writable, yet I always find files set that way.

This particular hack does look to have come from her own site though. I searched and no other php files on the system (despite many being world writable again) were infected with the same code.

Still though, if you have a suggestion for how to make things more secure, let me know.


Yeah, some things instruct you to chmod files to 775 or 777 or something and I never do that 'cause there's no reason to. Everything still works even if you don't. \o/ (I hope. Don't wanna mess with my oekaki or anything anymore, not like that.)

Hey, hey, "When I change my password, will all my database-based things break until I edit their config files?" I need to know how quickly I'll need to edit everything else so that they work.
And wasn't it you who told me,
"The sun would always chase the day"?


Oh, sorry, forgot to answer that. FYI, always feel free to hit me up on AIM/YahooIM/Gtalk... my screen name is "Xepher42".

To answer you though, yes, changing your password means you need to change it in the configs for all applications that access your database.


It always looks like you have your away message on, lol. Unless you're actually not away all that time... :O
And wasn't it you who told me,
"The sun would always chase the day"?


He does almost always have his away message up, but hit him up anyhow. Even if he doesn't respond right away he tends to "get back to you". ;)
(\_/)    ~Relakuyae D'Selemae
(")_(")  [Libre Office] [Chrome]


Yeah, I work nights, so I'm only on at like 9am for an hour or two until my weekends (sun-tue). Like data said, leave a message. And I'll see it next time I'm on.


I've been meaning to ask if you can check if there're any infected files left. I think I already took care of all of 'em, but I may have missed one.

In recent times I've found out that people in general, and some webcomics, have been hacked with a bunch of variations of this kind of attack...a lot. And the hacks I've heard of were a lot worse than replacing all the text with spammy gibberish, too. *shudder*
And wasn't it you who told me,
"The sun would always chase the day"?


Nothing left with that same hack in it.


And wasn't it you who told me,
"The sun would always chase the day"?