PT-2012-52: Open Redirect in DokuWiki

(PT-2012-52) Positive Technologies Security Advisory
Open Redirect in DokuWiki

Vulnerable software

DokuWiki
Version: 2012-10-13 "Adora Belle" and earlier

Application link:
http://www.splitbrain.org/projects/dokuwiki

Severity level

Severity level: Medium
Impact: Open Redirect
Access Vector: Remote

CVSS v2:
Base Score: 5.0
Vector: (AV:N/AC:L/Au:N/C:N/I:P/A:N)

CVE: not assigned

Software description

DokuWiki is a simple to use Wiki aimed at the documentation needs of a small company. It works on plain text files and thus needs no database.

Vulnerability description

Positive Research Center experts have discovered an open redirect issue in /lib/exe/fetch.php. A legitimate query looks like as follows:

/lib/exe/fetch.php?media=http://i.imgur.com/IX1g8.jpg&hash=4fae2b

The "hash" parameter is meant to protect the web application from open redirect and is calculated as follows:

substr(md5(auth_cookiesalt().$media),0,6)

The value of auth_cookiesalt() cannot be accessed, however the "hash" parameter and first 6 characters of the resulting MD5 are incorrectly compared:

if(substr(md5(auth_cookiesalt().$media),0,6) != $_REQUEST['hash']){
  return array( 412, 'Precondition Failed');
}

Consider the case when an attacker consecutively sends requests like this:

/lib/exe/fetch.php?media=http://evilhost.com/?1&hash=0
/lib/exe/fetch.php?media=http://evilhost.com/?2&hash=0
...
/lib/exe/fetch.php?media=http://evilhost.com/?100&hash=0
...

Within a few thousand requests the first 6 characters of MD5 (e.g. 0e1234, 0e1337) will match 0 and, thus, the protection will be bypassed.

How to fix

Update your software up to the latest version.

Advisory status

22.10.2012 - Vendor gets vulnerability details
06.03.2013 - Vendor releases fixed version and details
19.03.2013 - Public disclosure

Credits

The vulnerability was discovered by Arseniy Reutov, Positive Research Center (Positive Technologies Company)

References

http://en.securitylab.ru/lab/PT-2012-52

Reports on the vulnerabilities previously discovered by Positive Research:

http://ptsecurity.com/research/advisory/
http://en.securitylab.ru/lab/

About Positive Technologies

Positive Technologies www.ptsecurity.com is among the key players in the IT security market in Russia.

The principal activities of the company include the development of integrated tools for information security monitoring (MaxPatrol); providing IT security consulting services and technical support; development of the Securitylab leading Russian information security portal.

Among the clients of Positive Technologies, there are more than 40 state enterprises, more than 50 banks and financial organizations, 20 telecommunication companies, more than 40 plant facilities, as well as IT, service and retail companies from Russia, the CIS countries, the Baltic States, China, Ecuador, Germany, Great Britain, Holland, Iran, Israel, Japan, Mexico, the Republic of South Africa, Thailand, Turkey, and the USA.

Positive Technologies is a team of highly skilled developers, advisers and experts with years of vast hands-on experience. The company specialists possess professional titles and certificates; they are the members of various international societies and are actively involved in the IT security field development.