EMBA
Firmware
security
analyzer
@securefirmware
https://github.com/e-m-b-a
Michael Messner, Pascal Eckmann
# whoami
Michael Messner
Penetration tester
Firmware analysis
Hardware analysis
Siemens Energy AG
@s3cur1ty_de
https://github.com/m-1-k-3
@ michael.messner@siemens-energy.com
# whoami
Pascal Eckmann
Cybersecurity Engineer
Security Research
Siemens AG
@_p4cx
https://github.com/p4cx
@ pascal.eckmann@siemens.com
The landscape
What the firmware analysis
• Firmware is the operating system
• Linux analysis techniques can be used quite often and are well known
• Commercial tools are available, but they are expensive and limited
• EMBA has no limits, costs no money and gives the best results
The typical workflow
• Do some strings
• Do some binwalk
• Do some find
• Do some regex
• Do a lot google
• Load something into IDA/Ghidra
• Do something
EMBA to the rescue
Get the firmware (vendor, hardware)
Extract the firmware (e.g., Linux filesystem, Kernel)
Analyze the firmware
Report all the things
Firmware
binary file
EMBA
extractor
modules
EMBA
analyzer
modules
EMBA live
tester
modules
EMBA final
aggregator
Web
report
generator
Access the
firmware
Get the firmware
• Updates from vendor / web site
• Shell access – copy the filesystem via scp, ftp, tftp, nc or to storage device
• Other vulnerabilities e.g., command injection
• JTAG / SWD
• Communication sniffing (e.g., SPI)
• Desolder Flash memory and extract the content
The easiest way
Binwalk all the things
The EMBA extraction process
EMBA
extraction
modules
Identify Linux
root
filesystem
Ext/UFS
filesystems
VMWare
images
Encrypted
images
Special
images
Other
systems
Mount &
copy
Mount &
copy
Decrypt
(leaked keys)
Custom
tool
Binwalk
EMBA
analyzer
Deep
extraction
Ext/UFS filesystems
VMWare images
Encrypted images
Special images
Other systems
Mount & copy
Mount & copy
Decrypt (leaked keys)
Custom
tool (e.g. Freetz NG)
Binwalk
Identify Linux
root
filesystem
OK
Not OK
Always
Basic
compression
Extract
(patool)
Finally, we have something extracted
Which files and directories are there?
Which binaries, configuration files, …
Which architecture are we dealing with?
Which binary protections are in use?
Which Software versions in use?
Is some outdated software in use?
Which areas are from the vendor, which are open source?
Where are possible weak spots or interesting functions used?
Which kernel?
Are there hard-coded passwords?
Scripting issues (shell, python, php, …)?
Insecure permissions?
Weak configurations?
Public exploits?
Dynamic analysis?
Reporting
EMBA
analyzer
modules
Don’t reinvent the wheel
See also: https://github.com/e-m-b-a/emba/wiki/Installation#dependencies
Multiple Linux tools
binwalk
Freetz-NG
Checksec.sh
CVE and CVSS databases
CVE-Search
CVE-Searchsploit
cwe-checker
GHIDRA
Docker
Radare2
fdtdump
linux-exploit-suggester
OpenSSL
uboot mkimage
objdump
pixd
bandit
progpilot
Qemu
shellcheck
sshdcc
tree
unzip
sudo parser
sshdc
Yara
and others …
System mode emulation
Fully automated
What is emulation?
In computing, an emulator is hardware or software that enables
one computer system (called the host) to behave like another
computer system (called the guest).
An emulator typically enables the host system to run software or
use peripheral devices designed for the guest system.*
* https://en.wikipedia.org/wiki/Emulator
Modes of emulation
• User-mode emulation
QEMU can launch Linux processes compiled for one CPU on another
CPU, translating syscalls on the fly.
Modes of emulation
• System-mode emulation
QEMU emulates a full system, including a processor and various
peripherals such as disk, ethernet controller etc.
Challenges:
• Architecture
• Kernel
• Filesystem
• Peripherals
• Furthermore
EMBA live tester modules
• Full system mode emulation goes to automated firmware analysis
• Based on firmadyne and FirmAE*
• Both projects are not actively maintained anymore
• Complete re-implementation as EMBA modules
• Automated testing of emulation and basic checks as additional testing modules
• Multiple improvements of emulation capabilities are already in place
• A lot of room for future improvements (e.g., new kernels)
https://github.com/firmadyne/firmadyne and https://github.com/pr0v3rbs/FirmAE/
EMBA live tester modules - Benchmark*
* https://github.com/pr0v3rbs/FirmAE/#dataset
Demo time
@ pascal.eckmann@siemens.com @ michael.messner@siemens-energy.com
EMBA
Firmware
security
analyzer
@securefirmware
https://github.com/e-m-b-a
Michael Messner, Pascal Eckmann

EMBA - Firmware analysis DEFCON30 demolabs USA 2022

  • 1.
  • 2.
    # whoami Michael Messner Penetrationtester Firmware analysis Hardware analysis Siemens Energy AG @s3cur1ty_de https://github.com/m-1-k-3 @ michael.messner@siemens-energy.com
  • 3.
    # whoami Pascal Eckmann CybersecurityEngineer Security Research Siemens AG @_p4cx https://github.com/p4cx @ pascal.eckmann@siemens.com
  • 4.
  • 5.
    What the firmwareanalysis • Firmware is the operating system • Linux analysis techniques can be used quite often and are well known • Commercial tools are available, but they are expensive and limited • EMBA has no limits, costs no money and gives the best results
  • 6.
    The typical workflow •Do some strings • Do some binwalk • Do some find • Do some regex • Do a lot google • Load something into IDA/Ghidra • Do something
  • 7.
    EMBA to therescue Get the firmware (vendor, hardware) Extract the firmware (e.g., Linux filesystem, Kernel) Analyze the firmware Report all the things Firmware binary file EMBA extractor modules EMBA analyzer modules EMBA live tester modules EMBA final aggregator Web report generator Access the firmware
  • 8.
    Get the firmware •Updates from vendor / web site • Shell access – copy the filesystem via scp, ftp, tftp, nc or to storage device • Other vulnerabilities e.g., command injection • JTAG / SWD • Communication sniffing (e.g., SPI) • Desolder Flash memory and extract the content
  • 9.
  • 10.
    The EMBA extractionprocess EMBA extraction modules Identify Linux root filesystem Ext/UFS filesystems VMWare images Encrypted images Special images Other systems Mount & copy Mount & copy Decrypt (leaked keys) Custom tool Binwalk EMBA analyzer Deep extraction Ext/UFS filesystems VMWare images Encrypted images Special images Other systems Mount & copy Mount & copy Decrypt (leaked keys) Custom tool (e.g. Freetz NG) Binwalk Identify Linux root filesystem OK Not OK Always Basic compression Extract (patool)
  • 11.
    Finally, we havesomething extracted Which files and directories are there? Which binaries, configuration files, … Which architecture are we dealing with? Which binary protections are in use? Which Software versions in use? Is some outdated software in use? Which areas are from the vendor, which are open source? Where are possible weak spots or interesting functions used? Which kernel? Are there hard-coded passwords? Scripting issues (shell, python, php, …)? Insecure permissions? Weak configurations? Public exploits? Dynamic analysis? Reporting EMBA analyzer modules
  • 12.
    Don’t reinvent thewheel See also: https://github.com/e-m-b-a/emba/wiki/Installation#dependencies Multiple Linux tools binwalk Freetz-NG Checksec.sh CVE and CVSS databases CVE-Search CVE-Searchsploit cwe-checker GHIDRA Docker Radare2 fdtdump linux-exploit-suggester OpenSSL uboot mkimage objdump pixd bandit progpilot Qemu shellcheck sshdcc tree unzip sudo parser sshdc Yara and others …
  • 13.
  • 14.
    What is emulation? Incomputing, an emulator is hardware or software that enables one computer system (called the host) to behave like another computer system (called the guest). An emulator typically enables the host system to run software or use peripheral devices designed for the guest system.* * https://en.wikipedia.org/wiki/Emulator
  • 15.
    Modes of emulation •User-mode emulation QEMU can launch Linux processes compiled for one CPU on another CPU, translating syscalls on the fly.
  • 16.
    Modes of emulation •System-mode emulation QEMU emulates a full system, including a processor and various peripherals such as disk, ethernet controller etc. Challenges: • Architecture • Kernel • Filesystem • Peripherals • Furthermore
  • 17.
    EMBA live testermodules • Full system mode emulation goes to automated firmware analysis • Based on firmadyne and FirmAE* • Both projects are not actively maintained anymore • Complete re-implementation as EMBA modules • Automated testing of emulation and basic checks as additional testing modules • Multiple improvements of emulation capabilities are already in place • A lot of room for future improvements (e.g., new kernels) https://github.com/firmadyne/firmadyne and https://github.com/pr0v3rbs/FirmAE/
  • 18.
    EMBA live testermodules - Benchmark* * https://github.com/pr0v3rbs/FirmAE/#dataset
  • 19.
  • 20.
    @ pascal.eckmann@siemens.com @michael.messner@siemens-energy.com EMBA Firmware security analyzer @securefirmware https://github.com/e-m-b-a Michael Messner, Pascal Eckmann