LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > General > HTTP:Iframe Infection Fix

Reply
 
Thread Tools Display Modes
  #1  
Old 06-24-2009, 08:46 AM
grniyce grniyce is offline
Senior Member
 
Join Date: Jan 2009
Posts: 52
Default HTTP:Iframe Infection Fix

There is a new onslaught of attacks again using the HTTP:Iframe injection method. I found one of the tools and you can see below how easily people are able to perform this method of attack to servers that do not have at least the default mod security rules applied to their server.



If you find yourself or a client on your server in a situation where this attack has infiltrated their space, 99% of the time the injection is performed on htm / html files. Although the bash script below is not guaranteed to work 100% of the time, it should work fine to remove all of the files you specify within the script.

For example: In the case that the below script was used, the client had a vBulletin board and did not need any html / htm files within his directory. They were all php files, so by removing all of the htm / html files it resolved the infection. Following removal their cPanel and all FTP passwords were changed.

find /home/username -type f -name \*.htm\* -ls -exec rm -vf {} \;

If you don't know what you are doing, please ask a question and someone will reply within this thread. Don't go deleting a whole bunch of files and then complain later. Make sure you know what needs to be done if the above scenario does not apply to you.
Reply With Quote
  #2  
Old 06-24-2009, 08:58 AM
grniyce grniyce is offline
Senior Member
 
Join Date: Jan 2009
Posts: 52
Follow Up: ClamAV will remove the infection, but it will not prevent it, so users should make sure to scan their home dir occasionally.
Reply With Quote
  #3  
Old 06-24-2009, 09:02 AM
grniyce grniyce is offline
Senior Member
 
Join Date: Jan 2009
Posts: 52
Scan the home directories and throw the results in an output file.

for i in `awk `!/nobody/{print $2}' /etc/userdomains | sort | uniq`; do; /usr/bin/clamscan -i -r /home/$i; done; >> /root/infection

Now this is better to run in screen as on larger systems the scan can continue even after you have logged out. The user can simply check /root/infection for the results.

Note:
the "-i" switch for clamscan simply says to print results of infected files only the "-r" switch for clamscan simply says to scan recursively.

The results will look similar to the following:

/home/ahazygc/public_html/vb/cpstyles/vBulletin_MS_Sans/index.html:
HTML.Iframe-32 FOUND

etc...

You can use these switches to remove, move, or copy the infected files;

--remove[=yes/no(*)] Remove infected files. Be careful!
--move=DIRECTORY Move infected files into DIRECTORY
--copy=DIRECTORY Copy infected files into DIRECTORY
Reply With Quote
  #4  
Old 06-24-2009, 01:05 PM
anewday anewday is offline
Senior Member
 
Join Date: Nov 2007
Location: New York
Posts: 723
What's the mod_security 1.x rule to prevent this?
Reply With Quote
  #5  
Old 06-24-2009, 02:03 PM
grniyce grniyce is offline
Senior Member
 
Join Date: Jan 2009
Posts: 52
Please see this link for the rule definition(s). You can either include the rule manually by editing the lines in your default rules, or add the files to an existing custom rules directory.

http://www.gotroot.com/tiki-read_art...?articleId=278
Reply With Quote
  #6  
Old 06-24-2009, 02:33 PM
anewday anewday is offline
Senior Member
 
Join Date: Nov 2007
Location: New York
Posts: 723
It doesn't tell the rules on that link above.
Reply With Quote
  #7  
Old 06-24-2009, 02:37 PM
grniyce grniyce is offline
Senior Member
 
Join Date: Jan 2009
Posts: 52
I am creating a new thread with the exact steps to apply the default mod_security and ASL mod_security rules effectively to probably 90% of the servers that exist, and I will then post that redirected link here in about 15 minutes.
Reply With Quote
  #8  
Old 06-24-2009, 02:52 PM
grniyce grniyce is offline
Senior Member
 
Join Date: Jan 2009
Posts: 52
To learn more about mod_security rules, including the HTML:IFRAME DOS INJECTION filtering and automatic removal go here:

http://www.litespeedtech.com/support...5707#post15707
Reply With Quote
  #9  
Old 06-24-2009, 03:27 PM
anewday anewday is offline
Senior Member
 
Join Date: Nov 2007
Location: New York
Posts: 723
Thanks, I just need the rule to protect iframe. I couldn't find it in the zip file. Could you paste it here?
Reply With Quote
  #10  
Old 06-24-2009, 04:37 PM
grniyce grniyce is offline
Senior Member
 
Join Date: Jan 2009
Posts: 52
Code:
SecRule REQUEST_BODY|ARGS "< ?font style ?= ?(position ?\: ?absolute|overflow ?\: ?(?:hidden|auto)).*(?:height|width) ?(?:=|\:) ?[0-9] ?(px|\;)" \
        "t:replaceNulls,t:htmlEntityDecode,t:urlDecodeUni,t:compressWhiteSpace,t:lowercase,id:300056,rev:1,severity:2,msg:'Spam: Hidden Text Exploit'"
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 03:37 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.