> For the complete documentation index, see [llms.txt](https://strik3r.gitbook.io/strik3r-blog/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://strik3r.gitbook.io/strik3r-blog/security-blogs/hacking-iot-101.md).

# Hacking IoT 101

<figure><img src="/files/LxmyC2cnugqr4mPzLff1" alt=""><figcaption></figcaption></figure>

### <mark style="color:green;">Internet of Things (IoT)</mark> <a href="#toc118075810" id="toc118075810"></a>

The Internet of Things (IoT) is the ability to have devices communicate with one another via the internet or other networks, remotely tracking information to provide feedback to assist with decisions as well as sharing information, enabling communication, and allowing action and interaction through automation and machine learning.

IoT devices don’t exist in a void. A lone sensor isn’t good for developing something big, nor is a group of them, for that matter, unless they are all connected to one another and to platforms that generate data for further use. This is what we call an **Internet of Things (IoT) ecosystem** – a broad network of connected and interdependent devices and technologies that are applied by specialists towards a specific goal such as the creation of a smart city.

there are limitless applications to the IoT and therefore we can speak of endless coexisting IoT ecosystems. But if we simplified what is happening in the ecosystem, we will come up with a simple schema: a **device** collects data and sends it across the **network** to a **platform** that aggregates the data for future use by the **agent**. And so we have the key components to an IoT ecosystem: devices, networks, platforms, and agents.

### <mark style="color:green;">IoT Pentesting</mark> <a href="#toc118075811" id="toc118075811"></a>

An IoT penetration test is the assessment and exploitation of various components present in an IoT device solution to help make the device more secure. Unlike traditional penetration tests, IoT involves several various components.

A typical penetration testing engagement looks like this infographic

![](/files/L9FkDTUudBnCzfkB2lDO)

### <mark style="color:green;">Attack Surface Mapping</mark> <a href="#toc118075812" id="toc118075812"></a>

The process of attack surface mapping means mapping out all the various entry points that an attacker could potentially abuse in an IoT device solution. This is the first step, and one of the most important ones, in the entire IoT pentesting methodology. It also involves creating an architecture diagram of the entire product from a pentester’s perspective.

This step is useful because it helps you understand the architecture of the entire solution, and at the same time helps you establish various tests that you would run on the product, sorted by priority.

once you get a new target, take time to understand it first. This means going through all the possible channels and collecting information for example:

* Documentation and manuals
* online resources and posts about the product
* Any available content or prior research about the device.
* Any CVE or public content or prior research about the device

When we look at an IoT solution, the entire architecture can be broadly divided into three categories:

**1. Embedded device.**

**2. Firmware, software, and applications.**

**3. Radio communications**

Each of the categories mentioned next serve as an introduction to component with very much details

Our goal in analyzing the IoT device for attack surface mapping would be to categorize the functionality and the security threats corresponding to each category.

### <mark style="color:green;">Embedded Devices</mark>

An embedded device is the key to any IoT device architecture and is also the “thing” in the Internet of Things. The embedded device in an IoT product can be used for several different purposes depending on the user case scenario. It could be used as a hub for the entire IoT architecture of the device, it could serve as the sensor that collects data from its physical surroundings, or it could be used as a way of displaying the data or performing the action intended by the user.&#x20;

Thus, the things in Internet of Things could be used to collect, monitor, and analyze data, and perform actions.

To clarify this with a real-world example, think of a smart home IoT product. There are many devices that together make the smart home IoT product. These include a smart gateway or the hub, smart lightbulbs,motion sensors, smart switches, and additional connected devices.

Even though the devices serve different purposes, for the most part, the approach to test these devices for security issues would be the same

The following are some of the vulnerabilities found in embedded devices:

* Serial ports exposed.
* Insecure authentication mechanism used in the serial ports.
* Ability to dump the firmware over JTAG or via Flash chips.
* External media-based attacks.
* Power analysis and side channel-based attacks

For now, let\`s focus on category num 2 ( Firmware, software, and applications )

### <mark style="color:green;">Firmware, Software, and Applications</mark> <a href="#toc118075813" id="toc118075813"></a>

This is the software part of an IoT device, which includes everything from the firmware that runs on the device, the mobile applications that are used to control the device, to the cloud components connected to the device, and so on.

These are also the components where you can apply the traditional pentesting experience to the IoT ecosystem. This would also involve topics such as reverse engineering of binaries of different architectures including Advanced RISC Machines (ARM) and MIPS, as well as reverse engineering of mobile applications. These components can often help you uncover many secrets and find vulnerabilities.

Examining the many ways that we can access the specific component we want to test is one of the other goals during the pentesting of software-based components. For example, in order to test the firmware for vulnerabilities, we would need access to the firmware, which is frequently difficult to obtain.

Additionally, we must put a lot of effort into reverse engineering the communication APIs in order to understand how the various IoT device components interact with one another and determine the communication protocols in use.

Firmware is a piece of code residing on the nonvolatile section of the device, allowing and enabling the device to perform different tasks required for its functioning. It consists of various components such as kernel, bootloader, file system, and additional resources. It also helps in the functioning of various hardware components for the IoT device.

If we look at a real-world IoT device, a smart home will have the following components:

<mark style="color:orange;">**Mobile application:**</mark> This allows us to control the smart devices—turning the lights on and off, adding new devices to the smart home system, and so on. Typically,you will have mobile applications for Android and iOS platforms, which are the two dominant mobile application platforms as of this writing.

There are several attacks that are possible in mobile applications that could reveal sensitive information from the device or how the device works.&#x20;

<mark style="color:orange;">**Web-based dashboard:**</mark> This allows the user to monitor the device, view analytics and usage information, control permissions for the devices, and so on. Most of the IoT devices that you will encounter will have a web interface where you can access the data sent from the device to the web endpoint. If the web application is vulnerable, it could allow you to access unauthorized data, which could be the data of the same user or any other user using the same IoT device, which has been the case with many IoT devices in the past, notably baby monitors&#x20;

<mark style="color:orange;">**Insecure network interfaces:**</mark> These are the components of the IoT device that are exposed over the network and could be compromised because of vulnerabilities in the exposed network interface. This could be either an exposed port that accepts connection to the service without any sort of authentication, or a service that is running a vulnerable and outdated version that has known vulnerabilities against that specific version.&#x20;

<mark style="color:orange;">**Firmware:**</mark> This controls the various components on the device and is responsible for all the actions on the device. You can think of it as the component that holds the keys to the kingdom. Pretty much anything that you can imagine that could be extracted from the device can be found in the firmware

### <mark style="color:green;">Getting the Firmware Binary</mark> <a href="#toc118075814" id="toc118075814"></a>

The first thing to learn to perform IoT exploitation is to get hold of the device’s firmware. Depending on the device you are targeting, the ways of getting to the firmware binary may be different.

* Getting it online is one of the most common ways of getting hold of the firmware binary. As you go further in your IoT security journey, you will notice that a lot of manufacturers decide to put their firmware binary package online on either their Support page or the Downloads section of their website.
* Extracting from the device. This means that once you have physical access to the device, using various hardware exploitation techniques, you can dump the firmware from the device’s flash chip and then run additional analysis on it
* Sniffing Over the Air (OTA) is another common technique of getting to the firmware binary package while the device is performing an update.

The process here is to set up a network interceptor for the device. As soon as the device queries for downloading the new firmware image from the server, you will be able to extract it from the network capture.

### <mark style="color:green;">Extracting Firmware</mark> <a href="#toc118075815" id="toc118075815"></a>

Once we have a firmware image, one of the most important things we can do with it is extract the file system from the binary image.

In this example I used [binwalk](https://github.com/ReFirmLabs/binwalk). This tool helps us with the extraction of the file system from a firmware binary image.

Setting up Binwalk on kali linux is quite straightforward:

```bash
sudo apt install binwalk
```

let\`s assume that we have a bin firmware ready to download

Once we have the firmware, let’s fire up Binwalk and extract it

![](/files/hPmXONFywLvmjTqQSqWk)

```bash
sudo binwalk -Me –dd=".*" {product_firmware.bin} --run-as=root
```

After binwalk extracts our firmware, we will notice a new dir `/{SOME PRODUCT FIRM.BIN}.extracted` which contains these dirs and files.

![](/files/3r296d4OvPp6RN1gL7iN)

At this point, it’s essential to get a deeper knowledge of what firmware holds.&#x20;

To understand firmware, we must first understand the specific things that firmware holds.

1. <mark style="color:orange;">**Bootloader**</mark><mark style="color:orange;">:</mark> A bootloader for an embedded system is responsible for numerous tasks such as initializing various critical hardware components and allocating the required resources.
2. <mark style="color:orange;">**Kernel**</mark><mark style="color:orange;">:</mark> Kernel is one of the core components of the entire embedded device. Speaking at a very general level, a kernel is simply an intermediary layer between the hardware and the software.
3. <mark style="color:orange;">**File system**</mark><mark style="color:orange;">:</mark> The file system is where all the individual files necessary for the embedded device runtime are stored. This also includes components such as web servers and network services.

But this maybe differ from one firmware to another depends on the product.

At this point, we explained almost the essential information or small part of what we need to know before doing IoT Hacking.

### <mark style="color:green;">Conclusion</mark> <a href="#toc118075834" id="toc118075834"></a>

Many innovative and fascinating applications are now possible through the Internet of Things (IoT), but it also creates many new risks related to information security. IoT systems and gadgets are notoriously unsafe, as demonstrated by a number of recent attacks against them. Additionally, It has also been shown that a major part of the attacks resulted in full adversarial control over IoT devices, and the reason for this is that IoT devices themselves are weakly protected and they often cannot resist even the most basic attacks.

For me, it was very exciting to learn more about this topic and I will continue to search about it.

### <mark style="color:green;">Reference</mark>

* The IoT Hacker's Handbook

> Thanks For Reading, Hope you enjoyed it 😊

|                       Follow Me                       |
| :---------------------------------------------------: |
|  [LinkedIn](https://www.linkedin.com/in/eslam-kamal/) |
| [Facebook](https://www.facebook.com/StrikerHacker33/) |
|     [Twitter](https://twitter.com/xxEslam_Kamalxx)    |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://strik3r.gitbook.io/strik3r-blog/security-blogs/hacking-iot-101.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
