Take the 2-minute tour ×
Information Security Stack Exchange is a question and answer site for Information security professionals. It's 100% free, no registration required.

My website has been hacked lately and it has been defaced. Now I have weird files, don't know where they coming from. I just want to know, what of these files are harmful or can cause that I get hacked again.

The .htaccess contains the following code:

<Files 403.shtml>
order allow,deny
allow from all
</Files>

deny from 121.54.58.159

The file .wysiwygPro_preview_eacf331f0ffc35d4b482f1d15a887d3b.php contains the following code:

// display the HTML code:
echo stripslashes($_POST['wproPreviewHTML']);

?>
share|improve this question
    
FWIW, someone on StackOverflow seems to be victim of a similar attack. stackoverflow.com/questions/23452892/… –  JakeGould May 4 at 5:36
add comment

5 Answers 5

up vote 15 down vote accepted

What is that?

The PHP file is a XSS backdoor. It allows the attacker to provide any HTML with JavaScript in the context of your side. This allows him access to cookies set by your side.

An attacker will trick a victim to do a POST request to that file with the malicious code in the wproPreviewHTML variable. If that user has special permissions on your side e. g. because he is logged in, the attacker will be able to do anything, that use can do.

The forbidden error may be suspicious, too. Some malicious software tries to hide in the error document. As the error documents are usually outside the document root folder for the normal web pages, there is quite a high chance for such modifications to be unnoticed.

What to do now?

You need to setup your server from scratch, as you cannot know the complete impact of the manipulation. It is likely that there is a backdoor hidden somewhere. Do not copy any program files (including scripts and php files) from the compromised server to the new one.

Further more there are some malicious programs for desktop computers, which manipulate php files during upload via FTP or SFTP.

share|improve this answer
    
can you provide more details on the backdoor? Is it intended to be malicious, or is it being improperly used? –  schroeder Dec 13 '11 at 16:17
2  
@schroeder, the XSS backdoor is malicious. The exploit tries to hide it as a programming mistake. But as this file is created by the attacker and has no other purpose at all, it is safe to assume, malicious intent. There is too little information on how the attacker got access to the server and what server level backdoors he left. –  Hendrik Brummermann Dec 13 '11 at 18:36
1  
While the wysiwygPro file is technically an XSS backdoor, most likely it's not something planted by the defacer, but a leftover from a cpanel in-browser file editor like @ChrisDavis noticed in his answer. It should be deleted though. –  Krzysztof Kotowicz Jan 3 '12 at 15:10
    
@KrzysztofKotowicz - I would trust Krzysztof Kotowicz view on the matter before somebody with 21 reputation points and a single answer on this site. –  Ramhound Jan 3 '12 at 15:53
add comment

Website been hacked? Follow this checklist:

  • Remove ALL files from the server and restore from a "known good" backup. If no such backup exists, reinstall from source and import only your data, not any of the program (e.g. PHP) files.
  • Change all your passwords. Including:

    • FTP password

    • Database passwords

    • site admin passwords.

  • Disable any unnecesary plugins, modules, etc.

  • Remove any unused software (e.g. that blog that you never use, or that database admin tool that you used only once)

  • Update all the web software you use (e.g. Joomla, wordpress, etc.) as well as any remaining plugins and modules to the very latest version.

  • Update your system software components to the latest version. (e.g. apt-get update && apt-get upgrade or yum update)

  • Enabling automatic updating where possible.

share|improve this answer
    
no reason to assume that restoring data is safe. e.g. stored xss vectors, or other malicious instructions could be present. –  Cheekysoft Dec 14 '11 at 15:23
    
@Cheekysoft true, however without the data you just have an empty site. Obviously if you can re-create the entire site from memory then that's preferable... but unlikely. –  tylerl Dec 14 '11 at 18:31
add comment

Strongly consider using operating system controls to provide an extra layer of control and auditing on top of your webserver.

Do also take the time to read all the answers on that question.

share|improve this answer
add comment

This file .wysiwygPro_preview_eacf331f0ffc35d4b482f1d15a887d3b.php is not a backdoor to be worried about. It is created by the cpanel file manager whenever you use the built in html editor in the file manager of cpanel.

The files should be deleted though if they are left behind by the editor.

share|improve this answer
1  
The content of that file, as posted by winona, contains a XSS vulnerability. Do you know if recent versions of that application still create that file? Might be a good idea to open a bug report with the vendor. –  Hendrik Brummermann Jan 3 '12 at 15:52
    
@Chris Davis - Do you have any evidence besides your word that this file isn't malicious? I wouldn't trust a user with so little reputation, and a clear inability to communicate, and provided no proof. If I had the reputation to downvote this answer I would. –  Ramhound Jan 3 '12 at 15:56
    
If created by cpanel that the user is using, that would be a relief in that it doesn't indicate the server was compromised. It is wrong to say that is nothing to be worried about even if it was created by legitimate software, however. That is an ugly piece 'o XSS harboring code. For that, my vote is currently +/- 0. –  Jeff Ferland Jan 3 '12 at 16:07
2  
According to the question, the website was defaced. So the system was compromised. I think it is a minor point, whether it was this vulnerability or another one, that the attacker used. And whether the file was created by insecure software or left by the attacker. But in the insecure-software-case, it will be a good idea to verify, if the issue still exists in the most recent version, and open a bug report. –  Hendrik Brummermann Jan 3 '12 at 16:29
1  
+1 - Tested on Hostgator with a newly created CPanel account, I'm have a reseller account so I could easily create and delete accounts. And by the way, there was also a .smileys folder with a bunch of icons that was created after I started the HTML editor. Nothing to worry about. –  Nabil Kadimi Jan 31 '13 at 22:20
show 3 more comments

As Chris Davis answered, the PHP file is not a malicious backdoor; it is created by the cPanel file manager WYSIWYG editor and it is extremely unlikely that the file has anything to do with the site being defaced.

This is not nearly as insecure as it looks in the original post. The file name is a long random string and another long random string needs to be passed to it to do anything. That string gets updated every time the editor saves. The rest of the file looks something like this:

<?php
if ($_GET['randomId'] != "AYEPENANR_zMBVyKHKQAYv6UF6nPMY5xV6iFIvaOQTTw0lLpE1O2SH0ZzoSfvUuY") {
    echo "Access Denied";
    exit();
}

// display the HTML code:
echo stripslashes($_POST['wproPreviewHTML']);

?>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.