FULLTEXT01
FULLTEXT01
CHUNYU ZHUANG
CHUNYU ZHUANG
Abstract
The trending usage of IoT devices raises serious security concerns. IoT devices
have complete access to users’ network environments. In the eyes of hackers,
the value of IoT devices is exceptionally high. From minor disturbances to
major crimes, all could happen in no time with compromised IoT devices. As
the IoT devices collects sensitive data, properly protect users’ privacy is also
a crucial aspect for IoT devices. Thus, IoT devices need to be secure enough
against modern cyber-attacks.
In this work, a smart camera DCS-8515LH from D-Link is under
penetration tests. Threat modeling is first performed as an analysis of the
IoT system following by a dozen cyber attacks targeting this smart camera.
The penetration tests provide valuable information that can reveal the smart
camera’s vulnerability and weakness, such as security misconfiguration,
vulnerability to DoS attacks. The smart camera is discovered to be vulnerable
to DoS attacks and exploits on the zero-configuration protocol. Several
weaknesses which violate the users’ privacy exist in the mobile application
and Android storage system. This work evaluated all the vulnerabilities and
weaknesses discovered from a security aspect. This report exposes attacks that
are effective on the smart camera and also serves as a fundamental basis for
future penetration tests on this smart camera.
Keywords
Cybersecurity, IoT security, IoT camera, IoT devices, Penetration testing,
Ethical hacking, Threat modeling
ii | Abstract
Sammanfattning | iii
Sammanfattning
I detta arbete är en smart kamera DCS-8515LH från D-Link under
penetrationstester. Hotmodellering utförs först som en analys av IoT-systemet
följt av ett dussin cyberattacker riktade mot denna smarta kamera.
Penetrationstesterna ger värdefull information som kan avslöja den smarta
kamerans sårbarhet och svaghet, såsom säkerhetsfelkonfiguration, sårbarhet
för Dos-attacker. Den smarta kameran har upptäckts vara sårbar för DoS-
attacker och utnyttjande av nollkonfigurationsprotokollet. Flera svagheter
som kränker användarnas integritet finns i mobilapplikationen och Android-
lagringssystemet. Detta arbete utvärderade alla sårbarheter och svagheter som
upptäckts ur en säkerhetsaspekt. Den här rapporten avslöjar attacker som är
effektiva på den smarta kameran och fungerar också som en grundläggande
bas för framtida penetrationstester på denna smarta kamera.
Nyckelord
Cybersäkerhet, IoT säkerhet, IoT Kamera, Penetrationstestning, Etisk hacking,
Hotmodellering
iv | Sammanfattning
Acknowledgments | v
Acknowledgments
I would like to take this acknowledgement to thank my supervisor Dr. Carlos
Barreto for the great help and support on this thesis, and Professor Carlo
Fischione for his flexibility during the execution of this work.
Contents
1 Introduction 1
1.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.4 Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.5 Research methodology . . . . . . . . . . . . . . . . . . . . . 4
1.6 Delimitations . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.7 Structure of the thesis . . . . . . . . . . . . . . . . . . . . . . 4
2 Background 5
2.1 IoT security in the modern era . . . . . . . . . . . . . . . . . 5
2.1.1 Smart WiFi camera security . . . . . . . . . . . . . . 5
2.1.2 D-Link cameras vulnerabilities found and fixed . . . . 6
2.2 Identify and evaluate the Vulnerabilities in smart cameras . . . 6
2.3 Related work . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3.1 Vulnerabilities in camera firmware exploit . . . . . . . 6
2.3.2 Exposed vulnerabilities in the implementation . . . . . 7
2.3.3 Bypassing authentication with URL . . . . . . . . . . 7
2.3.4 Denial of service attacks via ARP poisoning . . . . . . 7
2.3.5 Exploitation targeting the RTSP-server . . . . . . . . 8
2.3.6 DoS attacks WiFi direct . . . . . . . . . . . . . . . . 8
2.3.7 Deauthentication attacks . . . . . . . . . . . . . . . . 8
2.3.8 Automated penetration testing on Smart home . . . . . 9
2.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3 Methodology 11
3.1 Pre-engagement interactions and intelligence gathering . . . . 12
3.2 Threat modeling and vulnerability analysis . . . . . . . . . . . 12
3.3 Exploitation . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
viii | Contents
4 Threat Modeling 15
4.1 Overview of the IoT system . . . . . . . . . . . . . . . . . . . 15
4.1.1 Assets inventory . . . . . . . . . . . . . . . . . . . . 15
4.1.1.1 Hardware . . . . . . . . . . . . . . . . . . 15
4.1.1.2 Firmware . . . . . . . . . . . . . . . . . . . 16
4.1.1.3 Mobile application . . . . . . . . . . . . . . 16
4.1.1.4 Communications . . . . . . . . . . . . . . . 16
4.1.2 Functionality of the smart camera . . . . . . . . . . . 17
4.1.3 Communication protocols in use . . . . . . . . . . . . 19
4.1.4 Open ports on the device . . . . . . . . . . . . . . . . 20
4.1.5 Data flow diagram . . . . . . . . . . . . . . . . . . . 20
4.2 Entry points . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.3 Experimental setup . . . . . . . . . . . . . . . . . . . . . . . 21
4.4 Identified attacks . . . . . . . . . . . . . . . . . . . . . . . . 23
4.5 Selected attacks . . . . . . . . . . . . . . . . . . . . . . . . . 23
5 Penetration Testing 27
5.1 Network inspecting . . . . . . . . . . . . . . . . . . . . . . . 27
5.1.1 Port Scanning . . . . . . . . . . . . . . . . . . . . . . 27
5.1.2 Vulnerability Scanning . . . . . . . . . . . . . . . . . 28
5.1.3 Method . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.1.4 Exploitation . . . . . . . . . . . . . . . . . . . . . . . 28
5.1.5 Post-exploitation . . . . . . . . . . . . . . . . . . . . 29
5.2 Decompilation of android application . . . . . . . . . . . . . 30
5.2.1 Method . . . . . . . . . . . . . . . . . . . . . . . . . 31
5.2.2 Exploitation . . . . . . . . . . . . . . . . . . . . . . . 31
5.2.3 Post-exploitation . . . . . . . . . . . . . . . . . . . . 34
5.3 Analysis of incoming/outgoing traffic from the smart camera
with ARP poisoning . . . . . . . . . . . . . . . . . . . . . . . 35
5.3.1 Method . . . . . . . . . . . . . . . . . . . . . . . . . 36
5.3.2 Exploitation . . . . . . . . . . . . . . . . . . . . . . . 37
5.3.3 Post-exploitation . . . . . . . . . . . . . . . . . . . . 37
5.4 Zero-configuration network exploitation . . . . . . . . . . . . 38
5.4.1 Method . . . . . . . . . . . . . . . . . . . . . . . . . 39
5.4.2 Exploitation . . . . . . . . . . . . . . . . . . . . . . . 40
5.4.3 Post-exploitation . . . . . . . . . . . . . . . . . . . . 40
5.5 Video streaming protocol exploit . . . . . . . . . . . . . . . . 41
Contents | ix
5.5.1 Method . . . . . . . . . . . . . . . . . . . . . . . . . 42
5.5.2 Exploitation . . . . . . . . . . . . . . . . . . . . . . . 42
5.5.3 Post-exploitation . . . . . . . . . . . . . . . . . . . . 43
5.6 A deep look into the android storage system . . . . . . . . . . 45
5.6.1 Method . . . . . . . . . . . . . . . . . . . . . . . . . 45
5.6.2 Exploitation . . . . . . . . . . . . . . . . . . . . . . . 46
5.6.3 Post-exploitation . . . . . . . . . . . . . . . . . . . . 47
5.7 Identification and authentication failures with HTTP . . . . . . 49
5.7.1 Method . . . . . . . . . . . . . . . . . . . . . . . . . 49
5.7.2 Exploitation . . . . . . . . . . . . . . . . . . . . . . . 49
5.7.3 Post-exploitation . . . . . . . . . . . . . . . . . . . . 50
5.8 MiTM attack at the client side . . . . . . . . . . . . . . . . . 51
5.8.1 Method . . . . . . . . . . . . . . . . . . . . . . . . . 52
5.8.2 Exploitation . . . . . . . . . . . . . . . . . . . . . . . 53
5.8.2.1 Denial of Login and Registration in An-
droid System . . . . . . . . . . . . . . . . . 53
5.8.2.2 Denial of Login and Registration in IoS
system . . . . . . . . . . . . . . . . . . . . 54
5.8.3 Post-exploitation . . . . . . . . . . . . . . . . . . . . 54
5.9 Attacks on WiFi direct . . . . . . . . . . . . . . . . . . . . . 55
5.9.1 Method . . . . . . . . . . . . . . . . . . . . . . . . . 56
5.9.2 Exploitation . . . . . . . . . . . . . . . . . . . . . . . 56
5.9.3 Post-exploitation . . . . . . . . . . . . . . . . . . . . 57
5.10 Denial of Service attack . . . . . . . . . . . . . . . . . . . . . 58
5.10.1 Method . . . . . . . . . . . . . . . . . . . . . . . . . 59
5.10.2 Exploitation . . . . . . . . . . . . . . . . . . . . . . . 59
5.10.3 Post-exploitation . . . . . . . . . . . . . . . . . . . . 60
5.11 Firmware reverse engineering . . . . . . . . . . . . . . . . . . 61
5.11.1 Method . . . . . . . . . . . . . . . . . . . . . . . . . 61
5.11.2 Exploitation . . . . . . . . . . . . . . . . . . . . . . . 62
5.11.3 Post-exploitation . . . . . . . . . . . . . . . . . . . . 63
6 Discussion 64
References 70
List of Figures
5.1 Open ports discovered on the smart camera from Nmap scanning 29
5.2 Script scanning feedback RTSP URLs example . . . . . . . . 30
5.3 Converted dex file to jar file with dex2jar . . . . . . . . . . . . 32
5.4 Content of converted classes file . . . . . . . . . . . . . . . . 32
5.5 Content of converted classes2 file . . . . . . . . . . . . . . . 32
5.6 Three of the High Risk OWASP Mobile Top 10 found . . . . . 33
5.7 Locate the apk file in the system . . . . . . . . . . . . . . . . 33
5.8 Apk file pulled from the mobile phone . . . . . . . . . . . . . 34
5.9 Exposed AndroidManifest.xml . . . . . . . . . . . . . . . . . 34
5.10 API level too high for quark scan . . . . . . . . . . . . . . . . 35
5.11 Search results for ”key” . . . . . . . . . . . . . . . . . . . . . 35
5.12 Query format for getUserTokenByUserPass . . . . . . . . . . 36
5.13 Start capture traffic on the camera . . . . . . . . . . . . . . . 37
5.14 Traffic captured by wireshark through PCAPdroid . . . . . . . 38
5.15 Ettercap command and ARP poisoning undergoing . . . . . . 39
5.16 Ettercap UDP traffic capture example . . . . . . . . . . . . . . 40
5.17 An example of wireshark captured traffic . . . . . . . . . . . . 40
5.18 A-packets analysis result overview . . . . . . . . . . . . . . . 41
5.19 Traffic captured using HTTP protocol . . . . . . . . . . . . . 41
5.20 Interesting protocols that could contain vulners . . . . . . . . 42
5.21 Discover mDNS service in the captured traffic . . . . . . . . . 42
5.22 Discover the smart camera in the local network . . . . . . . . 43
5.23 Probing phase abuse of the device . . . . . . . . . . . . . . . 43
5.24 Connection Timed Out . . . . . . . . . . . . . . . . . . . . . 43
5.25 Video Stream Lost . . . . . . . . . . . . . . . . . . . . . . . 43
xii | List of Figures
List of Tables
Chapter 1
Introduction
The rise of technology and Internet of Things (IoT) has brought a new level
of convenience to our daily lives. IoTs has been adapted to various industries
such as healthcare, manufacturing, retail and energy. An interesting prediction
that the population of IoT will be reaching 125 billion in the next ten years [1]
is likely to come true if there’s no breakdown in the technology ecosystems.
The development of internet protocols, wireless communication technologies
and embedded system devices improves the communication, processing and
sensing capabilities of the smart devices [2]. However, the widespread
adoption of IoT devices also raises concerns about privacy and security, as
connected devices transmit sensitive data which can lead to breaches or cyber
attacks.
As many conveniences as the IoTs can provide, the security concerns in
IoTs remain an unsolved challenge and are highly likely to be a critical battle-
field between developers and hackers (ethical or not). The security concerns of
IoT devices are two-fold: the robustness of the device against attacks to take
control, and preservation of privacy against attacks that assessing sensitive
information. IoTs collect and transmit countless data from the users, which
makes them highly valuable to vicious attackers. The vulnerabilities will
lead to severe consequences such as financial losses and reputation damage,
followed by loss of private data, loss of control over multiple devices, loss
of money or other values, and most importantly, safety incidents. According
to [3], only 2% of the data traffic flowing through the internet is encrypted,
leaving a tremendous amount of data unprotected. Smart cameras are
particularly of great importance since it reveals live footage of actual locations
and people’s daily privacy. An example of cyber attacks on live footage is
that 73011 unsecured cameras in 256 countries was once revealed on a public
2 | Introduction
1.1 Background
An IoT device has the ability to transfer data and communicate over a
network without human interception. One of the first IoT devices Coca
Colawas a vending machine at Carnegie Mellon University which was the
first ARPANET-connected appliance, able to reporting inventory and sense
whether the newly loaded drinks were cold enough [5]. After almost 40
years, it is expected that in 2022, the IoT devices in the world will reach
16.4 billion while taking 61.9% of total devices [6]. Moreover, the leading
companies are investing massively in the IoT to satisfy the market’s high
demands. For example, IBM announced a 3 billion business unit focusing
on the development of solutions for the IoT [7].
While IoT devices are increasing in popularity, security and privacy issues
remain challenging for developers. Usually security measures are not taken
promptly compared to the security vulnerabilities of IoT devices. Due to the
number of IoT devices increasing in the foreseeable future, the vulnerabilities
increase naturally [8]. For instance, a software security vulnerability present in
TRENDnet’s IP-connected cameras was exploited in 2021, and hackers posted
links to the private live feeds of nearly 700 of the cameras [9]. Furthermore, in
Introduction | 3
2014, over 73000 video cameras were found to be streaming their surveillance
footage on the web [10]. The scope of caused damage will expand not only to
homes but also to offices and enterprises. Malicious attackers can easily take
advantage of network and radio frequency to gain unauthorized access causing
severe consequences such as violating users’ privacy and retrieve sensitive
data. Ethical hacking and penetration testing are two effective methods to
access the vulnerabilities and evaluate the IoT devices security levels.
1.2 Problem
The work aims to address the issue of the security evaluation on the smart IoT
camera and test the robustness of the smart camera mydlink DCS-8515LH.
The security camera claims to ”make your home safer” using motion detecting
and live-streaming on the phone app. Nevertheless, will it really make the
home safer or provide potential security concerns? The thesis will investigate
possible attacks on the smart camera and perform ethical hacking on the
device. Then, shall the attacks perform successfully, the consequences will
also be investigated. Last but not least, I will carry out an overall evaluation
of the smart camera’s security level and exploitable weakness.
1.3 Purpose
The purpose of the thesis includes several aspects. First of all, the author
discover the vulnerabilities in the smart camera and evaluate the severity
with a security analysis. Second, the evaluation leads to some constructive
suggestions about the camera security issues, which will benefit all the users
and developers. Last but not least, the work will further expand the author’s
skills and comprehension of IoT ethical hacking subject.
1.4 Goals
The goal of the thesis is to evaluate the security level of the mydlink HD
Pan & Tilt Wi-Fi Camera DCS-8515LH. While this has been divided into the
following sub-goals:
1.6 Delimitations
This work will mainly perform penetration tests on the smart camera, the
firmware of the camera, the Android mobile application, and the wireless
communication from the camera. Hardware, IoS application, radio frequency,
cloud server and Bluetooth are outside this work’s scope due to the time
limitation.
Chapter 2
Background
Starting from the first state, when joining a network, the client begins scanning
all the channels for one target AP and the AP will be discovered broadcasting
in a specific channel. The client and the AP authenticate each other through
messages exchange, while during the second stage, the client and the AP
Background | 9
cooperate to stage three when they start to exchange data packets. In the
802.11 protocol, the authentication messages supported by 802.11 exchange
between them to authenticate. After successful authentication, the client and
the AP move to the final step. An attacker can then use tools like aireplay-ng
to deauthenticate through data packets with spoofed MAC addresses of the
victim.
2.4 Summary
The prior researches on IoT device security has shown many vulnerabilities
and weaknesses in similar smart camera systems. The listed works managed
to find vulnerabilities and obtain critical information like video streams or
credentials. With more works published in journals and conferences, smart
camera security is deeply investigated. In such manner, the vendors can
continuously improve the security implementation of their products. The
related work also enlightens this work to perform relevant and selective
attacks. With enough basic knowledge of a smart camera, this work then steps
to the next phase.
10 | Background
Methodology | 11
Chapter 3
Methodology
This chapter describes the chosen methodology for this thesis. The author did
not find any methodology available specific for IoT cameras. Therefore this
work follows a general methodology known as Penetration Testing Execution
Standard (PTES) [11]. The main section of this methodology consists of 7
sections, which are listed below.
1. Pre-engagement Interactions
2. Intelligence Gathering
3. Threat Modeling
4. Vulnerability Analysis
5. Exploitation
6. Post Exploitation
7. Reporting
1. Identify Assets
Methodology | 13
3.3 Exploitation
The exploitation phase is based on the previously decided scope, mapped
assets and communications, and detected vulnerabilities. The ethical hacker
will initiate attacks on the target device using various tools and describe how
the vulnerabilities are exploited in the later reports. The effect caused by the
attack will also be demonstrated and analyzed. In this thesis, attacks targeting
wireless communications, mobile applications, and software are initiated,
while hardware testing will not be conducted.
Chapter 4
Threat Modeling
This chapter describes the threat model for DCS-8515LH smart camera.
Including the device system, Android mobile application, and wireless
network communications, the threat model process identify all the assets and
the data flow in between device and servers. As the methodology states, this
chapter covers the intelligence gathering step and the threat modeling process.
4.1.1.1 Hardware
Mydlink DCS-8515LH Camera has a microSD card slot under the camera
where a microSD card can be inserted. A microphone is also located below
the camera for interactions. And a status LED at the bottom front of the device,
solid green representing the camera has successfully connected to a Wi-Fi
network as the setup is completed. Flashing green means the live view of
16 | Threat Modeling
the camera is activated. Solid red show the device is booting up and flashing
red indicates the firmware is updating. And the flash orange color represents
Bluetooth pairing or offline. In the back of the camera, a speaker is located
through which it can provide audio playback for the two-way audio feature.
And at the bottom of the camera, there is a reset button which could reset the
camera to factory default settings and a microUSB power port to supply power
to the device. Additionally, a sticker of device information and a QR code of
the device is attached at the bottom of the camera as well.
4.1.1.2 Firmware
Firmware consists of the system inside the camera, which enables control
features of the camera. The current available version of the firmware is
1.07.01, which the author manages to find online. The firmware of the camera
is a .bin file which could be transferred into a microSD card and plotted in the
camera slot for an update. However, the .bin serves only as a backup firmware
installation solution and cannot be opened manually per se.
4.1.1.4 Communications
The communications of the smart camera are mainly through wireless
connections and Bluetooth. The device supports 802.11n/g/b wireless with
WPA/WPA2 encryption and Bluetooth Low Energy (BLE)4.0. The network
protocols include IPv6 ARP/ICMP, IPv4 ARP/ICMP, TCP/IP, UDP, DHCP
Client, HTTPS and Bonjour.
Threat Modeling | 17
1. App recording and snapshot. The application can record live footage
and take a snapshot of the live stream, and store in local storage.
2. SD card recording. The camera has a Micro-SD card slot which accepts
a Micro-SD plugin for live footage storage.
5. Sound & motion detection that allows users to receive alert notifications
and record video clips. With the help of a motion detector, sound
detector and built-in night vision, the camera could detect any
disturbance or changes in monitored space, even in complete darkness.
8. Voice control. Amazon Alexa and Google assistant are embedded in the
system, which enables the user to control the camera with voice.
ID Asset Description
1 Smart Camera The D-Link DCS-8515LH smart camera provides monitor-
ing functions with sound and motion sensors. The speaker
and microphone also enable two-way communication
between the user and the monitor area. The user can see
the live stream from the mobile application mydlink. The
current OS system for the camera is Linux 3.2-3.16.
2 Hardware Hardware components include light sensors, IR LEDs,
camera lens, microphone, microSD card slot, status LED,
speaker, reset button and micro-USB power port.
3 Firmware The firmware is injected into the device through a microSD
card slot. The current version of the firmware is V1.07.01
(downloaded from the TW support page, no resource on the
EU support page).
4 Mobile Applica- D-Link cameras are used to support the web portal.
tions However, DCS-8515LH model only supports the mydlink
app. Functions in the mobile app also include taking
snapshots and video recording. The current application
version is 2.9.4, build 271. Older D-Link applications,
”mydlink Lite” and ”mydlink+”, are incompatible with
DCS-8515LH.
5 Wireless The network requirements for the camera is 802.11n/g
Communications wireless network encrypted with WPA/WPA2. The
connectivity also includes Bluetooth Low Energy (BLE)4.0.
The network protocols include IPv6, IPv4, ARP, TCP/IP,
UDP, ICMP, HTTPS, DHCP Client, and Bonjour.
6 Cloud Storage D-Link provides a premium cloud storage subscription for
users to save video recordings in the cloud server. The cloud
server automatically saves the backup recording of events.
ID Communication Description
Protocols
1 TCP TCP protocol establishes a connection between the smart
camera and the servers on the transport layer.
2 TLSv1.2 TLS protocol is applied for communicating and authenticat-
ing between the client and the server. TLS 1.2 also includes
an SHA-256 hash function, which is more secure than the
previous versions.
3 ICMP ICMP protocol is used to report errors or failed operations
between the smart camera and the mobile application.
ICMPv6 is used in this communication.
4 HTTP HTTP functions as a switcher to upgrade TCP protocol
to WebSocket protocol and communication with the relay
server to exchange data with peers.
5 UDP UDP protocol is used for voice and video transfer between
the mobile application and the smart camera.
6 WebSocket WebSocket protocol is used for the two-way communication
between the smart camera and the server, where the client
communicates with the server and gets a response from
automatic responses.
7 STUN STUN protocol is a standardized set of methods [39] for
traversal of NAT gateways in real-time voice and video
communications.
8 MDNS MDNS protocol is a zero-configuration protocol for smaller
networks. It uses multicast to address the participants in the
network.
9 DNS DNS protocol translates domain names into IP addresses
when communicating with mydlink servers.
selected but only partially conducted since the server is outside the scope of
this work for legal reasons.
Another attack that used to be on the list was the DoS attack. Although this
attack is not selected on the list, this attack is widely used and proven effective
to the IoT system. Thus, a DoS attack is also conducted in this work.
Owing to the analysis and the compatibility of OWASP’s top 10 list and
the smart camera, the specific selected attacks are listed below.
3. Passive reconnaissance
6. Firmware hacking
9. MiTM attack
Chapter 5
Penetration Testing
This chapter contains penetration tests performed on the target devices and a
thorough analysis of the attack’s outcome. Based on the previous explanation,
the actions taken, reasons, results, and analysis will be provided according to
the methodology. This chapter reports the vulnerability analysis, exploitation
and post exploitation in the methodology. Section 5.1 and Section 5.3 reflect to
the intelligence gathering and vulnerability analysis in the methodology. The
method subsection reflects the vulnerability analysis, the results reflects the
exploitation and the discussion subsection reflects the post-exploitation. The
penetration testing is performed in the experimental setup mentioned in 4.3.
5.1.3 Method
Nmap comes in very handy in this part because it is an open-source tool
for network exploration and security auditing designed to rapidly scan large
networks [43]. Nmap is a very powerful tool which is used by countless
researchers and attackers for gathering information on the target computer
system. Nmap has the capacity of scanning the operating system, port states,
running services and communication protocols which are basically everything
that an attacker needs to know about the target. Worth mentioning one of the
most potent scannings is script scanning (NSE). NSE can perform tasks from
as essential as service version detection to vulnerability exploitation. NSE
possess great complexity but is surprisingly easy to use which is the reason
why it is part of the aggressive scan option.
5.1.4 Exploitation
The scanning results display opening ports and running services on the device,
which could potentially reveal vulnerability corresponding to the system. The
Nmap scanning results are shown in Figure 5.1.
As stated above, Nmap provides a very functional service called script
scanning. When targeting to RTSP protocol, it’s defined as a port rule called
script RTSP-URL-brute. The script attempts to discover all the valid RTSP
URLs by sending DESCRIBE request for each URL in the dictionary. Then
it compares the response based on which Nmap determines the validity of the
URL [44]. Due to the excessive amount of URLs discovered, a short example
of the discovered URLs is shown in Figure 5.2.
Penetration Testing | 29
Figure 5.1: Open ports discovered on the smart camera from Nmap scanning
5.1.5 Post-exploitation
The port scanning provides quite valuable results about the open port in the
intelligent camera system. In total, five opened ports and the running services
are detected, port 554 (RTSP), 7000 (afs3-fileserver), 8080 (ssl/httpproxy),
8088 (radan-http). Port 554 runs the rtsp service, which is a streaming protocol
for real-time streaming service. Interestingly, RTSP uses not only port 554
TCP but also 5004 UDP and 5005 UDP. Port 554 is used to accept incoming
RTSP client connections and to deliver the data packets to the clients on the
stream. Port 5004 is used to send data packets to the client which enables
the user to see the stream by using RTSP. Port 5005 is for receiving data
packets loss information from the clients and synchronising the clients’ stream.
Certain vulnerabilities are already known for a few years in RTSP, such as
buffer overflow in Hikvision RTSP request header handling (CVE-2014-4879)
[45]. These CVE are pretty outdated and tested to be fail in the smart camera.
However, up-to-date CVEs were found as well. Further implementation with
the reported CVE in the system should be conducted in later sections. Port
7000 runs afs3-fileserver service. AFS stands for Andrew File system, which
is a distributed file system that uses trusted servers to present a homogeneous
file namespace to the clients’ workstations [46]. AFS implements access
control lists for the users that allow limited file system access, therefore, have
a high-security level. Port 8080 runs an http-proxy service that allows the
clients to communicate on the internet through a proxy server. Port 8081 runs
ssl/blackice-icecap service; it’s a piece of administration software for a firewall
system. All the discovered ports have reported CVE. Further actions on these
ports should be conducted in the later sections. The script scanning results are
30 | Penetration Testing
surprisingly loaded. Dozens of RTSP URLs are discovered. Among all the
URLs, a particular URL like rtsp://192.168.3.101/1/stream1 indicates some
functions within the URL. The excessive results hint that the RTSP protocol
are overall secure in general. Section 5.5 utilises these results and exploits the
protocol.
cloud service for some of the models in a secure and private way. Android
is built with java adn the APIs are also designed in Java. The Java platform
tends to store more high-level information in its execution file, making it easy
to recover the source code [50].
5.2.1 Method
The newest version of the APK file should be the first option for considerations
since most users applications are automatically updated. The APK file could
be directly opened in the Kali Linux system. However, the dex file within
the application needs further actions to view the content. In the android
application analysis, methods could be categorized into the following: Static
analysis, binary reversing, and dynamic analysis. The static analysis uses a
tool called apktool [51], and quark-engine [52] to scan the source code. In this
case, a tool called dex2jar-2.0 [53] can convert the file format from dex into the
jar file. Then the jar file could be viewed in file explorer or IntelliJ IDEA, or
the tool jadx [54] could give a more specific view of the APK file. To take this
step further, the java file in the jar file could expose a potential vulnerability
in the application. For example, the name of the javascript could indicate the
function or usage of the codes, therefore providing an opportunity to modify
the codes or insert malicious scripts in the application. When the modified
APK file is installed by an unaware user, the user’s information or sensitive
data could be leaked, causing severe damage. But the more functional it is,
the more vulnerabilities it brings, so the author hereby decompiles the android
application APK and takes a look around for possible insecure features.
5.2.2 Exploitation
The author downloaded the newest version of the APK files. The APK file
is named mydlink 2.8.1.apk; with convenience from kali Linux, it could be
directly extracted to files visible. Two dex files were located after extraction,
one called ”class.dex” and the other one ”class2.dex”. To further take a look
into the dex file, a tool named dex2jar-2.0 [53] is used to convert the files
to jar files. The installation of dex2jar was made easy by Kali Linux. After
converting to a jar file, the file inside is readable with IntelliJ IDEA, it could
also be viewed just in the file system, but IntelliJ IDEA is more user-friendly.
Class.dex converted results are provided in the Figure 5.3.
Both converted files shown in Figure 5.4, Figure 5.5, contain a class that is
randomly confused with alphabet letters from author’s inspection. However,
32 | Penetration Testing
some of the folders are in clear text, which is investigated with search function
in IntelliJ IDEA. However, the files within the clear-text folders are either
android native libraries or not relevant to the core functions of the application
and does not really affect the overall usage of the users.
In general, the classes and code files are made confused to better protect the
APK file. This measure also added obstacles for attackers to plant malicious
functions in the application. Since the android application is overall easier
to download and install than IoS apps, preventing forge in the application is
crucial to prevent innocent users from getting attacks from unknown sources.
Gladly, with the completeness of the security testing method, various
testing tools for APK files are available on the internet, which greatly aided the
analysis of the security level of the application. A website called Immuniweb
[34] provides security tests, mobile application privacy checks and OWASP
Mobile Top 10 tests. Therefore, the author uploaded the APK file and got a
detailed summary of the APK file.
The summary report gives the author a few insights into the possible
vulnerabilities. The privacy policy was not found in the application, which
could either be a misconfiguration or a possible weakness.
Penetration Testing | 33
Figure 5.6: Three of the High Risk OWASP Mobile Top 10 found
file is extracted and scanned. However, the quark-engine is not doing well
with the automated static analysis of the file, as the Figure 5.10 shows. The
API level of the application is too high for quark to do such a scan. Then, we
proceed to binary reversing of the APK file; the dex2jar extraction is already
performed in the above results. Worth mentioning that the APK tool is also
capable of such decompile action.
To better visualize the decompiled file. The tool jadx [54] is used since it
provides a GUI to make the file more readable. The search function in the jadx
is very convenient in this case, the search results for ”key” is shown in Figure
5.11 Another finding is when searching for password, in the HttpUrl class the
format of the UserToken is described shown in Figure 5.12.
5.2.3 Post-exploitation
Since the IDE can not create separate files on the OS, the jar file contains
obfuscated class files. The obfuscated file have identifiers renamed to make
them harder to understand by human readers. This precaution significantly
increases the difficulty of understanding the application and function blocks,
therefore increasing the difficulty for attackers to modify or insert malicious
code in the application.
However, with the help of apktool and jadx, the author successfully
discovered the AndroidManifest.xml file and located some of the critical data
formats in the APK file. This exposure of information gives the attacker
an opportunity to rewrite the java file and upload it to a public open-source
platform, then initiate an unforeseen attack.
Moreover, undoubtedly, the best measure to prevent these kinds of attacks
is to avoid installing Android applications from an unknown source or
Penetration Testing | 35
unofficial source since the APK file could contain vulnerability or malicious
code injected by unknown attackers. However, this is out of the scope of this
work.
5.3.1 Method
An HTTP server can helps to keep a log of all the incoming request to the
server. With an HTTP server, any PC in the local network can access or
communicate with the phone and hereby to see any ongoing traffic with the
camera. With the help of an app called PCAPdroid [58], the traffic could
be viewed in wireshark in real-time. The HTTP server mode in PCAPdroid
launches an HTTP server which can be accessed by any PC on the local
network to download the PCAP file containing the captured traffic which is
a default mode of PCAPdroid. This mode is PCAPdroid’s default operation
because it doesn’t require any further setup or a particular operating system.
This mode can be used to assess the PCAP on traffic in real time after the
capture has begun using a curl command, as shown in Figure 5.13. However,
this is not directly captured on the camera, more precisely to be capturing
traffic through the mydlink application. The PCAPdroid provides a function
for targeting the traffic on one specific traffic. In this case, the option is selected
to the mydlink app. See the Figure 5.14 for details.
Another way is to use ettercap [59] to perform ARP poisoning on the router
and the smart camera. Ettercap can perform one kind of MiTM attack, which
direct the data packets back to the network, thus diverting and switching the
data packets streams for analysis. This attack is also called ARP poisoning,
where the attacker sends out fake ARP data packets to the network to redirect
data flow to a specific IP address to the attacker. With the help of ettercap,
the traffic can then be viewed on Wireshark. The captured traffic .pcap file
could be analysed manually however, using a analysing tool provides more
thoroughly and detailed analysis. Therefore, a tool called A-packets [60] is
used for analysing the traffic file.
Penetration Testing | 37
5.3.2 Exploitation
To provide more information on this traffic analysis section, the author has
tried almost all the methods on the internet to view the traffic on Wireshark
for further work. Tools like PCAP remote do not work on Android 11+
systems, and the SSH server capture method does not cooperate well with
the application since it requires a VPN server connection while the mydlink
app can detect the wireless server has been changed and therefore refuse to
connect to the camera.
Traffic captured by Wireshark through PCAPdroid is shown in Figure 5.14,
most traffic goes through the IP address 10.215.173.1, which is the IP address
of the virtual interface created by PCAPdroid.
The second way of capturing the traffic was later on discovered by the
author, and it turned out to be more effective. First, ettercap needs to be
enabled for ARP poisoning, with the command in Figure 5.15. ”-T” is for
text only without any graphical content, ”-S” is used for not using SSL in this
command, ”-i” is to set the interface to the selected wlan0 in this case, ”-M”
indicates it is a kind of MiTM attack. Then the method of this attack is defined
by ”arp:remote”, and after that, we specify the IP address of the router, last it
will be the IP address of the smart camera. The Figure 5.15, represents the
ARP poisoning has been started and undergoing. Then the traffic could be
captured by Wireshark on Kali Linux machine as shown in Figure 5.17. A
UDP traffic captured example is also demonstrated in Figure 5.16.
The analysis of the .pcap file displays all the connections including some
of the connections that might contain vulnerabilities. As shown in Figure 5.18
5.3.3 Post-exploitation
The first method gives a very comprehensive topology of how the smart
camera and mobile phone communicate with the Internet. However, the first
method has got one minor flaw. The PCAPdroid uses a proxy 10.215.173.1 to
communicate with the outside world, which is not really the mobile phone IP
address itself.
So the emphasis lies on the second method. The second method uses
ettercap to perform ARP poisoning for traffic capture. ARP poisoning is very
efficient and lies within the heart of ettercap methodology. Upon uploading
the .pcap file to A-packets website for analysis purposes, the author should
state that this is a public source which means it is openly available for all
visiters of the website. Therefore, the uploaded file needs to be deleted
afterwards to protect the privacy of the experimental setup.
The report feeds us some very valuable information, such as the HTTP
communication and Ethernet services. It also provided a clear network map,
although due to some disturbance by the author’s iphone, the map is not
very ideal, therefore, not showing here. Interesting data traffic captured by
Wireshark is using the HTTP protocol, shown in Figure 5.19, which is known
as not very safe. Also, some other interesting protocols used in the traffic are
captured and shown in Figure 5.20.
Session Traversal Utilities for NAT (STUN) is a standardized set of
methods for the traversal of NAT gateways for real-time video and voice, etc.
[39]. STUN is also a part of the signaling server that performs handshaking
before the conversation between two parties is established. The STUN server
identifies the unique IP address for the user in order to establish a P2P
connection and exchange video. The traffic analysis with ARP poisoning
provides a lot of helpful information that could be used in later penetration
testing. Therefore, proven to be a vital step in this work.
The MDNS protocol is used in the broadcast domain that is the same as other
devices, which indicates that the device using mDNS protocol share the same
data link layer with the rest of the system. This introduces a vulnerability since
the participants in the same network cannot be verified and allow an untrusted
party to connect. The MDNS protocol is used when a Linux/Ubuntu system
is booted. The device usually sends out a query with the header of xxx.local.
Therefore, when the connection changes or alters, the device will start a probe
phase and start announcing in the network. The device starts querying the
local network and then announces its registered address with mDNS responses.
Albeit, the probing phase becomes easy to attack with access to the local
network.
5.4.1 Method
A python script called Pholus [62] will be used for this attack. Pholus sends
out DNS queries if 15 conflicts happen in less than 10 seconds. The device
will then have to wait for 5 secs before initiating another attempt [63].
40 | Penetration Testing
5.4.2 Exploitation
This penetration test starts with scanning for possible victims in the network
corresponding to the earlier traffic analysis.
The pholus.py script then discovered the smart camera in the network,
as shown in Figure 5.22. After we identified our target, the attack could be
started by specifying the interface, attack type and running time of this attack,
shown in Figure 5.23. With the attack initiated and running, now it’s time
to take a look on the live stream view of the smart camera and verify the
consequences. The results are shown in Figure 5.24 and 5.25. The pholus.py
running successfully stopped the smart camera from accessing the network.
5.4.3 Post-exploitation
The smart camera is not secure against zero-configuration network exploita-
tion attack when the mobile application popup display ”video stream lost”. It
can be concluded that the video stream is completely blocked by the attack
since the smart camera is unavailable for usage. These kinds of attacks are
adequate for the connected IoT in the local network. Moreover, this fore-
mentioned attack could further lead to a more severe MiTM attack. With a
MiTM poisoner, the attackers could further use an mDNS poisoning attack to
escalate higher privilege.
Nowadays, the attacks on zeroconf are hard to mitigate since the need
for mDNS service is still needed in lots of IoT devices. However, a unique
identifier for the host could be helpful in preventing these attacks from
happening.
Penetration Testing | 41
streaming. The protocol is easily compatible with HTTP since they use the
same concepts. While the RTSP port is left open in this smart camera, this
could lead to several attacks targeting the camera. For example, a tool called
cameradar is developed [65] to detect and launch dictionary attacks to get the
stream routes, even possibly display the streaming live view. The leaking of
the live stream could be a severe violation of the privacy of the users.
5.5.1 Method
Since no traffic is captured with Wireshark, the RTSP port is open from the
earlier investigation. This section’s attacks mainly target the port and the
camera system instead of the traffic flow. The author will try to connect to the
device through the RTSP protocol and send a request to retrieve information
from the system. Also, metasploit provides several attacks targeting the
RTSP port. From the Nmap script scanning results, lots of RTSP URLs are
discovered that might be played in VLS media player [66].
5.5.2 Exploitation
Before starting the attacks, a ”health check” for RTSP is performed with the
curl command, as shown in Figure 5.26. The RTSP server is working fine.
Then, it is known that the RTSP protocol also supports telnet connection by
the client. We connect to the device using telnet service. The telnet connection
shown in 5.27 appears to be normal. However, when setting up traffic listening
on the device to, test if the telnet connection could really generate traffic
from the smart camera with a ping command. The local traffic listener did
not capture anything at all, as shown in Figure 5.28. So it’s proven that the
telnet connection can not pull any request to the server. Then the DESCRIBE
request is sent to the device through telnet, as shown in Figure 5.29 The
Penetration Testing | 43
5.5.3 Post-exploitation
This section reports several attacks attempted on the RTSP port. During the
author’s research on the internet and books, the devices with the vulnerability
of the RTSP port usually give out more information when sending a request to
the server. Moreover, from the responses, the RTSP port is left open securely
by the developers for a reason. And the telnet connection appears to be
relatively safe since no exploitation succeeded, and even not much information
could retrieve from the server. The DESCRIBE request was sent without
feedback, most likely for the client is not authorized to get any response from
the server, not even an error or denying response. Moreover, the streaming
URLs also need to be played through the mobile application corresponding to
the unauthorized feedback earlier when scanning port 554. Interestingly, from
later research on this URL, for models DCS-XXXXLH series smart camera,
using this link for 3rd party apps or network video recorder(NVR) devices
is no longer supported. However, earlier models like DCS-936L do support
RTSP streaming. So all earlier models are likely to have this vulnerability.
Therefore, the RTSP port appears to be secure and safe against the
exploitation applied in this section.
Penetration Testing | 45
5.6.1 Method
A rooted Redmi Note 11 mobile phone is analyzed for this test. With
the help of the Adb tool, a versatile command-line tool that allows the
user’s computer to connect to the mobile phone, a connection is built
between two computing systems. The mydlink application data are stored in
/data/data/com.dlink.mydlinkunified path. In the file location, the main targets
46 | Penetration Testing
are files names database, preferences,. etc. Especially folders that could
contain sensitive information potentially. With the later discovery tool DB
Browser for SQLite, a clear table view could be delivered and detect exposed
sensitive data.
5.6.2 Exploitation
This section uses a rooted Redmi Note 11 phone and a tool called Adb [67].
It is a programming tool used for debugging Android-based devices. The
daemon on the phone communicates with the server [67] on the host PC
through a USB connection which could give access to the client to view data
stored in the system. In this case, with the help of a rooted phone and Adb
shell command, access to all the stored data is enabled. Without the root
privilege, common commands like -ls could not be used. After digging into
the storage system, a path called /data/data/com.dlink.mydlinkunified is found
Penetration Testing | 47
Figure 5.33: Email address, username and location exposed in clear text
5.6.3 Post-exploitation
The results indicate a particular security flaw in the storage system. Sensitive
data like device state, username, email address and geographical location is
leaked in this step. While more critical data like the password stays safe in this
48 | Penetration Testing
penetration test. One reason is that the password is encrypted in the mydb file
and stored safely. This penetration test is performed on a rooted mobile phone,
considered an insurance step after the system has yielded. Since the Adb tool
requires root privilege to dive into the system, for normal usage, it could be
done through some malware or known vulnerabilities on the Android phone.
The accessed path is only accessible with root privilege. The rooting process
of Xiaomi Redmi Note 11 smart phone is presented in Appendix. B.
All in all, the storage system has security flaws for leaking the users’
information. However, this leakage of information requires the android phone
to be rooted and a USB or TCP connection. However, as long as the users keep
the phone secure and do not make dangerous attempts on unknown URLs or
emails, it is considered to be rather safe.
Penetration Testing | 49
5.7.1 Method
In this attack, according to an earlier discovered HTTP port 8088 URL,
burpsuite, ncat [71] and metasploit [72] are used to exploit the session. The
URL is earlier discovered in the android storage penetration testing. Burpsuite
can intercept the traffic and add credentials according to the intercepted
credential format. Also, ncat is used to check the session credential format
and HTTP authentication method. Last but not least, a brute force attack will
be conducted when burpsuite and ncat fail to exploit the HTTP URL.
5.7.2 Exploitation
First, the author uses burpsuite to intercept the login request for HTTP, the
intercepted request is shown in the Figure 5.36. We use ncat to send HTTP
requests and try to log in as an unauthorised user, the shown in Figure 5.37.
The connection request from ncat display and unauthorised message with
WWW-authenticate content. No further information is leaked when trying
50 | Penetration Testing
to connect. From the two results here, we discover that only the username is
displayed in the request. The HTTP use an authentication method with digest
and realm.
Given the results of the previous unsuccessful connection, a brute force
attack against the HTTP login page, as shown in Figure 5.35. A username
list and a password list are downloaded from github. The author also added
a few possible login credentials in both lists accordingly. However, given the
computing ability and time limit, the brute force attack through metasploit
remains no result which can be seen from Figure 5.38.
5.7.3 Post-exploitation
This section conducted attacks on the HTTP URL discovered in the last
section. The HTTP connection is able to authorise only legitimate users and
not leak more information about the system. Leaving a login port like this is
secure to brute force attack in this work, while further attempts will not be
conducted due to the delimitation of this work. The HTTP protocol here uses
an authentication framework when the user sends a request, the framework
of HTTP authentication is shown in Figure 5.39 When the attacker sends out
invalid credentials, the server responds with 401 unauthorised message and
refuses the connection. To further explain the connection, a mechanism of
digest access authentication is applied in the protocol. It uses MD5 hashes with
nonce value to prevent replay attacks [73]. The digest access authentication
verifies both communicating parties to a shared secret, which is why the
Penetration Testing | 51
password does not need to exist in clear text, which prevents the most obvious
weakness [74].
One more comment on this attack type: the mobile application’s login
function has a protection function when encountering too many failed login
attempts. After 10 incorrect user email or password attempts, the login
function is automatically frozen for 3 minutes, shown in Figure 5.40. This
mechanism reasonably protects against identification failure.
5.8.1 Method
A common MiTM attack is initiated by installing a data packet sniffer that
intercepts network traffic. The attacker could retrieve the user’s sensitive
data when the users attempt to log in or process any procedure that requires
credentials. Nowadays, this is typically done through an insecure website. In
this work, a proxy server is configured with Burp Suite [77]. The WiFi proxy
on the mobile application is manually configured to redirect to the listening
proxy. A CA certificate from Burp Suite needs to be installed in the mobile
phone system in order for the traffic to be redirected. Then the credentials the
users submitted during this step should be able to be harvested by Burp Suite.
Penetration Testing | 53
Figure 5.40: 3 minutes waiting time when too many failed sign-in attempts
are detected
5.8.2 Exploitation
The MiTM attacks with burp suite were initiated and did not reach expectation
since the mydlink app detected an unverified server and therefore displayed an
error message in Figure 5.41. Since mydlink detects that the communication
with the server somehow could be altered, the login function is disabled. Two
attempts on both the Android and IoS systems achieved unsatisfying results.
5.8.3 Post-exploitation
The smart camera is secure against initiated MiTM attack in this work. The
attacker is able to configure a proxy and install a CA certificate on both mobile
systems, regardless of the possibility of this step in reality. Both systems’
mydlink applications detect this modification on the server side since other
Penetration Testing | 55
Figure 5.44: Fail to create account when directing to listening proxy in iOS
owner”. Afterwards, the Wifi direct use a hand of the Wi-Fi Protected Setup
(WPS) to connect the device and the mobile phone in a secure way. The smart
camera provides a QR code scanning method to connect to the mobile phone
and another way of Pin entry for connection. The pin entry mode is done with
a PIN code at the bottom of the smart camera and manually input to the index
box on the application.
5.9.1 Method
From the above explanation, the device uses a pin code entry mode when
pairing, and this kind of WiFi direct could be vulnerable to brute force
attack. Therefore, a brute force attack using reaver [78] is exploited to test the
resilience of the smart camera. Reaver is a preinstalled tool on Kali Linux that
performs brute force attacks on the AP WPS. Once the pin code is discovered,
the AP settings could be consequentially changed unaware. Another attack
which is usually for Push-Button Configuration (PBC), is called ”EvilDirect
Hijacking Attacks”. This attack usually interacts with the PBC connection
process while the attacker tries to intercept the request for a connection and
trick the target device into connecting to a prone system. This attack uses
airecrack-ng suite and will also be investigated in this section.
5.9.2 Exploitation
The attack is started during the device’s pairing process with the perquisites
of a reaver attack undergoing. In this step, the wlan0 BSSID is specified in
the command, but nothing was intercepted. The process was running for 100
seconds and more when the author restarted the pairing process for three times.
Still, no useful results from reaver, as shown in Figure 5.46.
Then the second attack EvilDirect Hijacking Attack comes to play. First,
the wlan0 needs to be set on monitor mode, as shown in Figure 5.47. Then
airbase-ng is started targeting the smart camera, which basically forges an AP
and encourages the victim to connect to it. The BSSID is randomly written
just to satisfy the address. This attack remains failed with no responses after
Penetration Testing | 57
initiation. The smart camera did not step into the trap of fake AP access points
either.
5.9.3 Post-exploitation
The smart camera is secure against attacks on WiFi direct in this work. The two
attacks performed in this section both failed without any response. The WiFi
direct function of the smart camera successfully bypasses these two attacks.
This could be the newer technology of near-field communication in use or the
smart camera pairs with the mobile terminal in some other ways. The reason
is also the pre-selection of the pairing smart camera model, which implies that
they might communicate in a certain frequency for connection in this pairing
process. The security measure on pairing is well deployed since most users
will choose a QR code for connection when they have access to the QR code
instead of the pin code.
However, the insecure elements of WPS remain. The mitigation for this
could be enabling MAC address filtering to make sure there is no phishing
hook in the network and disabling the WPS function.
58 | Penetration Testing
Figure 5.48: Airbase did not lure the victim to the forged AP
5.10.1 Method
The method of the DoS attack is present as follows, first of all, all the
communication in the wireless network needs to be terminated and start again
to ensure the attack environment. Moreover, the wireless adapter monitor
mode needs to be enabled. Then, wireless transfer from the wireless AP and
the BSSID of the router needs to be captured. Last but not least, use Aireplay-
ng to send deauthentication frames to the smart camera’s MAC address to
deauthenticate the user from accessing the camera’s service.
5.10.2 Exploitation
All the wireless communication in the wireless environment is checked and
killed, then restarted for this experimental setup with the command ”sudo
airmon-ng check kill”. The iwconfig command could be useful to check
the communication state in the experimental network for existing wireless
communication. Then the WiFi adapter is restarted with the command ”sudo
airmon-ng start wlan0” and switched to monitor mode, as shown in Figure
5.49. The sudo airedump-ng command is applied on wlan0 to discover the
router’s MAC address (BSSID) and channel for the router and ESSID as well.
We need to switch the WiFi adapter channel to the target router with the
command ”sudo iwconfig wlan0 channel 1” in this test. To this end, all the
preparation for the attack is set up. We can finally start the deauthentication
attack.
The -0 represents deauthentication attack. One could also use –deauth for
the same use, and the second 0 decides the running time of the attack, where 0
represents infinite running time. Furthermore, from the Figure 5.51, it can be
seen that the deauthentication is undergoing, and we can check if the mobile
application can connect to the smart camera now. The deauthentication attack
60 | Penetration Testing
appears to be successful given the fact that the user could really access the
service in any kind as it’s shown in Figure 5.52 and Figure 5.53. During
the time that deauthentication attack is undergoing, the smart camera is
inaccessible through the mobile application. After loading for an annoyingly
long time, a pop-out window displays a notification that the application can
not connect to the device, meaning the connection timed out. When the author
tries to access the camera after closing the pops out, the device appears to be
offline in the user interface. This attack is considered to be successful due to
this unavailability.
5.10.3 Post-exploitation
The smart camera is shown not secure against DoS attack in this work. This
attack needs certain prerequisite on the attackers machine, which are not very
hard to satisfy. At this point, the author understands why this attack is useful
against big corporations and service providers (SP). As aforementioned, this
kind of attack could be prevented by a two-way key exchange protocol with
the token exchange. The solution in [26] applies cryptographic functions and
the generation of unique tokens for a more secure protocol to prevent such
deauthentication attacks targeting 802.11 wireless communications. Note that
Penetration Testing | 61
when the attack is initiated in a virtual Kali Linux machine, the testers might
need a plug-in wireless adapter to enable the WLAN function. During the
check and kill process, it could shut down all the internet connections in the
machine. To restart the network service on the experiment virtual machine,
simply use the ”sudo service Network Manager restart” command.
5.11.1 Method
Typical methods of the attack need to open the case of the device and identify
the memory component, then use a UART cable to download the firmware
62 | Penetration Testing
from the device. However, the hardware operations are out of the scope of the
thesis. Therefore the author found published firmware on the support website
of the D-Link corporate. A tool called binwalk [84] is used in this attack to
analyse the firmware found.
5.11.2 Exploitation
The author first uses the format of Google Dork ”title=DCS-8515LH”
”intext=Firmware Download” to search for DCS-8515LH firmware on the
internet. Then after clicking around more search on the index box, the author
managed to find the firmware on the support page of D-Link TW as the Figure
5.54 shown. This version of the firmware is confirmed to be the latest version
and the current version on the target smart camera. Then, let us proceed to
the binwalk and try to analyze the firmware by seeing what is inside first. So
this extraction does not succeed, the author uses the ”binwalk -I” command
to check to see invalid results. The invalid output is indeed inaccurate since
the .bin file is significantly smaller than the image size displayed. Upon this
unsuccessful attempt, the author considered an earlier version of the firmware,
which is also available on the download page. The result is shown in Figure
5.57.
Two of the above attempts did not give desired extracted firmware.
Penetration Testing | 63
5.11.3 Post-exploitation
The smart camera is shown to be secure against the inspection in this attack.
Reverse engineering is mainly carried out for a few purposes, except for
curiosity about the device. It could also help software or hardware developers
to do security checks that no one could understand or get access to this
internals. The last possibility is a security researcher when doing a security
audit on a piece of hardware to examine the safety and security level of the
device.
Here the author did not find any further detailed information on the
firmware. However, an MD5 checksum and salt hash function are discovered.
The MD5 checksum is applied to the source code to check the integrity of the
data. Moreover, the salt hash function is used on the MD5 checksum for extra
strong encryption of the firmware integrity.
To prevent these kinds of attacks, users could be more alarmed and
cautious about an unknown device firmware update.
64 | Discussion
Chapter 6
Discussion
Among the 11 penetration tests reported in this work, the DoS attacks are
proven to be effective in general. Exploiting the zero-configuration protocol
results in a DoS. Using airmon-ng suite, deauthentication attack blocks the
video stream for the users. Although DoS attack is known as the most
common attack and easiest to implement on IoT devices, it should raise
security considerations on IoT devices to prevent such attacks. The DoS
attacks are again proven in this work to be adequate for the smart camera.
These attacks result in the lost of the video stream, which is the most crucial
function of this smart camera. By disabling this capability, the attacker could
start further criminal activities since the environmental surveillance is gone
for good. When any serious incident happens in the monitor area, the users
are still nowhere to be informed as they should be.
The rest of the attacks are potentially useful for further ethical hacking on
this smart camera. The network inspection discovers massive URLs for the
rtsp protocol and the OS for the device system. This work did not successfully
exploit any open ports on the smart camera, and the URL value remains a
mystery use.
Decomplication of the Android application exposes some important files
like AndroidManifest.xml, which could be beneficial in initiating future
attacks. Moreover, according to the jadx tool, the puzzled classes and another
file in clear text could be analyzed and searched. Injecting malicious code into
the application and uploading it to some open-source application sites can trick
unaware users into installing it.
The ARP poisoning on the traffic discovered vulnerable protocols
like HTTP, and slightly outdated protocols like TLSv1.2. This protocol
is vulnerable to more advanced attacks and needs further investigation.
Discussion | 65
However, the other protocols found, except for mDNS protocol, are
authenticated between the server and the client.
The RTSP protocol is tested and proven to be properly secured on the
smart camera. Based on the no-response requests sent in this work, the RTSP
protocol is healthy and securely working.
In the Android storage system, the application is supposed to store nothing
but the log files. However, some sensitive information data of the user, like
email and location, are stored in clear text. Luckily, the password is not stored
in the system. Another important file is discovered, the system event. This file
indicates whether the camera is functioning well and the connection status,
thus, should have been protected accordingly.
Identification and authentication failures are new names for broken
authentication since 2022. An HTTP URL with a login function is tested
with burp suite and brute force attack. Although burp suite could not insert
anything or replace anything in the request, the brute force attack is expected to
succeed with enough attempts since the login has no restriction on the number
of attempts.
The MiTM attack failed in this work. The mobile application and the server
communicate with a signed certificate; therefore, refuse the connection from
the proxy server. This shows proper protection against MiTM attacks on the
client side.
Attacks on the WiFi direct function forged an AP to trick the camera into
connecting, however this attack did not affect the smart camera. It can be
concluded that the smart camera use more advanced near-field communication
technologies with the phone when in the same local network.
The firmware is available on the TW support page. The firmware is
encrypted with OpenSSL and hashed with MD5 and salt functions. Extraction
or inspection is not performing well, thus indicating that the firmware is
appropriately encrypted and secured.
One thing that should be mentioned is that the camera is somehow in a bug
when turning on. The camera used to rotate to full left, then full right when
plugging in the power cable. However, after a metasploit attack on mDNS
protocol, the camera rotated to full left and stuck with the gear stuck sound for
several seconds.
66 | Conclusions and Future work
Chapter 7
This chapter draws conclusions of this work and states possible future work
accordingly.
7.1 Conclusions
All in all, the smart camera is resilient to most of the attacks performed in this
work. The security implement shows precautions and strong defence against
cyber attacks. Although, it is vulnerable to mDNS protocol and DoS attacks.
Some of the insights about the security level on the camera include but are
not limited to: Improving the storage system security level. Using zeroconf
protocol with authentication on the environment and performing DoS Cloud-
based security or setting up a response plan when encountering such an attack.
The results meet the goal of this work and alert developers of the smart
camera and the mobile application to improve the security level in some
aspects. The selected attacks in this work are moderately effective since the
camera is out of function under some attacks. More attacks based on this work
should open up more security problems and weaknesses in the system. More
specifically, attacks on inserting malicious code in the mobile application are
doable, and more penetration tests on testing the communication protocols are
also reasonable.
The usage of IoT devices has been blowing up in recent years with more
advanced technology. However, it is worth noting to keep the security
implementation along as well. For example, zero-configuration protocols need
to be implemented with corresponding security configurations. Furthermore,
the DoS attacks remain a security problem for the smart camera, just like
most IoT devices. Also, updating the firmware and the mobile application
Conclusions and Future work | 67
7.2 Limitations
The most obvious limitation of this work is time constraints. The author has
much passion for ethical hacking and penetration testing. However, due to the
limited time of the thesis, the number of pentests produced is limited.
Other limitations include hardware hacking, cloud hacking, Bluetooth
communication testing, radio hacking, and IoS application.
The scope is strictly limited to the smart camera, mobile application and
the Redmi Note 11. Noted that any testing on the server or cloud server should
be permitted by the vendor. Any illegal scanning or tampering on the server
could cause legal matters, so as an ethical hacker, keep the hands in the pocket.
The DCS8515-LH smart camera and Redmi Note 11 mobile phone are
provided by NSE lab, and the author has gained permission before rooting the
mobile phone.
70 | References
References
[1] Darren Anstee, “Rise of the internet of things (iot),” 2019. [Online].
Available: https://www.techradar.com/news/rise-of-the-internet-of-thi
ngs-iot [Page 1.]
[3] Sharath Acharya, “Why iot security is important for today’s networks?”
2022. [Online]. Available: https://sectrio.com/why-iot-security-is-imp
ortant-for-todays-networks/ [Page 1.]
[6] Josh Howarth, “80+ amazing iot statistics (2022-2030),” 2022. [Online].
Available: https://explodingtopics.com/blog/iot-stats [Page 2.]
[7] Paul Miller, “Ibm bets 3 billion dollars on internet of things opportunity,”
2015. [Online]. Available: https://www.forbes.com/sites/paulmiller/20
15/03/31/ibm-bets-3-billion-on-internet-of-things-opportunity/?sh=1
87557e8a485 [Page 2.]
[8] H.-H. Kim and J. Yoo, “Analysis of security vulnerabilities for iot
devices.” Journal of Information Processing Systems, vol. 18, no. 4,
2022. [Page 2.]
References | 71
[11] The PTES team, “The penetration testing execution standard,” 2014.
[Online]. Available: http://www.pentest-standard.org/index.php/Main
_Page [Pages 4 and 11.]
[43] G. F. Lyon, Nmap network scanning: The official Nmap project guide to
network discovery and security scanning. Insecure. Com LLC (US),
2008. [Page 28.]
[46] John Sopko, “Andrew file system,” 2014. [Online]. Available: https:
//cs.unc.edu/resources/andrew-file-system-afs/ [Page 29.]
[66] VideoLAN organization, “Vlc media player for debian gnu/linux,” 2022.
[Online]. Available: https://www.videolan.org/vlc/download-debian.ht
ml [Pages 42 and 43.]
[69] Github Contributors, “Db browser for sqlite,” 2022. [Online]. Available:
https://sqlitebrowser.org/ [Page 47.]
[79] Sumeet Wadhwani, “How google foiled the largest ddos attack by
chinese hackers,” 2020. [Online]. Available: https://www.spiceworks.c
om/it-security/network-security/news/how-google-foiled-the-largest-d
dos-attack-by-chinese-hackers/ [Page 58.]
[84] devttys0 and others from ReFirm Labs, “binwalk,” 2022. [Online].
Available: https://github.com/ReFirmLabs/binwalk [Page 62.]
78 | References
[85] Shannon Flynn, “Bluejacking: How bluetooth can be used to hack your
devices,” 2022. [Online]. Available: https://www.makeuseof.com/blue
jacking-hack-your-devices/ [Page 67.]
Appendix A
Previously, the author mostly used the Kali machine on a virtual machine,
which is the Oracle VM VirtualBox. According to the official page of
Kali Linux, live boot Kali provides direct access to hardware, an unaltered
host system and a customized Kali kernel. Compared to limit direct access
to hardware and the system requirements, the bootable kali has undeniable
advantages over virtual machines. Owning a USB bootable kali also allows
the user to bring the USB drive along and does no damage to the host system.
Therefore as part of the setup of the experiment environment, a bootable Kali
is set up.
A USB drive with a storage system that is larger than the Kali image, Etcher
or Rufus burning tool and an official ISO image are needed for this step. First,
plug in the USB and verify that the functionality of the device is running
normally. From lots of failed experiences, a USB from a reliable vendor
is recommended since some of the USB devices could be having unknown
problems when burning the image. Secondly, use etcher or rufus to flash
the ISO file to the USB. After the flash process is done, the bootable Kali
is ready for booting. Last but not least, to be able to save settings and files in
the bootable Kali machine, the user needs to select the Live USB Encrypted
Persistence option to create persistence in the Kali machine.
80 | Appendix A: Installing USB bootable kali machine
Appendix B
This is an additional chapter for a prerequisite for the following attacks, which
include the reasons, the methods and the results for rooting Redmi Note 11
phone.
Root access is always essential when viewing internal storage and granting
access to specific applications and proxies, which is why the author decided
to put this step in the report. Not only because the author spends a lot of time
and effort on it but also because it is very critical for penetration testing.
The booting process starts with unlocking the phone by enabling the
developer options in the system and unlocking it with the official Xiaomi
Unlock tool [86]. After unlocking the phone, a tool called Magisk [87] can
automatically patch the downloaded boot.img file in the application. Then the
fastboot tool is utilized to boot and reboot the system [88]. The cmd power
shell action for gaining root access is shown in Figure B.1. This step is basic,
however it is fundamental for the upcoming exploitation.
www.kth.se