Full Disclosure mailing list archives

KeyPass Password Safe v1.22 - Software Filter Vulnerability


From: Research <research () vulnerability-lab com>
Date: Tue, 17 Jul 2012 05:39:01 +0200

Title:
======
KeyPass Password Safe v1.22 - Software Filter Vulnerability


Date:
=====
2012-06-26


References:
===========
http://www.vulnerability-lab.com/get_content.php?id=615


VL-ID:
=====
615


Common Vulnerability Scoring System:
====================================
3


Introduction:
=============
KeePass is a very famous & free open source password manager, which helps you to manage your passwords in a secure way. 
You can put all your passwords in one database, which is locked with one master key or a key file. So you 
only have to remember one single master password or select the key file to unlock the whole database. 
The databases are encrypted using the best and most secure encryption algorithms currently known (AES and Twofish).

(Copy of the Vendor Homepage: http://keepass.info )


Abstract:
=========
The Vulnerability Laboratory Research Team discovered a software filter & validation vulnerability in the KeyPass 
Password Manager v1.22 & older versions.


Report-Timeline:
================
2012-06-13:     Researcher Notification & Coordination
2012-06-14:     Vendor Notification
2012-06-20:     Vendor Response/Feedback
2012-06-26:     Public or Non-Public Disclosure
2012-07-01:     Vendor Fix/Patch


Status:
========
Published


Affected Products:
==================
Domenic Reichl
Product: Keypass Password Safe v1.22 & older versions


Exploitation-Technique:
=======================
Remote


Severity:
=========
Medium


Details:
========
A software filter & validation vulnerability is detected in the KeyPass Password Manager v1.22 & older versions.
The bug allows an attacker (local) to implement/inject malicious script code when processing to export a manipulated
KeyPass Password Manager database. The vulnerability is located in the validation of the html/xml export 
function/module & the bound vulnerable domain/url (listing) parameter. URLs of entries are embedded in the exported 
HTML file without encoding XML special characters, when the URL (domain) field of an entry contains a malicious script 
code, this will be executed when the exported HTML file is opened in a browser.

Exploitation of the vulnerabilitiy requires a manipulated url with malicious script code, a logging server with chmod 
777, a 
listing file (random) & an keypass v1.22 user. The bug will be injected on the local way, affects the local validation 
(html/xml) 
and change the technic back when remote transfering the password lists. The injection of the malicious url/domain 
context can be 
done via import (victim) or manually (reproduce)by including. Successful exploitation of the vulnerability lead to 
stable (persistent) 
context manipulation, persistent phishing, execution of malware or stealing plain password lists. Medium user inter 
action is required 
to exploit the vulnerability.

Normally KeyPass Password Manager exports the html backup with a secure clean template like ...

<th>URL</th><th>Password</th><th>Notes</th><th>UUID</th><th>Icon</th><th>Creation Time</th><th>Last Access</th>
<th>Last Modification</th><th>Expires</th><th>Attachment Description</th><th>Attachment</th></tr>
<tr><td>mypass category</td><td>my keypass test</td><td>asdfas</td><td>asd</td>


The local attacker manipulate the database with malicious strings (script code) in the category item profile name input 
fields.
KeyPass Password Manager generates the clean html template but after the persistent script code inject in the database
profile domain/url item, the persistent code is getting executed direct out the clean exported html template file.

<tr class=``MyAccountNameRow``>
 <td align=``right`` width=``150px``>Name des Benutzerkontos: </td>
 <td><b>``><[PERSISTENT SCRIPT CODE]`) <<=`` b=``></td>
</tr>



Vulnerable Section(s):
                                [+] Export

Vulnerable Module(s):
                                [+] HTML - XML 

Vulnerable Parameter(s):
                                [+] URL (Domain)


Proof of Concept:
=================
The persistent script code inject & execution can only be exploited by local attackers. For demonstration or reproduce 
...


Exploitation Scenario:
Attacker is sending the victim a manipulated login page with script code in the url parameters. The script code impacts 
an easy html or js script which responds to a url with chmod 777 (other server) to exchange of the file when processing 
a local request. The victim with keypass save the url or imports it via module (backup, xml & co). After some time the 
victim is exporting the file as html plain file with the keypass template. The script code of the url gets executed and 
transfers the context of the listed plain file directly to the attackers listening website script.


PoC: HTML

<tbody><tr><th>Password Groups</th><th>Group Tree</th><th>Title</th><th>User Name</th><th>URL</th>
<th>Password</th><th>Notes</th><th>UUID</th><th>Icon</th><th>Creation Time</th><th>Last Access</th>
<th>Last Modification</th><th>Expires</th><th>Attachment Description</th><th>Attachment</th></tr>
<tr><td>mypass category</td><td>my keypass test</td><td>asdfas</td><td>asd</td><td><a href=""><[PERSISTENT SCRIPT 
CODE]")' <"="">
"><iframe src=http://vuln-lab.com onload=alert("VL") 

<</a></td><td>GhNWVzPhBD4dG4HfSI4L</td><td>asdaasf</td><
td>bdd4c872495537e65493cd08d1a2489b</td><td>0</td><td>2012-06-13 22:17:28</td
<td>2012-06-13 22:22:12</td><td>2012-06-13 22:17:28</td><td>2999-12-28 

23:59:59</td><td> </td><td> </td></tr>
</table></body></html>
</iframe></a></td></tr></tbody>


PoC:  XML for imports ...

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<pwlist>
<pwentry>
        <group tree="my keypass test">mypass category</group>
        <title>asdfas</title>
        <username>asd</username>
        <url>[PERSISTENT SCRIPT CODE]"><[PERSISTENT SCRIPT CODE]<</url>
        <password>GhNWVzPhBD4dG4HfSI4L</password>
        <notes>asdaasf</notes>
        <uuid>bdd4c872495537e65493cd08d1a2489b</uuid>
        <image>0</image>
        <creationtime>2012-06-13T22:17:28</creationtime>
        <lastmodtime>2012-06-13T22:17:28</lastmodtime>
        <lastaccesstime>2012-06-13T22:22:12</lastaccesstime>
        <expiretime expires="false">2999-12-28T23:59:59</expiretime>
</pwentry>


Solution:
=========
XML special characters in URLs (domain) need to be encoded when processing to export as HTML file.

2012-07-01:     Vendor Fix/Patch  - Keypass v1.23

Development Version (fixed!): http://keepass.info/filepool/KeePass_120625.zip


Risk:
=====
The security risk of the persistent software vulnerability is estimated as low(+)|medium(-).


Credits:
========
Vulnerability Laboratory [Research Team]  -    Benjamin Kunz Mejri (bkm () vulnerability-lab com)


Disclaimer:
===========
The information provided in this advisory is provided as it is without any warranty. Vulnerability-Lab disclaims all 
warranties, 
either expressed or implied, including the warranties of merchantability and capability for a particular purpose. 
Vulnerability-
Lab or its suppliers are not liable in any case of damage, including direct, indirect, incidental, consequential loss 
of business 
profits or special damages, even if Vulnerability-Lab or its suppliers have been advised of the possibility of such 
damages. Some 
states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing 
limitation 
may not apply. We do not approve or encourage anybody to break any vendor licenses, policies, deface websites, hack 
into databases 
or trade with fraud/stolen material.

Domains:    www.vulnerability-lab.com           - www.vuln-lab.com                             - 
www.vulnerability-lab.com/register
Contact:    admin () vulnerability-lab com      - support () vulnerability-lab com             - research () 
vulnerability-lab com
Section:    video.vulnerability-lab.com         - forum.vulnerability-lab.com                  - 
news.vulnerability-lab.com
Social:     twitter.com/#!/vuln_lab             - facebook.com/VulnerabilityLab                - 
youtube.com/user/vulnerability0lab
Feeds:      vulnerability-lab.com/rss/rss.php   - vulnerability-lab.com/rss/rss_upcoming.php   - 
vulnerability-lab.com/rss/rss_news.php

Any modified copy or reproduction, including partially usages, of this file requires authorization from Vulnerability 
Laboratory. 
Permission to electronically redistribute this alert in its unmodified form is granted. All other rights, including the 
use of other 
media, are reserved by Vulnerability-Lab Research Team or its suppliers. All pictures, texts, advisories, sourcecode, 
videos and 
other information on this website is trademark of vulnerability-lab team & the specific authors or managers. To record, 
list (feed), 
modify, use or edit our material contact (admin () vulnerability-lab com or support () vulnerability-lab com) to get a 
permission.

                                        Copyright © 2012 | Vulnerability Laboratory


-- 
VULNERABILITY LABORATORY - RESEARCH TEAM
COMPANY: www.vulnerability-lab.com  or  www.vuln-lab.com
RESEARCH MAIL: research () vulnerability-lab com


_______________________________________________
Full-Disclosure - We believe in it.
Charter: http://lists.grok.org.uk/full-disclosure-charter.html
Hosted and sponsored by Secunia - http://secunia.com/


Current thread: