Hikvision Firmware Decrypted

Published Mar 09, 2017 18:16 PM

A developer has decrypted Hikvision's firmware, allowing examination of Hikvision's device source code and contents.

In this report, we overview the tool, showing you how it works, sharing a Hikvision's camera decrypted firmware and overviewing some things to look for inside.

Utility ********

*** *********, ***********, ********* *** ******* ** *** ******* tool ** *********. "*******" ** ***** *** "********* packer/unpacker". ** ******** *** ******** ****** Hikvision ******** ******, ******** *** ********* from ******* ** *******, *** ******* them **** *** ****** ******** ** install ** ** * ****** ** recorder. *** ****** ******* ***** * few *******.

*** ******* ******** "** *** **" camera ********* *** "*** *** ***" ******** platforms, ***** ****** *** ******** ** Hikvision's **** ******* ** *******, *** 7600-series *********.

Hikpack *****

* ** *** ***** *********** ** required ** *** *** ******* *******. For ***** ******* * ***** *******, a *********** ** ********** *** * ***-***** ***** ***** ***** *** ** ****.

** *** ******* *** **** ********* ******** images (********* ******** ********* **** [**** no ****** *********]), ***** *** **** unpack ***** *** ********* *******:

** *** ***** ** ****** **** ************* (e.g., ******** ******** **** *******), ******* "-L *" ** **** ** ** convert *** ***** ** ** ******* version:

*** ********* ******** ** **** ****** in *** ********* ********* ("*****" ** this ****), ***** *** ** *******, or ******** ******* ** ******** *****.

Sample ********* ********

***** **** *******, *** ** **** ** decrypt *** ******* *********'* ******** ******** images ** *** * *** ** readable *****. ***** ******* ** .*** ***** ********* ****** ********** ***** and *********** ** *******.

******* **** *** ****, ******** *** key *********** / ********** ** *********'* firmware:

**** *********** ******** **** *** ********* files:

*** ********* "*****.***-**************" ******** *** **** of *** ***** ********* ****** **** runs ** *** ******. **** **** directory ** *** **** ** /***/****** *** see ** ******** * ****** *****:

**** ***** **** ***** ** * hard-coded "****" ****, **** ***** ** not **********, ** ********* ***** ***** at ***** * **** **** ** run ********* *****. *** **** ** other ***** ***** ******** **** ***** process ** *** ****** **** ** root, ***** *** **** ** ***** exploitable ********** ** ********** *** ***** in ***** *********.

/***/****.*/*** ***** *** ********* *** ******** the ****** ***** ** **** ** starts:

*** *********** **** **** ** *** iptables ******** ****, ******* *** ****** to **** *********** ****** ** ** port ** (***). ***** ****** ** no **** ** **** *** *********** if *** ** *** ******* ** the ******.

********* *** /***/*** **** **** ** called ***** **** **** ***** *** first ******* ***** "********", * ****** *** ****** **** on ******** *******:

** *** ******** **** *** ******* out, *** ***** **** ****** ** able ** **** *** ****** ** the ******, ***** ***** **** ******* you ** **** *** **** ******** of *** ******.

***** ** **** * ****** **** called "*************", ***** **** ******* ** could ** ****** **** ***** ********* to ******* ******-***** ******** ** ******** to ***** *******.

***** **** ** ***** ***** ******** an ******** ******** *****, **** ** call **** ******** *** ********* ***** choose ** **** ** *** ****** running, *** ******* ** * ******** rule, ******* ** ****** *** ******* SSH ** ***.

Firmware ********** **** ********

*** ********* ******** ****** **** *********** and ********* ** ******* *** ***** workings ** *** ********. **** **** time *** ******** ** ** ******** to ***** *** ********** ********** **** *** be *********, *********, ***. **** ** how *** ****** ***** ******** *** **** ******** **** **********, **** *********** ******* ** extract ******** ***** *** **** ******* them *** **********.

****** ********* ** *** **** ****** to ******** ***** ** **** *********** components ** * ******, ****** **** access ***** ***** *** **** ******. *** ********* **** *** ********** *** cracked ******** **** ** **+ *** brands ****** **** ** **** **** **** firmware ******** ********.

 

Comments (16)
U
Undisclosed #1
Mar 09, 2017

Good Stuff, keep it coming.

(3)
EP
Eddie Perry
Mar 09, 2017

 Funny I didnt have to de-crypt it But then again I use real tool set OS

Binwalk from source does a better job than from the repos in my opinion

Kali_screenshot

Surprised we are doing firmware dumps on here though< i had been debating whether or not post some.

(4)
UI
Undisclosed Integrator #2
Mar 10, 2017

What version of Kali are you running if you don't mind me asking?

EP
Eddie Perry
Mar 10, 2017

Kali_release

 

Avatar
Ricardo Souza
Mar 09, 2017
Motorola Solutions • IPVMU Certified

I assume the only reason to have a server running and blocking all inc connection instead of not having the server running at all, would be to be able to access the server via a backdoor...

Or am i being influenced by all those hacks and cia/nsa docs recently? =P

UM
Undisclosed Manufacturer #3
Mar 10, 2017

So,  

is there a bookdoor? or "phone home" ?

UM
Undisclosed Manufacturer #4
Mar 10, 2017

This decrypted firmware download will lead Hikvision into serious issues. Now all the bored ppl. out there start playing with their Kali-Toolbox (decompilers and soucecode vulnerability scanners) and they WILL find many new attack vectors. 

Hikvision should prepare for a massive demand of firmware updates... 

(5)
(1)
AT
Andrew Tierney
Mar 14, 2017

It's been known how to decrypt the firmware for a long while. Most of the obvious vulnerabilities have been found.

You also don't get sourcecode out of a firmware image.

(1)
UE
Undisclosed End User #5
Mar 10, 2017

Could also be a test to verify port 22 is indeed blocked before shipping?

Avatar
Brian Karas
Mar 10, 2017
IPVM

There is no need to a block a port that is not running any services. 

UE
Undisclosed End User #5
Mar 10, 2017

Unless I misread, SSH is running:

 

"Examining the /etc/app file that is called after this line shows the first command loads "dropbear", a common SSH server used on embedded devices:"

 

"why Hikvision would choose to keep an SSH server running, but blocked by a firewall rule, instead of simply not running SSH at all."

UM
Undisclosed Manufacturer #4
Mar 11, 2017

Because they can disable the firewall rule by a hidden cgi or whatever... the answer is in the download. 

(3)
UM
Undisclosed Manufacturer #6
Mar 13, 2017

Here's an interesting thought.  I'm not sure I agree with my thought yet, but it's worth a discussion... how about Hikvision just open sources their camera firmware?  They make money on hardware sales and if they open source it, they would benefit from the community contributing to their code (or at the very least scrutinizing the security vulnerabilities).  There may be a few pieces that they'd want to keep to themselves, like any advanced encoding features, or perhaps some of the analytics, but they could also benefit from the transparency of allowing others to see the source.

(1)
UM
Undisclosed Manufacturer #4
Mar 13, 2017

Most parts of the firmware are open source anyways.

A Linux system always contains many GPL based packages.

The GPL terms of use allow everybody who's interested to request the source code of all GPL licensed packages at any time. The manufacturer has to send you a file that includes all GPL parts and all of his modifications to GPL based code. The "copyleft" of the GPL requires the manufacturer to publish his modifications to GPL code also under GPL license. This applies e.g. to driver/kernel modifications to support the different SoC's.

Please check yourself: https://en.wikipedia.org/wiki/GNU_General_Public_License

Does Hikvision provide such a GPL download?

Avatar
Ethan Ace
Mar 13, 2017

Hikvision does now, actually. See Hikvision Discloses Open Source Software Used

Just some of the software used under GPL:

  • GCC library
  • Linux kernel
  • busybox 1.19.3
  • u-boot
  • udev 114
  • IPTables 1.4.18
  • ppp - Pauls PPP Package 2.4.3
  • RP PPP OE 3.8
  • wpa_supplicant 0.7.2

 

(1)
JH
John Honovich
Mar 13, 2017
IPVM