bugtraq
[Top] [All Lists]

Re: Critical phpwiki c99shell exploit

To: bugtraq@securityfocus.com, "rurban@x-ray.at" <rurban@x-ray.at>
Subject: Re: Critical phpwiki c99shell exploit
From: "Jamie Riden" <jamie.riden@gmail.com>
Date: Thu, 12 Apr 2007 17:59:25 +0100
Delivered-to: sp-com-lists@consult.net
Delivered-to: bugtraq-list@securepoint.com
Delivered-to: mailing list bugtraq@securityfocus.com
Delivered-to: moderator for bugtraq@securityfocus.com
Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=tNjDRsEQJrxVFAFW33YlDampsVhgxD9SvhOoDBpLSEvtmHGHImCIpW9vKNmjbozgrdkXYPXtdhlYElYpziHXy6M1nIIKqThVu2Nbu+IrvSiEzVin7lkULCZ/uOOOt6NNFeady3E5rsv7Oa37/cFiQDzmKPYws62It282s7n6yiw=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=jRqXsuf3uBm+t39T0eDBxdOQ+75nDp4zLLxHPU/wnlAh+9ngs7JsVzI8bUK/xttAzv4hANo9iSbUIywUWy8VNzlHHtz13yPPy4hTq9KyTOfl0A/K1MyZVjGoZJmIrbIIk1vvf4hQj57XW9RUoxq2AyeSNhCvmxq7K5VATQ31Oyc=
In-reply-to: <20070412131414.17191.qmail@securityfocus.com>
List-help: <mailto:bugtraq-help@securityfocus.com>
List-id: <bugtraq.list-id.securityfocus.com>
List-post: <mailto:bugtraq@securityfocus.com>
List-subscribe: <mailto:bugtraq-subscribe@securityfocus.com>
List-unsubscribe: <mailto:bugtraq-unsubscribe@securityfocus.com>
Mailing-list: contact bugtraq-help@securityfocus.com; run by ezmlm
References: <20070412131414.17191.qmail@securityfocus.com>
On 12 Apr 2007 13:14:14 -0000, rurban@x-ray.at <rurban@x-ray.at> wrote:
Via the Phpwiki 1.3.x UpLoad feature some hackers from russia uploaded a php3 
or php4 file,
install a backdoor at port 8081 and have access to your whole disc and overtake 
the server.

A url in the file is http://ccteam.ru/releases/c99shell

The uploaded file has a php, php3 or php4 extension and looks like a gif to the 
mime magic.
So apache usually accepts it.

To fix this phpwiki issue at first move the lib/plugin/UpLoad.php file out of 
this directory.

You can fix it by adding those two lines to your list of disallowed extensions:
  php3
  php4
Currently only "php" is disallowed.

Some people also map .php5 - google for "AddType
application/x-httpd-php5 .php5" and "AddType application/x-httpd-php
.php5" - and goodness knows what else.

This would be much better re-written to use known safe extensions, or
the admin needs to carefully compare the disallowed list against
his/her httpd config.

(If there's anyone who doesn't know c99shell, it's sort of a helper
app for doing things on servers - the kind of things you probably
don't want done - and is often used in conjunction with remote file
include attacks to execute shell commands. There's a screenshot in
Appendix B at http://www.honeynet.org/papers/webapp/ . "Defacing Tool
2.0 by r3v3ng4ns" and r57shell are similar utilities you may have come
across.)

cheers,
Jamie

PS. I can't see where it checks if the file is a GIF, but it's not
hard to fool some programs, and I don't like the idea of guessing file
types based on contents. It's not safe.

== foo.php ==
GIF89a!^@"^@
<?php
 echo "foo";
?>
===========

$ file foo.php
foo.php: GIF image data, version 89a, 33 x 34

The output of visiting http://localhost/foo.php under apache is
'GIF89a!�"� foo'.
--
Jamie Riden / jamesr@europe.com / jamie@honeynet.org.uk
UK Honeynet Project: http://www.ukhoneynet.org/
<Prev in Thread] Current Thread [Next in Thread>