Reader small image

You're reading from  Attacking and Exploiting Modern Web Applications

Product typeBook
Published inAug 2023
PublisherPackt
ISBN-139781801816298
Edition1st Edition
Concepts
Right arrow
Authors (2):
Simone Onofri
Simone Onofri
author image
Simone Onofri

Simone Onofri is a cybersecurity director with over two decades of experience in Red and Blue Teaming, vulnerability research, and product management. He has been an instructor at the Joint Intelligence and EW Training Centre and is associated with global companies such as HewlettPackard Enterprise. Simone has discovered various vulnerabilities and holds key certifications such as GXPN, GREM, GWAPT, OSCP, and OPSA. An active participant in organizations such as OWASP and ISECOM, he regularly speaks at major conferences, including TEDx. Simone is committed to inspiring and educating industry professionals and enthusiasts through his work, with a mission to create a positive influence.
Read more about Simone Onofri

Donato Onofri
Donato Onofri
author image
Donato Onofri

Donato Onofri is a seasoned Red Team engineer. He has over a decade of experience in activities including reverse engineering, Red Teaming, threat research, and penetration testing. Passionate about both the offensive and defensive sides of cybersecurity, Donato has worked with industry leaders such as CrowdStrike and Hewlett-Packard Enterprise and as an advisor and engineer for governments and financial institutions. His research delves into state-of-the-art security techniques, malware analysis, and internals. He holds the GREM, GXPN, OSCP, OSCE, and OSWE certifications, and his expertise is underscored by multiple recognitions for vulnerability discovery.
Read more about Donato Onofri

View More author details
Right arrow

Attacking IoT Devices – Command Injection and Path Traversal

He therefore vigorously strode to the apt door, turned the knob, and pulled on the release bolt. The door refused to open. It said, “Five cents, please.”

He searched his pockets. No more coins; nothing. “I’ll pay you tomorrow,” he told the door. Again he tried the knob. Again it remained locked tight. “What I pay you,” he informed it, “is in the nature of a gratuity; I don’t have to pay you.”

“I think otherwise,” the door said. “Look in the purchase contract you signed when you bought this conapt.”

In his desk drawer, he found the contract; since signing it he had found it necessary to refer to the document many times. Sure enough; payment to his door for opening and shutting constituted a mandatory fee. Not a tip.

“You discover I’m right,” the door said. It sounded smug.

From the drawer...

Technical requirements

You can use the Ubuntu LTS machine configured in Chapter 2 in this chapter. In addition, we will use Ghidra for reverse engineering and QEMU for emulation. We will install it in the Emulation section of this chapter, as well as a few other tools.

Ghidra

Ghidra is a versatile software reverse engineering tool developed by the National Security Agency Research Directorate. It offers numerous features, including disassembly, assembly, decompilation, graphing, and scripting. It supports a broad range of processor instruction sets and executable formats and is designed for both interactive and automated – Java or Python – usage.

To install Ghidra, please follow the website’s instructions [2].

Physical device

The physical GL.iNet 300M Mini Smart Router device, GL-AR300M16 [3], with firmware version 3.215 (the latest at the time of writing), is also recommended for the dynamic analysis part. However, we will explain how to emulate...

IoT router exploitation scenario introduction

In this scenario, we will analyze and attack an IoT device that we hold dear to our hearts – the performance version of Mango [4 and 5] called Shadow.

These devices are travel routes from GL.iNet [6], which are highly versatile and can be used in several ways. The primary purpose for which it was presented was to protect ourselves when traveling, especially when staying in hotels. While this may seem like paranoia to some, we must remember the 2014 DarkHotel attacks [7], where hotel Wi-Fi was used to attack unsuspecting visitors.

We selected Shadow as our target IoT device for this scenario for several reasons. First, it is a cheap device, accessible to a broad range of people who may be interested in conducting their experiments. Second, it is readily available, so you can easily acquire and explore its capabilities. Finally, it’s a valuable device for those who are particularly security-conscious.

In this chapter...

How to analyze IoT devices

As we noted from the attacks, we can have a home, Small Office/Home Office (SOHO), or enterprise-grade and industrial devices.

IoT device analysis

Let’s begin by understanding how devices are structured, particularly home devices, SOHO use, or bio-medical and wearable devices.

Although they are all very different, be they routers, printers, NAS, cameras, DVRs, smart watches, insulin pumps, machines, kettles, switches, or light bulbs, we can break these devices down by their common elements:

  • Physical/electronic components analysis: This is the analysis of the hardware component of the device that physically contains information and the data we’re interested in. Firstly, we can examine the device from the outside to gather valuable information such as the model name, default settings, serial codes, and IDs such as FCC certification or CMIIT, which we can use to conduct further research online.

Then, we can disassemble the...

How to find and exploit vulnerabilities in IoT devices

We will begin working on our IoT device by performing basic physical analysis, looking into previous research, doing a mix of dynamic and static analysis to understand better how to exploit the vulnerabilities, and finally, creating and using a reverse shell.

Basic physical analysis

When we have the Shadow device in front of us, we can gather valuable information by examining its external features:

Figure 5.1 – Back of the Shadow device

Figure 5.1 – Back of the Shadow device

If we turn it over, we can read details such as the following:

  • Name: GL.iNet 300M Mini Smart Router
  • Model: GL-AR300M16
  • IP: 192.168.8.1
  • SSID: GL-AR300M-***-***
  • Key: goodlife
  • MAC: 98:83:C4:**:**:**
  • S/N: ************
  • DDNS: ***.gl-inet.com

We can also find crucial identification codes, such as the following:

  • FCC ID (the device ID registered with the United States Federal Communications Commission): 2AFIW-AR300M16...

Summary

In this chapter, we learned how to analyze IoT devices using their components and where to find IoT devices in industrial control system networks. We also saw how to find and exploit vulnerabilities in IoT devices using basic physical analysis. Then, we learned how to download and extract the firmware and emulate the firmware, and reverse binaries from Ghidra. Then, we explored how to exploit Abuse of Functionalities and parameter injection, even if command injection is fixed, and how to exploit a path traversal. We also learned how to create a reverse shell for OpenWrt.

We want to conclude with a brief note on industrial network security. Exploiting vulnerabilities in industrial devices has always been intriguing, and we’ve reported such vulnerabilities in the past [51]. However, while traveling globally to evaluate industrial network risks, we recognized the importance of understanding these networks’ structures and the types of devices they house beyond...

Further reading

This chapter covered many topics. If you like to dive deeper, we’re happy to share some valuable resources with you:

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Attacking and Exploiting Modern Web Applications
Published in: Aug 2023Publisher: PacktISBN-13: 9781801816298
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Authors (2)

author image
Simone Onofri

Simone Onofri is a cybersecurity director with over two decades of experience in Red and Blue Teaming, vulnerability research, and product management. He has been an instructor at the Joint Intelligence and EW Training Centre and is associated with global companies such as HewlettPackard Enterprise. Simone has discovered various vulnerabilities and holds key certifications such as GXPN, GREM, GWAPT, OSCP, and OPSA. An active participant in organizations such as OWASP and ISECOM, he regularly speaks at major conferences, including TEDx. Simone is committed to inspiring and educating industry professionals and enthusiasts through his work, with a mission to create a positive influence.
Read more about Simone Onofri

author image
Donato Onofri

Donato Onofri is a seasoned Red Team engineer. He has over a decade of experience in activities including reverse engineering, Red Teaming, threat research, and penetration testing. Passionate about both the offensive and defensive sides of cybersecurity, Donato has worked with industry leaders such as CrowdStrike and Hewlett-Packard Enterprise and as an advisor and engineer for governments and financial institutions. His research delves into state-of-the-art security techniques, malware analysis, and internals. He holds the GREM, GXPN, OSCP, OSCE, and OSWE certifications, and his expertise is underscored by multiple recognitions for vulnerability discovery.
Read more about Donato Onofri