[ advisories | exploits | discussions | news | conventions | security tools | texts & papers ]
 main menu
- feedback
- advertising
- privacy
- FightAIDS
- newsletter
- news
- read forum
- new topic
- search

- meetings list
- recent additions
- add your info
 top 100 sites
- visit top sites
- sign up now
- members

- add your url
- add domain
- search box
- link to us

- our projects
- free email
 m4d network
- security software
- secureroot
- m4d.com
Home : Advisories : Security problems with TWIG webmail system

Title: Security problems with TWIG webmail system
Released by: Joao Gouveia
Date: 27th November 2000
Printable version: Click here
Twig is a popular webmail system written in PHP,  once called Muppet.

Author: Christopher Heschong

Homepage: http://twig.screwdriver.net

Version: 2.5.1 ( latest )

Problem: The possibility of processing our own php file , can leed to

arbitrary command execution on the server as the httpd user.

Status: Author(s) warned on 2000-11-13, the fix ( AFAIK ) will be included

on the next version.


Twig is designed to allow the use of virtual hosting, unfortunatly the

script that checks this fails to check for user suplied input, thus allowing

anyone to submit malicious values as the configuration directory.

The faulty piece of code is ( in index.php3 ):

// Allow for virtual hosting

 $config_dir = "config";

 if( $vhosts[$SERVER_NAME] )

    $config_dir = $vhosts[$SERVER_NAME];

    include( $config_dir . "/config.inc.php3" );

    include( $config_dir . "/images.inc.php3" );


If the vhosts "directive" is not initialized, It is trivial to exploit it.

Let's look at an example:

1. I create a config.inc.php3 script with "  " in it, and

upload it to some free web hosting service machine.

2. I go to the vulnerable site using Twig and type in my browser:



3. The script gladdly includes _my_ config.inc.php3 and executes it,

presenting me with the phpinfo relative to the vulnerable site.

You can surely imagine this danger, for example if the vulnerable site

has safe_mode disable, I could just use a system($string) to execute

arbitrary comands as the http user.

Even if safe mode is enabled, it's still possible to execute our code, for

things like revealing the source of php files, whitch may contain sensitive

data in it.

Note: this only works if our free web hosting doesn't process the php3 file.

Best regards,

Joao Gouveia aka Tharbad.

(C) 1999-2000 All rights reserved.