Operating System - Linux
1829511 Members
1719 Online
109991 Solutions
New Discussion

What are you doing about the Linux worm?

 
Steven E. Protter
Exalted Contributor

What are you doing about the Linux worm?

http://lwn.net/Articles/159044/
http://news.zdnet.com/2100-1009_22-5938475.html

http://dw.com.com/redir?destUrl=http%3A%2F%2Fvil.nai.com%2Fvil%2Fcontent%2Fv_136821.htm&siteId=22&oId=2100-1009-5938475&ontId=1009&lop=nl.ex

http://dw.com.com/redir?destUrl=http%3A%2F%2Fwww.symantec.com%2Favcenter%2Fvenc%2Fdata%2Flinux.plupii.html&siteId=22&oId=2100-1009-5938475&ontId=1009&lop=nl.ex

There is in the third link a symptom checklist. I've checked the machines I'm responsible for and found nothing.

More touchy is the idea of trying to figure out what modules php and such are being used on these servers and how to detect and correct.

The purpose of this thread is dual.

1) To notify the Linux community here of the issue.
2) To get a method to at least detect the vulnerable scripts so Programmers can be assigned to fix them. If I'm lucky a solution will be presented.

You get 2 Linux points for posting "Thanks for the warning" and such.
You get 8-10 points if you help me figure out if I'm running any vulnerable scripts.

The ratings organization rates the threat level as low. Internally here we rate the threat higher and want to verify unvulnerbility, not just lack of symptoms.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
11 REPLIES 11
Luk Vandenbussche
Honored Contributor

Re: What are you doing about the Linux worm?

Hi Sep,

I am not a specialist in this solution, but I want to keep in touch of the evolution
Van den Broeck Tijl
Valued Contributor

Re: What are you doing about the Linux worm?

As advised in some of the bugtraq advisories about it a first step must ofcourse be to close the posts in question (if that hasn't happend yet).

Then make sure that you're running the latest versions of PHP, Awstats and other scripts that were reported vulnerable.


But writing a script to check your homecooked perl applications would require as much time as auditing them manually I'm affraid.

A better way of prevention is to push your programmers to sanitise all var's before processing system or open cmds and such, as it's nothing more than adding a line with =~ I think they ought to be willing to do that.
Vernon Brown_4
Trusted Contributor

Re: What are you doing about the Linux worm?

Thanks for the heads up !!

I'm putting together some phpBB2 forums that use php, mysql, and Apache. The phpBB support site is full of help requests that begin with "I've been hacked"

From the info you've linked to it seems that a good indicator for this worm might be unusual things showing up in /tmp.
Steven E. Protter
Exalted Contributor

Re: What are you doing about the Linux worm?

Thanks Vernon,

We're putting some more internal resources here into the mix. We're checking with our security department and since our primary issue may be PHP we may have people in other offices that actually know PHP.

I work with PHP such as squirrelmail and mysql access and such, but really only thinker around copy and change.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Ivan Ferreira
Honored Contributor

Re: What are you doing about the Linux worm?

Besides all recomendations above, I would configure tripwire to keep eyes on the web server files.

You can also obtain a checksum of the files just in case with the md5sum command and compare it after with the output file generated using the -c option.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Ralph Grothe
Honored Contributor

Re: What are you doing about the Linux worm?

Hi SEP,

I haven't done much in PHP (saw no need to move from Perl), so I haven't given too much attention to PHP perils.
I think to have heard that a common source of evil in PHP scripts was the auto import of (referring to) global variables (e.g. CGI parameter parsing).
There was a unique setting in php.ini to disable this "feature", but at the cost of rendering many poorly written PHP scripts unexecutable, and forcing coders to rewrite them (probably it's this laziness that makes so many websites susceptible to such worm attacks)
But I think for any "bullet proof" server side scripting/programming, no matter in what language, the same common sense guidelines apply.
As for Perl I can easily repeat them here.

- NEVER trust any client input
(which leads directly to the next premise)

- ALWAYS enforce taint checking
(i.e. treating any client input before further processing, especially stripping off shell meta chars, sql injection, best restricting an allowable char set)

- DISABLE autogeneration of globally scoped vars (in Perl terms this means "use strict"),
in fact there is almost never any need for global vars

- AVOID invocation of external commands
(e.g usage of system(), backticks)
Instead use the language's built-in
system commands (this is also more efficient)
If you cannot avoid them, do use exec() after a complete fork() and prior cleansing of the child's environment and other possibly tainted storage.

- DO use well established and tested modules/toolkits,
so don't write your own CGI parser
(in Perl do use CGI.pm)

These are just a few rules that came immediately to my mind.

Because there was so much widespread usage of rotten Perl code the advocators of Perl felt real concern for the language's reputation that they started this project to substitute this "idiotic Perl" code:

http://www.mag-sol.com/talks/idiotic/

The bugtraq you cited addresses XML-RPC.
XML-RPC or SOAP code has to be treated with the same sort of precautions as any CGI code.
In fact XMLRPC or SOAP can even cause greater harm to your system if your SOAP server runs with higher privileges than the webservers' startup scripts automatically take care to restrict.
Also note that SOAP and XMLRPC is plain XML (mostly) over HTTP (though even FTP or SMTP could be used as for SOAP) which most firewalls let pass unhindered.
Perl toolkits such as SOAP::Light (which also contains as a subset XMLRPC) let the coders subclass its methods to implement strong authentication and encryption.
The same must be true for PHP.
But of course this demands more labour from the web service programmer.
Madness, thy name is system administration
James Ruddell
Occasional Contributor

Re: What are you doing about the Linux worm?

Thanks for the info. I'm in charge of AV for Windows and have about 10 Linux servers in production so this concerns me.
Steven E. Protter
Exalted Contributor

Re: What are you doing about the Linux worm?

In spite of the low rating given, this is a high priority issue.

There has to be a way to check php scripts for this problem.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
dirk dierickx
Honored Contributor

Re: What are you doing about the Linux worm?

1. most vendors have updated php packages out, install them!

2. if you are running SELinux on Ferdora or RH you should be protected from this worm.
Bill Thorsteinson
Honored Contributor

Re: What are you doing about the Linux worm?

Consider the following preventives.

Don't let the web server uid write anywhere
that isn't globally writable. At least limit its ability to write. Web content
owner uid should be different than
the webserver uid.

If possible, use ACLs on world writeable
areas to prevent the web server uid from
writing there.

IF possible, mount /tmp, and any other
partitions the web server can write to
noexec. Consider nodev, and nosuid for
these partitions.

Ditto to all the Taint checking above.

Avoid SQL injection by building
parameterized SQL. All user input to SQL should be as parameters to this SQL.
Never build SQL statements contianing
user input as part of the query.
Steven E. Protter
Exalted Contributor

Re: What are you doing about the Linux worm?

RH AS 2.1 httpd server 1.3.xx

PHP is custom written I belive.

I know its old.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com