SlideShare a Scribd company logo
12
Most read
13
Most read
19
Most read
Unicorn: The
Ultimate CPU
Emulator
Akshay Ajayan (@r00tus3r)
About me
➢ Akshay Ajayan (@r00tus3r)
➢ Third year B.Tech CSE Undergraduate
○ @Amrita Vishwa Vidyapeetham
➢ CTF Player
○ @teambi0s
➢ Focusing on Software Reverse Engineering
Agenda
➢ CPU Emulator
➢ Unicorn Engine
○ Challenges
○ Qemu vs Unicorn
➢ Demo
➢ Summary
CPU Emulator
Emulates physical CPU using software only
Internals of a CPU Emulator
➢ Decode binary into separate instructions
➢ Emulate exactly what each instruction does
○ ISA Manual reference is required
○ Handle memory access & I/O upon
requested
➢ Update CPU context after each step
Example of emulation
➢ Ex: 01D1 → add eax, ebx
○ load eax & ebx registers
○ add values of eax & ebx, then copy result
to eax
○ update flags OF, SF, ZF, AF, CF, PF
accordingly
Applications
➢ Emulate the code without needing to have a
real CPU
➢ Safely analyze malware code, detect virus
signature
➢ Verify code semantics in reversing
Unicorn Engine
➢ Open source CPU emulator framework
○ www.unicorn-engine.org
➢ Developed by:
○ Nguyen Anh Quynh
■ Computer Security Researcher
○ Dang Hoang Vu
■ Security engineer and researcher
Features
➢ Multi-architectures: Arm, Arm64 (Armv8), M68K,
Mips, Sparc, & X86 (include X86_64)
➢ Clean/simple/lightweight architecture-neutral
API
➢ Implemented in pure C language, with bindings
for Perl, Rust, Python, Java, Go etc
➢ Native support for Windows & *nix (with Mac
OSX, Linux, *BSD & Solaris confirmed)
➢ High performance by using JIT compiler
technique
➢ Support fine-grained instrumentation at various
levels
How was it built?
➢ Forked Qemu?
➢ Were there any challenges?
➢ How is it different?
Unicorn vs Qemu
➢ Independent and flexible framework
➢ Much more compact in size, lightweight in
memory
➢ Thread-safe with multiple architectures
supported in a single binary
➢ Provide interface for dynamic instrumentation
➢ And many more...
Showcase
➢ Radare2
➢ Angr
➢ Usercorn
➢ Cuckoo
➢ Pwndbg
➢ ROPChain
➢ Unicorn.Js
➢ Pwntools
Intro to Unicorn API
➢ The core provides API in C
○ open & close Unicorn instance
○ start & stop emulation
○ read & write memory & registers
○ instrument with user-defined callbacks
for instructions/single-step/memory
event etc
➢ Bindings for multiple languages
Demo 1
Demo 2
Demo 3
Summary
➢ Open source CPU emulator framework
➢ Multi-architecture, Multi-platform
➢ Core in pure C, and support for multiple
binding languages
➢ Build your own tools on top of it
➢ Allows instrumentation at various levels
Questions?
Ping @r00tus3r
References
➢ www.unicorn-engine.org
➢ www.unicorn-engine.org/BHUSA2015-unic
orn.pdf
➢ www.eternal.red/2018/unicorn-engine-tuto
rial

More Related Content

PPTX
DeViL - Detect Virtual Machine in Linux by Sreelakshmi
PDF
EuroBSDCon 2021 - (auto)Installing BSD Systems
PPTX
Buffer overflows
PDF
FreeBSD hosting
PDF
Guest Agents: Support & Implementation
PDF
Porting Puppet to OpenBSD
ODP
Enduro/X Middleware
ODP
How to access your FIWARE Lab Instance.
DeViL - Detect Virtual Machine in Linux by Sreelakshmi
EuroBSDCon 2021 - (auto)Installing BSD Systems
Buffer overflows
FreeBSD hosting
Guest Agents: Support & Implementation
Porting Puppet to OpenBSD
Enduro/X Middleware
How to access your FIWARE Lab Instance.

What's hot (20)

ZIP
Workshop@naha_val3
PDF
Fundamental Virtualisasi di openSUSE
ZIP
Workshop@naha val3
PDF
How can OpenNebula fit your needs - OpenNebulaConf 2013
PDF
2. [Daily hack] Citrix_waf_bypass
PPT
Maemo Development Environment
PDF
Adding Extended Attribute Support to NFS
PDF
Plc2 2015 your own ide
PDF
AV Evasion with the Veil Framework
PDF
Hacking the Linux Kernel - An Introduction
PDF
Veil-Ordnance
PDF
[ENG] Hacker halted 2012 - Zombie browsers, spiced with rootkit extensions
PDF
How Can OpenNebula Fit Your Needs: A European Project Feedback
PPTX
Introduction to .NET
PDF
Kernel Recipes 2013 - Kernel for your device
PPTX
Pentesting tricks - Out with Powershell, in with C#
PDF
Extending bhyve beyond FreeBSD guests - EuroBSDCon 2013
PDF
Quickly Debug VM Failures in OpenStack
ODP
Docker. Micro services for lazy developers
PDF
CodePackager - Pack and Unpack repositories to mobile storage
Workshop@naha_val3
Fundamental Virtualisasi di openSUSE
Workshop@naha val3
How can OpenNebula fit your needs - OpenNebulaConf 2013
2. [Daily hack] Citrix_waf_bypass
Maemo Development Environment
Adding Extended Attribute Support to NFS
Plc2 2015 your own ide
AV Evasion with the Veil Framework
Hacking the Linux Kernel - An Introduction
Veil-Ordnance
[ENG] Hacker halted 2012 - Zombie browsers, spiced with rootkit extensions
How Can OpenNebula Fit Your Needs: A European Project Feedback
Introduction to .NET
Kernel Recipes 2013 - Kernel for your device
Pentesting tricks - Out with Powershell, in with C#
Extending bhyve beyond FreeBSD guests - EuroBSDCon 2013
Quickly Debug VM Failures in OpenStack
Docker. Micro services for lazy developers
CodePackager - Pack and Unpack repositories to mobile storage
Ad

Similar to Unicorn: The Ultimate CPU Emulator by Akshay Ajayan (20)

PDF
VASCAN - Docker and Security
PDF
Heterogeneous multiprocessing on androd and i.mx7
PDF
COMPILER DESIGN.pdf
PDF
[CB19] Semzhu-Project – A self-made new world of embedded hypervisors and att...
PDF
Multi-Processor computing with OpenMP
PDF
Engineer Engineering Software
PDF
Containers > VMs
PPTX
Hands on OpenCL
PDF
Memory Forensics in AWS
PDF
Everything as code
PPTX
Explore asp.net core 3.0 features
PDF
Embedded platform choices
PDF
Introduction to Ewasm - crosslink taipei 2019
ODP
EcoreTools-Next: Executable DSL made (more) accessible
PDF
Craftsmanship in Computational Work
PDF
Linux-Internals-and-Networking
PDF
10 Reasons Why Java Now Rocks More Than Ever
PDF
Zephyr RTOS in One Hour | HARDWARIO @ IoT North UK
PDF
Leveraging Android's Linux Heritage at AnDevCon IV
PPTX
Java vs .Net
VASCAN - Docker and Security
Heterogeneous multiprocessing on androd and i.mx7
COMPILER DESIGN.pdf
[CB19] Semzhu-Project – A self-made new world of embedded hypervisors and att...
Multi-Processor computing with OpenMP
Engineer Engineering Software
Containers > VMs
Hands on OpenCL
Memory Forensics in AWS
Everything as code
Explore asp.net core 3.0 features
Embedded platform choices
Introduction to Ewasm - crosslink taipei 2019
EcoreTools-Next: Executable DSL made (more) accessible
Craftsmanship in Computational Work
Linux-Internals-and-Networking
10 Reasons Why Java Now Rocks More Than Ever
Zephyr RTOS in One Hour | HARDWARIO @ IoT North UK
Leveraging Android's Linux Heritage at AnDevCon IV
Java vs .Net
Ad

More from Cysinfo Cyber Security Community (20)

PDF
Understanding Malware Persistence Techniques by Monnappa K A
PDF
Understanding & analyzing obfuscated malicious web scripts by Vikram Kharvi
PDF
Getting started with cybersecurity through CTFs by Shruti Dixit & Geethna TK
PPTX
Emerging Trends in Cybersecurity by Amar Prusty
PDF
A look into the sanitizer family (ASAN & UBSAN) by Akul Pillai
PDF
Closer look at PHP Unserialization by Ashwin Shenoi
PDF
The Art of Executing JavaScript by Akhil Mahendra
PDF
Reversing and Decrypting Malware Communications by Monnappa
PPTX
Analysis of android apk using adhrit by Abhishek J.M
PDF
Understanding evasive hollow process injection techniques monnappa k a
PPTX
Security challenges in d2d communication by ajithkumar vyasarao
PPTX
S2 e (selective symbolic execution) -shivkrishna a
PPTX
Dynamic binary analysis using angr siddharth muralee
PPTX
Bit flipping attack on aes cbc - ashutosh ahelleya
PDF
Security Analytics using ELK stack
PDF
Linux Malware Analysis
ODP
Introduction to Binary Exploitation
PDF
ATM Malware: Understanding the threat
PPTX
XXE - XML External Entity Attack
PPT
Image (PNG) Forensic Analysis
Understanding Malware Persistence Techniques by Monnappa K A
Understanding & analyzing obfuscated malicious web scripts by Vikram Kharvi
Getting started with cybersecurity through CTFs by Shruti Dixit & Geethna TK
Emerging Trends in Cybersecurity by Amar Prusty
A look into the sanitizer family (ASAN & UBSAN) by Akul Pillai
Closer look at PHP Unserialization by Ashwin Shenoi
The Art of Executing JavaScript by Akhil Mahendra
Reversing and Decrypting Malware Communications by Monnappa
Analysis of android apk using adhrit by Abhishek J.M
Understanding evasive hollow process injection techniques monnappa k a
Security challenges in d2d communication by ajithkumar vyasarao
S2 e (selective symbolic execution) -shivkrishna a
Dynamic binary analysis using angr siddharth muralee
Bit flipping attack on aes cbc - ashutosh ahelleya
Security Analytics using ELK stack
Linux Malware Analysis
Introduction to Binary Exploitation
ATM Malware: Understanding the threat
XXE - XML External Entity Attack
Image (PNG) Forensic Analysis

Recently uploaded (20)

PDF
top salesforce developer skills in 2025.pdf
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PDF
Nekopoi APK 2025 free lastest update
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PDF
iTop VPN Free 5.6.0.5262 Crack latest version 2025
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
System and Network Administration Chapter 2
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
Cost to Outsource Software Development in 2025
PPTX
assetexplorer- product-overview - presentation
PPTX
L1 - Introduction to python Backend.pptx
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
top salesforce developer skills in 2025.pdf
Odoo Companies in India – Driving Business Transformation.pdf
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
Nekopoi APK 2025 free lastest update
Odoo POS Development Services by CandidRoot Solutions
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Why Generative AI is the Future of Content, Code & Creativity?
iTop VPN Free 5.6.0.5262 Crack latest version 2025
Navsoft: AI-Powered Business Solutions & Custom Software Development
Wondershare Filmora 15 Crack With Activation Key [2025
Operating system designcfffgfgggggggvggggggggg
System and Network Administration Chapter 2
CHAPTER 2 - PM Management and IT Context
Design an Analysis of Algorithms I-SECS-1021-03
Which alternative to Crystal Reports is best for small or large businesses.pdf
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Cost to Outsource Software Development in 2025
assetexplorer- product-overview - presentation
L1 - Introduction to python Backend.pptx
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf

Unicorn: The Ultimate CPU Emulator by Akshay Ajayan

  • 2. About me ➢ Akshay Ajayan (@r00tus3r) ➢ Third year B.Tech CSE Undergraduate ○ @Amrita Vishwa Vidyapeetham ➢ CTF Player ○ @teambi0s ➢ Focusing on Software Reverse Engineering
  • 3. Agenda ➢ CPU Emulator ➢ Unicorn Engine ○ Challenges ○ Qemu vs Unicorn ➢ Demo ➢ Summary
  • 4. CPU Emulator Emulates physical CPU using software only
  • 5. Internals of a CPU Emulator ➢ Decode binary into separate instructions ➢ Emulate exactly what each instruction does ○ ISA Manual reference is required ○ Handle memory access & I/O upon requested ➢ Update CPU context after each step
  • 6. Example of emulation ➢ Ex: 01D1 → add eax, ebx ○ load eax & ebx registers ○ add values of eax & ebx, then copy result to eax ○ update flags OF, SF, ZF, AF, CF, PF accordingly
  • 7. Applications ➢ Emulate the code without needing to have a real CPU ➢ Safely analyze malware code, detect virus signature ➢ Verify code semantics in reversing
  • 8. Unicorn Engine ➢ Open source CPU emulator framework ○ www.unicorn-engine.org ➢ Developed by: ○ Nguyen Anh Quynh ■ Computer Security Researcher ○ Dang Hoang Vu ■ Security engineer and researcher
  • 9. Features ➢ Multi-architectures: Arm, Arm64 (Armv8), M68K, Mips, Sparc, & X86 (include X86_64) ➢ Clean/simple/lightweight architecture-neutral API ➢ Implemented in pure C language, with bindings for Perl, Rust, Python, Java, Go etc
  • 10. ➢ Native support for Windows & *nix (with Mac OSX, Linux, *BSD & Solaris confirmed) ➢ High performance by using JIT compiler technique ➢ Support fine-grained instrumentation at various levels
  • 11. How was it built? ➢ Forked Qemu? ➢ Were there any challenges? ➢ How is it different?
  • 12. Unicorn vs Qemu ➢ Independent and flexible framework ➢ Much more compact in size, lightweight in memory ➢ Thread-safe with multiple architectures supported in a single binary ➢ Provide interface for dynamic instrumentation ➢ And many more...
  • 13. Showcase ➢ Radare2 ➢ Angr ➢ Usercorn ➢ Cuckoo ➢ Pwndbg ➢ ROPChain ➢ Unicorn.Js ➢ Pwntools
  • 14. Intro to Unicorn API ➢ The core provides API in C ○ open & close Unicorn instance ○ start & stop emulation ○ read & write memory & registers ○ instrument with user-defined callbacks for instructions/single-step/memory event etc ➢ Bindings for multiple languages
  • 18. Summary ➢ Open source CPU emulator framework ➢ Multi-architecture, Multi-platform ➢ Core in pure C, and support for multiple binding languages ➢ Build your own tools on top of it ➢ Allows instrumentation at various levels Questions? Ping @r00tus3r