High-Tech Bridge SA Security Research Lab has discovered multiple vulnerabilities in Open Journal Systems which can be exploited to manipulate local files, upload arbitrary files and perform Cross-Site Scripting (XSS) attacks.1) Arbitrary File Manipulation in Open Journal Systems: CVE-2012-14671.1 Arbitrary File Deletion Input passed via the "param" parameter to "/lib/pkp/lib/tinymce/jscripts/tiny_mce/plugins/ibrowser/scripts/rfiles.php" is not properly validated before being used in unlink() function. This can be exploited to delete arbitrary files via directory traversal sequences. The vulnerability exists in "iBrowser" software component that is a built-in part of OJS 2.3.6 by default. The following PoC (Proof-of-Concept) code is available:http://[host]/lib/pkp/lib/tinymce/jscripts/tiny_mce/plugins/ibrowser/scripts/rfi les.php?lang=en&param=delete|/../../../../../../../../../../../../../../../../.. /../../temp/file_to_delete

1.2 Arbitrary File Renaming Input passed via the "param" parameter to "/lib/pkp/lib/tinymce/jscripts/tiny_mce/plugins/ibrowser/scripts/rfiles.php" is not properly validated before being used in rename() function.This can be exploited to rename and assign an arbitrary extension to files on the vulnerable system via directory traversal sequences, that can lead to arbitrary PHP code execution (if permitted by server configuration). The vulnerability exists in "iBrowser" software component that is a built-in part of OJS 2.3.6 by default. This PoC will rename a previously uploaded ".jpg" file to ".php" file using the null-byte technique:http://[host]/lib/pkp/lib/tinymce/jscripts/tiny_mce/plugins/ibrowser/scripts/rfi les.php?lang=en&param=rename|file.jpg|file.php%00.jpgFile upload is available by default to registered users. Registration is also enabled by default.The second PoC will move "file_to_move" to "1x.jpg" in uploads directory via directory traversal technique:http://[host]/lib/pkp/lib/tinymce/jscripts/tiny_mce/plugins/ibrowser/scripts/rfi les.php?lang=en&param=rename|/../../../../../../../../../../../../../../../../.. /../../tmp/file_to_move|1x.jpg

2) Arbitrary File Upload in Open Journal Systems: CVE-2012-1468Open Journal Systems does not properly verify malicious file extensions before upload, which may lead to arbitrary file upload and further arbitrary PHP code execution (if permitted by server configuration). Upper-register file extensions are not filtered (e.g. ".pHp"), as well as some potentially malicious file extensions (e.g. ".asp", ".cgi", ".html").The following PoC code demonstrates exploitation of the vulnerability:Malicious registered user shall start a new Submission:http://[host]/index.php/[journal]/author/submit/1 on the second step of the Submission:http://[host]/index.php/[journal]/author/submit/2?articleId=14 the user should upload test.pHp, test.asp, test.cgi, test.php3 or test.html file. The uploaded file will be available on the following URL:http://[host]/files/journals/[journalid]/articles/[articleid]/submission/origina l/[newfilename] The original file name will be changed, however it will be displayed to the user after upload (for example "16-28-1-SM.pHp"). File extension will remain the same.Successful exploitation of this vulnerability requires the attacker to be registered and have "Author Role". Registration is enabled by default. Registered user is allowed to assign "Author Role" to himself by default. Upload directory should also be located inside of web root (by default).

3) Multiple XSS in Open Journal Systems: CVE-2012-14693.1 Input passed via the "editor" and "callback" parameters to "/lib/pkp/lib/tinymce/jscripts/tiny_mce/plugins/ibrowser/ibrowser.php" script is not properly sanitised before being returned to the user. This can be exploited to execute arbitrary HTML and script code in user's browser session in the context of the affected website. The vulnerability exists in "iBrowser" software component that is a built-in part of OJS 2.3.6 by default. The following PoC codes are available:http://[host]/lib/pkp/lib/tinymce/jscripts/tiny_mce/plugins/ibrowser/ibrowser.ph p?editor=z&callback=x;};};alert%2834%29;{{&lang=enhttp://[host]/lib/pkp/lib/ tinymce/jscripts/tiny_mce/plugins/ibrowser/ibrowser.php?editor=%27%29;};};alert% 2834%29;{{a=x%28%27&callback=iBrowser_callback&lang=en

3.2 Input passed via the "URL" parameter to "index.php" script is not properly sanitised before being stored in the application's database. This lead to stored XSS vulnerability. The following PoC code demonstrates the vulnerability:On the submissions page URL:http://[host]/index.php/[journal]/author/submit/3?articleId=[id] the attacker should add a malicious code to the "URL" field:"><script>alert(document.cookie)</script> the XSS will be displayed here:http://[host]/index.php/[submission]/author/submission/[id]

3.3 Method "String::stripUnsafeHtml()" in "/lib/pkp/classes/core/String.inc.php" that is used to sanitise user-supplied input does not sanitise user input properly. This lead to numerous stored XSSs in scripts where this method is used.The following PoC demonstrates vulnerability exploitation:On the following URL:http://[host]/index.php/[journal]/author/submit/3?articleId=[id] the attacker should inject malicious scripting code to the "Bio Statement" or "Abstract of Submission" fields:<img src="x"/onerror=alert(document.cookie)> or (browser specific):<img style="width:expression(alert(document.cookie));"></a> The stored XSS will be displayed here:http://[host]/index.php/[submission]/author/submission/[id]Successful exploitation of the 3.2 and 3.3 vulnerabilities requires the attacker to be registered and have "Author Role". Registration is enabled by default. Registered user is allowed to assign "Author Role" to himself by default.

Solution:

Upgrade to OJS 2.3.7

More Information: http://pkp.sfu.ca/support/forum/viewtopic.php?f=2&t=8431

References:

[1] High-Tech Bridge Advisory HTB23079 - https://www.htbridge.com/advisory/HTB23079 - Multiple vulnerabilities in Open Journal Systems (OJS). [2] Open Journal Systems - http://pkp.sfu.ca/?q=ojs - Open Journal Systems (OJS) is a journal management and publishing system that has been developed by the Public Knowledge Project through its federally funded efforts to expand and improve access to research. [3] Common Vulnerabilities and Exposures (CVE) - http://cve.mitre.org/ - international in scope and free for public use, CVE® is a dictionary of publicly known information security vulnerabilities and exposures. [4] Common Weakness Enumeration (CWE) - http://cwe.mitre.org - targeted to developers and security practitioners, CWE is a formal list of software weakness types.

Have additional information to submit? Please feel free to send us any additional information related to this Advisory, such as vulnerable versions, additional exploitation details and conditions, patches and other relevant details.