Ethical Hacking

Learn to find vulnerabilities before the bad guys do! Gain real world hands on hacking experience in our state of the art hacking lab. Course designed and taught by expert instructors with years of penetration testing experience. 12 student maximum in every class. Certification attempt included in every package.
Computer Forensics Training at InfoSec Institute

Gain the in-demand skills of a certified computer examiner, learn to recover trace data left behind by fraud, theft, and cybercrime perpetrators. Discover the source of computer crime and abuse at your organization so that it never happens again. All of our class sizes are guaranteed to be 12 students or less to facilitate one-on-one interaction with one of our expert instructors.




Network Security Exploits-HackingTools
[Top] [All Lists]

[UNIX] TWiki Arbitrary Code Execution in Session Files

Subject: [UNIX] TWiki Arbitrary Code Execution in Session Files
Date: 11 Feb 2007 19:08:35 +0200
The following security advisory is sent to the securiteam mailing list, and can 
be found at the SecuriTeam web site: http://www.securiteam.com
- - promotion

The SecuriTeam alerts list - Free, Accurate, Independent.

Get your security news from a reliable source.
http://www.securiteam.com/mailinglist.html 

- - - - - - - - -



  TWiki Arbitrary Code Execution in Session Files
------------------------------------------------------------------------


SUMMARY

" <http://twiki.org/> TWiki - flexible, powerful, and easy to use 
enterprise collaboration platform and knowledge management system." Local 
users may cause TWiki to execute arbitrary code by creating CGI session 
files.

DETAILS

Vulnerable Systems:
 * TWiki version 4.1.0
 * TWiki version 4.0.0 up to version 4.0.5
 * Any previous TWiki version using SessionPlugin

Write access to global /tmp directory (or CGI session directory, if 
different). This can be either directly on file level (such as on a shared 
host), or via an HTTP vulnerability of a third party web application.

Under the assumption that an intruder has write access to the /tmp 
directory (or CGI session directory), such as with a vulnerability of 
another web application running on the same server, it is possible to 
execute arbitrary Perl code with the privileges of the web server process, 
such as user "nobody".

The TWiki SecurityTeam [2] triaged this issue as documented in 
TWikiSecurityAlertProcess [3] and assigned the following severity level:
* Severity 2 issue: The TWiki installation is compromised

CVE Information:
 <http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-0669> 
CVE-2007-0669

Your site may be vulnerable if:
   1. You run one of the vulnerable TWiki versions, and
   2. You have *not* reconfigured the CGI session directory 
$cfg{Sessions}{Dir} to a private directory

In particular, disabling the CGI session tracking via 
$cfg{UseClientSessions} is *not* sufficient to protect against this 
vulnerability, since there is session cleanup code that runs regardless of 
whether sessions are enabled or not.

 * Restrict access to the TWiki server on file level and HTTP.
 * If on a shared host, move TWiki to a dedicated host.
 * Upgrade to TWiki Release 4.1.1 [5] (recommended)
 * Apply a hotfix indicated below.

NOTE: The hotfix is known to prevent the current attacks, but it might not 
be a complete fix.

In configure, change $cfg{Sessions}{Dir} to a private directory (one which 
is only readable and writable by the user your web server is running as, 
and is not served as web content to remote users). The recommended fix is 
to make a $cfg{DataDir}/session_tmp directory owned by the user Apache is 
running as, change its permissions to 0700 (drwx------), and set 
$cfg{Sessions}{Dir} to that directory.

Upgrading to TWiki 4.1.1 is recommended; the session files are cleaned up 
by timestamp, i.e. no longer executed. TWiki 4.1.1 will create and use the 
/tmp/twiki directory by default to store the session files.

This section details the attack vectors, details, and countermeasures for 
this vulnerability as it applies to the SessionPlugin [6]. This section 
does not apply to TWiki versions 4.0 and up, which use built-in session 
tracking.

Vulnerable software version
 * Plugins.SessionPlugin 1.0 -- SessionPlugin.zip (attachment versions 
1-5)
 * Plugins.SessionPlugin 2.0-2.992 -- SessionPlugin.zip (attachment 
versions 6-8)

Attack Vectors
 * For SessionPlugin 1.000:
    * Write access to the $cfg{DataDir}/.session directory, which in some 
cases may be created world-writable for local users.
 * For SessionPlugin 2.0-2.992:
    * Write access to global /tmp directory.  This can be either directly 
on file level (such as shared host), or HTTP vulnerability of a third 
party web application.

Countermeasures
 * For SessionPlugin 1.000 (attachment versions 1-5 from the SessionPlugin 
topic):
    * Ensure that the $cfg{DataDir}/.session directory exists, is owned by 
the user Apache is running as, and has 0700 permissions (drwx------).
 * For SessionPlugin 2.9 (attachment versions 6-8 from the SessionPlugin 
topic):
    * Upgrade to Plugins.SessionPlugin 2.992 (attachment version 9 from 
the SessionPlugin topic).

Disclosure Timeline:
2007-01-28 - User discloses vulnerability to twiki-security
2007-01-29 - Developer verifies issue
2007-01-31 - Developer fixes code and creates hotfix
2007-02-05 - Security team creates advisory
2007-02-06 - Send alert to TWiki-Announce mailing list and TWiki-Dev 
mailing list
2007-02-08 - Publish advisory in Codev web and update all related topics
2007-02-08 - Issue a public security advisory

External Links:
[1]:  <http://twiki.org/cgi-bin/view/Codev/SecurityAlert-CVE-2007-0669> 
http://twiki.org/cgi-bin/view/Codev/SecurityAlert-CVE-2007-0669
[2]:  <http://twiki.org/cgi-bin/view/Codev/SecurityTeam> 
http://twiki.org/cgi-bin/view/Codev/SecurityTeam
[3]:  <http://twiki.org/cgi-bin/view/Codev/TWikiSecurityAlertProcess> 
http://twiki.org/cgi-bin/view/Codev/TWikiSecurityAlertProcess
[4]:  <http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-0669> 
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-0669
[5]:  <http://twiki.org/cgi-bin/view/Codev/DownloadTWiki> 
http://twiki.org/cgi-bin/view/Codev/DownloadTWiki
[6]:  <http://twiki.org/cgi-bin/view/Plugins/SessionPlugin> 
http://twiki.org/cgi-bin/view/Plugins/SessionPlugin


ADDITIONAL INFORMATION

The information has been provided by  <mailto:Peter@structuredwikis.com> 
Peter Thoeny.
The original article can be found at:  
<http://twiki.org/cgi-bin/view/Codev/SecurityAlert-CVE-2007-0669> 
http://twiki.org/cgi-bin/view/Codev/SecurityAlert-CVE-2007-0669



======================================== 


This bulletin is sent to members of the SecuriTeam mailing list. 
To unsubscribe from the list, send mail with an empty subject line and body to: 
list-unsubscribe@securiteam.com 
In order to subscribe to the mailing list, simply forward this email to: 
list-subscribe@securiteam.com 


==================== 
==================== 

DISCLAIMER: 
The information in this bulletin is provided "AS IS" without warranty of any 
kind. 
In no event shall we be liable for any damages whatsoever including direct, 
indirect, incidental, consequential, loss of business profits or special 
damages. 




<Prev in Thread] Current Thread [Next in Thread>
  • [UNIX] TWiki Arbitrary Code Execution in Session Files, SecuriTeam <=