Ticket #1097 (closed defect: fixed)
Multiple Security Vulnerabilities
| Reported by: | EgiX | Owned by: | BrianKoontz |
|---|---|---|---|
| Priority: | highest | Milestone: | 1.3.2-patches |
| Component: | unspecified | Version: | 1.3.2-p1 |
| Severity: | critical | Keywords: | |
| Cc: |
Description (last modified by BrianKoontz) (diff)
Hi, I've found some security flaws affecting the version 1.3.1 and 1.3.2.
The first is a SQL Injection here:
http://wush.net/trac/wikka/browser/trunk/actions/usersettings/usersettings.php#L136
When handling 'update' action, 'default_comment_display' is the only parameter that isn't sanitized with mysql_real_escape_string(), this can be exploited to inject arbitrary SQL code. Because of this is a multiple lines query and latest version of MySQL doesn't allow to start comment with /* no followed by a */, sometimes It's impossible to alter the 'users' table content for e.g. changing the admin's password, but is still possible to inject a subquery for fetch for e.g. the session id of admin for a Session Hijacking attack.
The second is an Arbitrary File Upload here:
http://wush.net/trac/wikka/browser/trunk/actions/files/files.php#L266
If 'INTRANET_MODE' is explicitly enabled or if an attacker conduct a successful Session Hijacking attack using the first vulnerability, It's possible to upload files that contains multiple extensions due to insufficient input sanitization at line 276. Now look at $allowed_extensions variable definition:
'gif|jpeg|jpg|jpe|png|doc|xls|csv|ppt|ppz|pps|pot|pdf|asc|txt|zip|gtar|gz|bz2|tar|rar|vpp|mpp|vsd|mm|htm|html'
It contains some extensions (e.g. mm, vpp...) that are rare to see in a MIME type Apache configuration setting. This could lead to execute arbitrary PHP code.
The last are Arbitrary File Download and Arbitrary File Deletion here:
http://wush.net/trac/wikka/browser/trunk/handlers/files.xml/files.xml.php#L53
The only input sanitization of the supplied filename is done at line 54, It checks if the filename start with a dot, if not filename is accepted. But an attacker could request an URL like this:
http://localhost/wikka/test/files.xml?action=download&file=/../../wikka.config.php
to download for e.g. the config file (note that 'test' is a page containing the {{files}} action, but attachments aren't required for download or delete arbitrary files).
Similarly, if an attacker conduct a successful Session Hijacking attack, he could request an URL like this to delete arbitrary files:
http://localhost/wikka/test?action=delete&file=/../../wikka.config.php
Regards,
EgiX
Related tickets
#1098 RCE and CSRF vulnerabilities