Threat, Research and Workaround

The insecurity of smart Internet-connected or so-called “IoT” devices has become more concerning than ever. The existence of malware exploiting vulnerable, often poorly secured and configured Internet-facing devices has been known for many years. Hardware vendors and the entire security industry are struggling to fight the adversaries while trying to build better and safer products. Unfortunately, IoT threats and malware analysis remain the two biggest challenges in the security industry.

Modern IoT threats and malware are moving towards various platforms and CPU architecture. Reverse engineers are struggling to cope and understand different operating systems and CPU architecture. Besides, lack of updated tools makes the situation worse. Current available tools are nowhere near to catch up with the speed of fast-growing security threat.

Common techniques used to perform analysis such as full system emulation, user-mode emulation, binary instrumentation, disassembler and sandboxing are just barely sufficient. These tools are either serving single type operating system or works on one CPU architecture. Also, these tools need to be used separately, streamlining information or cross referencing data is almost impossible. These are the reasons why reverse engineering is never an easy task.

  • [1] Research from SonicWall has revealed that a record high of 10.52bn malware attacks occurred in 2018 indicating an escalation in the volume of cyberattacks as well as new targeted threat tactics used by cybercriminals


Qiling Framework is aimed to change IoT security research, malware analysis and reverse engineering landscape. The main objective is to build a cross-platform and multi-architecture framework and not just another reverse engineering tool.

Qiling Framework is designed as a binary instrumentation and binary emulation framework that supports cross-platform and multi-architecture. It is packed with powerful features such as code interception and arbitrary code injection before or during a binary execution. It is also able to patch a packed binary during execution.

Qiling Framework is open source and it is written in Python, a simple and commonly used programming language. This will encourage continuous contributions from the security and open-source community. Hence, making the Qiling Framework a sustainable project.

What is Qiling Framework

Qiling Framework is not just an emulation platform or a reverse engineering tool. It combines binary instrumentation and binary emulation into one single framework. With Qiling Framework, it able to:

  • Redirect process execution flow on the fly
  • Hot-patching binary during execution
  • Code injection during execution
  • Partial binary execution, without running the entire file
  • Patch a “unpacked” content of a packed binary file

Qiling Framework is able to emulate:

  • Windows X86 32/64bit
  • Linux X86 32/64bit, ARM, AARCH64, MIPS
  • MacOS X86 32/64bit
  • FreeBSD X86 32/64bit
  • UEFI

Qiling Framework is able to run on top of Linux/FreeBSD/MacOS/Windows(WSL) without CPU architecture limitation

How Qiling Framework Works

Demo Setup
  • Hardware : X86 64bit
  • OS : Ubuntu 18.04 64bit
Demo #1 Solving simple CTF challenge with Qiling Framework and IDAPro

Mini Qiling Framework tutorial : how to work with IDAPro

qiling DEMO 1: Catching wannacry's killer switch

Demo #2 Fuzzing with Qiling Unicornalf

More information on fuzzing with Qiling can be found here.

qiling DEMO 2: Fuzzing with Qiling Unicornalf

Demo #3 Emulating ARM router firmware on Ubuntu X64 machine

Qiling Framework hot-patch and emulates ARM router’s /usr/bin/httpd on a X86_64Bit Ubuntu

qiling DEMO 3: Fully emulating httpd from ARM router firmware with Qiling on Ubuntu X64 machine

import os, socket, sys, threading
from qiling import *

def patcher(ql):
    br0_addr ="br0".encode() + b'\x00')
    for addr in br0_addr:
        ql.mem.write(addr, b'lo\x00')

def nvram_listener():
    server_address = 'rootfs/var/cfm_socket'
    data = ""
    except OSError:  
        if os.path.exists(server_address):  

    # Create UDS socket  
    sock = socket.socket(socket.AF_UNIX,socket.SOCK_STREAM)  
    while True:  
        connection, client_address = sock.accept()  
            while True:  
                data += str(connection.recv(1024))
                if "lan.webiplansslen" in data:  
                elif "wan_ifname" in data:
                elif "wan_ifnames" in data:
                elif "wan0_ifname" in data:
                elif "wan0_ifnames" in data:
                elif "sys.workmode" in data:
                elif "wan1.ip" in data:
                data = ""

def my_sandbox(path, rootfs):
    ql = Qiling(path, rootfs, output = "debug")
    ql.hook_address(patcher ,ql.loader.elf_entry)

if __name__ == "__main__":
    nvram_listener_therad =  threading.Thread(target=nvram_listener, daemon=True)
    my_sandbox(["rootfs/bin/httpd"], "rootfs")

Demo #4 Emulating UEFI

Qiling Framework emulates UEFI

qiling DEMO 4: Emulating UEFI

import sys
import pickle
from qiling import *
from qiling.os.uefi.const import *

def force_notify_RegisterProtocolNotify(ql, address, params):
    event_id = params['Event']
    if event_id in[event_id]['Guid'] = params["Protocol"]
        # let's force notify
        event =[event_id]
        event["Set"] = True
        ql.loader.notify_list.append((event_id, event['NotifyFunction'], event['NotifyContext']))
        return EFI_SUCCESS

if __name__ == "__main__":
    with open("rootfs/x8664_efi/rom2_nvar.pickel", 'rb') as f:
        env = pickle.load(f)
    ql = Qiling(["rootfs/x8664_efi/bin/TcgPlatformSetupPolicy"], "rootfs/x8664_efi", env=env)
    ql.set_api("hook_RegisterProtocolNotify", force_notify_RegisterProtocolNotify)