SlideShare a Scribd company logo
BITS and CHIPSEC as coreboot payloads
OSFC 2018
Piotr Król and Michał Żygowski
1 / 18
Introduction
Motivation
BITS features
CHIPSEC features
Enabling BITS as payload
Enabling CHIPSEC as payload
BITS and CHIPSEC in action (demo)
Summary
Agenda
2 / 18
OSFC 2018
CC BY 4.0 | Piotr Król and Michał Żygowski
Piotr Król Michał Żygowski
Founder & Embedded Systems
Consultant
Firmware Engineer
michal.zygowski@3mdeb.com
linkedin.com/in/michał-żygowski-
88954416b
@pietrushnic
piotr.krol@3mdeb.com
linkedin.com/in/krolpiotr
facebook.com/piotr.krol.756859
Introduction
3 / 18
OSFC 2018
CC BY 4.0 | Piotr Król and Michał Żygowski
How we validate quality of our firmware?
Not enough validation in open source firmware
Firmware security is about validation and formal development process
BITS and CHIPSEC are recognized frameworks for quality checks
Linux UEFI Validation (LUV), what about coreboot?
Certification issues
Motivation
4 / 18
OSFC 2018
CC BY 4.0 | Piotr Król and Michał Żygowski
OS is external firmware customer
firmware is treated as part of hardware and should work out of the box
OS may introduce another point of failures
In following presentation we would like to present our achievements while using
BITS and CHIPSEC as validation payloads for MinnowBoard Turbot.
http://blog.qatestlab.com/wp-content/uploads/2011/02/validation.jpg
Why we should avoid running tests in OS?
5 / 18
OSFC 2018
CC BY 4.0 | Piotr Król and Michał Żygowski
system tables
ACPI
SMBIOS
MultiProcessor tables
$PIR (PCI Interrupt Routing) table
Runtime and Boot Services (Tianocore payload)
any other structure that firmware present to OS
hardware configuration
SPI protection
SMRAM protection
other
spectre mitigation presence
vendor specific features (USB DCI, ME, PSP)
What we should test?
6 / 18
OSFC 2018
CC BY 4.0 | Piotr Król and Michał Żygowski
BITS (BIOS Implementation Test Suite) consist of a GRUB2 bootloader
extended with runtime Python support.
Consist of Python scripts that validate:
ACPI
SMRR configuration
SMI latency
MP Table
MSRs
Typically it is run using bootable USB created using BITS ISO image
Can be run through GRUB menu entries or using batch mode
Results can be read directly on screen or saved to filesystem
Extensibility: Python interpreter in GRUB2
BITS intro
7 / 18
OSFC 2018
CC BY 4.0 | Piotr Król and Michał Żygowski
BITS is quite big in size 45MB - not suitable for SPI flash
was solved by utilizing only core (GRUB2+Python)
Environment is not user friendly - each modification requires SPI reflashing
network boot or using USB for development can solve that
live Python usage
Build system has real problems since it depends on obsolete libraries
we used Docker container for compilation
http://clipground.com/images/constraint-clipart-1.jpg
Constraints
8 / 18
OSFC 2018
CC BY 4.0 | Piotr Król and Michał Żygowski
checks SPI and firmware
protection
verifies integrity of flash descriptor
tests SMM, SMIs and SMM cache
poisoning
checks MSRs, SMRRs and memory
configuration
other various tools:
NMI sending
IOMMU check
TPM, EC utility
CMOS, PCI, SPD utility
etc.
CHIPSEC features
9 / 18
OSFC 2018
CC BY 4.0 | Piotr Król and Michał Żygowski
utilize GRUB from coreboot - already suitable for SPI flash
re-add couple functions required by BITS
grub_strcat
disable support for software floating point arithmetics using
compiler flags
small fixes to printf arguments parsing
port Python support for GRUB
adjust build system
hack BITS to correctly handle paths in SPI flash
isdir hack
enable serial output in toplevel config
LZMA compression
Enabling BITS as payload
10 / 18
OSFC 2018
CC BY 4.0 | Piotr Król and Michał Żygowski
add Python source code to BITS
resolve dependency from Python standard library
BITS has different needs than CHIPSEC
add missing Python standard libraries (xml, JSON, subprocess,
distutils...)
Implement BITS OS helper
Use some methods from BITS as backend for CHIPSEC calls
Enabling CHIPSEC as payload
11 / 18
OSFC 2018
CC BY 4.0 | Piotr Król and Michał Żygowski
Initial size of USB image - 45MB
Cutting off not needed pieces: 12.6MB
UEFI support
LZMA compression: 3.6MB
Solving size issue
12 / 18
OSFC 2018
CC BY 4.0 | Piotr Król and Michał Żygowski
FMAP REGION: COREBOOT
Name Offset Type Size Comp
cbfs master header 0x0 cbfs header 32 none
fallback/romstage 0x80 stage 31372 none
cpu_microcode_blob.bin 0x7b80 microcode 104448 none
fallback/ramstage 0x21400 stage 61533 none
config 0x304c0 raw 669 none
revision 0x307c0 raw 582 none
cmos_layout.bin 0x30a40 cmos_layout 1208 none
fallback/dsdt.aml 0x30f40 raw 12528 none
fallback/payload 0x34080 simple elf 3643338 none <--- HERE
(empty) 0x3ad8c0 null 74968 none
fsp.bin 0x3bfdc0 fsp 229376 none
(empty) 0x3f7e00 null 30936 none
bootblock 0x3ff700 bootblock 1720 none
BITS and CHIPSEC in CBFS
13 / 18
OSFC 2018
CC BY 4.0 | Piotr Król and Michał Żygowski
BITS and CHIPSEC in GRUB
14 / 18
OSFC 2018
CC BY 4.0 | Piotr Król and Michał Żygowski
BITS and CHIPSEC demo
15 / 18
OSFC 2018
CC BY 4.0 | Piotr Król and Michał Żygowski
[CHIPSEC] *************************** SUMMARY ***************************
[CHIPSEC] Time elapsed 2.762
[CHIPSEC] Modules total 17
[CHIPSEC] Modules failed to run 0:
[CHIPSEC] Modules passed 4:
[+] PASSED: chipsec.modules.common.spi_fdopss
[+] PASSED: chipsec.modules.common.bios_ts
[+] PASSED: chipsec.modules.common.bios_kbrd_buffer
[+] PASSED: chipsec.modules.common.smrr
[CHIPSEC] Modules information 0:
[CHIPSEC] Modules failed 5:
[-] FAILED: chipsec.modules.common.memlock
[-] FAILED: chipsec.modules.common.bios_wp
[-] FAILED: chipsec.modules.common.spi_access
[-] FAILED: chipsec.modules.common.spi_desc
[-] FAILED: chipsec.modules.common.spi_lock
[CHIPSEC] Modules with warnings 0:
[CHIPSEC] Modules not implemented 8:
[*] NOT IMPLEMENTED: chipsec.modules.common.ia32cfg
[*] NOT IMPLEMENTED: chipsec.modules.common.bios_smi
[*] NOT IMPLEMENTED: chipsec.modules.common.smm
[*] NOT IMPLEMENTED: chipsec.modules.common.rtclock
[*] NOT IMPLEMENTED: chipsec.modules.memconfig
[*] NOT IMPLEMENTED: chipsec.modules.remap
[*] NOT IMPLEMENTED: chipsec.modules.smm_dma
[*] NOT IMPLEMENTED: chipsec.modules.debugenabled
[CHIPSEC] Modules not applicable 0:
[CHIPSEC] *****************************************************************
Results
16 / 18
OSFC 2018
CC BY 4.0 | Piotr Król and Michał Żygowski
Bare metal (Micro)Python support is important for firmware validation
There is not enough validation in firmware
We should utilize existing tools that were proved in industry
Further steps
Mainlining process
Consider BITS and CHIPSEC port to MicroPython
Fix platform bugs and misconfiguration
Summary
17 / 18
OSFC 2018
CC BY 4.0 | Piotr Król and Michał Żygowski
Q&A
18 / 18
OSFC 2018
CC BY 4.0 | Piotr Król and Michał Żygowski

More Related Content

PDF
Quick Boot A Guide for Embedded Firmware Developers 2nd edition Pete Dice
PDF
Quick Boot A Guide for Embedded Firmware Developers 2nd edition Pete Dice
PDF
Not breaking userspace: the evolving Linux ABI
PDF
How to enable AMD IOMMU in coreboot?
PDF
DEF CON 27 - HUBER AND ROSKOSCH - im on your phone listening attacking voip c...
PPTX
Green IO Conference at apidays Paris 2024 - Track your ML and AI C02 Emission...
PDF
Squeezing Blood From a Stone V1.2
PDF
Next Stop, Android
Quick Boot A Guide for Embedded Firmware Developers 2nd edition Pete Dice
Quick Boot A Guide for Embedded Firmware Developers 2nd edition Pete Dice
Not breaking userspace: the evolving Linux ABI
How to enable AMD IOMMU in coreboot?
DEF CON 27 - HUBER AND ROSKOSCH - im on your phone listening attacking voip c...
Green IO Conference at apidays Paris 2024 - Track your ML and AI C02 Emission...
Squeezing Blood From a Stone V1.2
Next Stop, Android

Similar to BITS and CHIPSEC as coreboot payloads (20)

PDF
Getting started with LinuxBoot Firmware on AArch64 Server
PDF
UM2019 Extended BPF: A New Type of Software
PDF
Linux kernel status in RISC-V
PDF
Lightning talks - Qubes OS and 3mdeb "minisummit" 2019
PDF
Advanced Evasion Techniques by Win32/Gapz
PDF
ebpf and IO Visor: The What, how, and what next!
PDF
PIC Programming and Concept for P184550 Book
PDF
Building a Remote Control Robot with Automotive Grade Linux
PDF
BeagleBone Black Bootloaders
PDF
BeagleBone Black Bootloaders
PPTX
Rasberry pie--- power point presentation
PDF
Systems@Scale 2021 BPF Performance Getting Started
PDF
Embedded Linux BSP Training (Intro)
TXT
Readme
PDF
Making OpenBSD Useful on the Octeon Network Gear by Paul Irofti
PDF
NetConf 2018 BPF Observability
PPTX
ChromePad - Chromium OS ThinkPad X220
PPT
Developing Applications for Beagle Bone Black, Raspberry Pi and SoC Single Bo...
PPTX
ChromePad - Chromium OS for ThinkPad
PDF
Enabling TPM 2.0 on coreboot based devices
Getting started with LinuxBoot Firmware on AArch64 Server
UM2019 Extended BPF: A New Type of Software
Linux kernel status in RISC-V
Lightning talks - Qubes OS and 3mdeb "minisummit" 2019
Advanced Evasion Techniques by Win32/Gapz
ebpf and IO Visor: The What, how, and what next!
PIC Programming and Concept for P184550 Book
Building a Remote Control Robot with Automotive Grade Linux
BeagleBone Black Bootloaders
BeagleBone Black Bootloaders
Rasberry pie--- power point presentation
Systems@Scale 2021 BPF Performance Getting Started
Embedded Linux BSP Training (Intro)
Readme
Making OpenBSD Useful on the Octeon Network Gear by Paul Irofti
NetConf 2018 BPF Observability
ChromePad - Chromium OS ThinkPad X220
Developing Applications for Beagle Bone Black, Raspberry Pi and SoC Single Bo...
ChromePad - Chromium OS for ThinkPad
Enabling TPM 2.0 on coreboot based devices
Ad

More from Piotr Król (8)

PDF
D-RTM for Qubes OS VMs
PDF
S-RTM for Qubes OS VMs
PDF
Qubes hardware certification
PDF
Qubes OS and TPM 2.0
PDF
Status of AEM for Intel and AMD
PDF
RTE v1.0.0 specification
PDF
Booting UEFI-aware OS on coreboot enabled platform - "In God's Name, Why?"
PDF
How to build IoT solution using cloud infrastructure?
D-RTM for Qubes OS VMs
S-RTM for Qubes OS VMs
Qubes hardware certification
Qubes OS and TPM 2.0
Status of AEM for Intel and AMD
RTE v1.0.0 specification
Booting UEFI-aware OS on coreboot enabled platform - "In God's Name, Why?"
How to build IoT solution using cloud infrastructure?
Ad

Recently uploaded (20)

PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PPTX
1. Introduction to Computer Programming.pptx
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PPTX
The various Industrial Revolutions .pptx
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Hybrid model detection and classification of lung cancer
PDF
1 - Historical Antecedents, Social Consideration.pdf
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
DP Operators-handbook-extract for the Mautical Institute
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
WOOl fibre morphology and structure.pdf for textiles
PPTX
cloud_computing_Infrastucture_as_cloud_p
PDF
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
PDF
Developing a website for English-speaking practice to English as a foreign la...
PPTX
TLE Review Electricity (Electricity).pptx
PDF
Web App vs Mobile App What Should You Build First.pdf
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PPTX
Tartificialntelligence_presentation.pptx
PPTX
O2C Customer Invoices to Receipt V15A.pptx
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
1. Introduction to Computer Programming.pptx
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
The various Industrial Revolutions .pptx
NewMind AI Weekly Chronicles - August'25-Week II
Hybrid model detection and classification of lung cancer
1 - Historical Antecedents, Social Consideration.pdf
Final SEM Unit 1 for mit wpu at pune .pptx
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
DP Operators-handbook-extract for the Mautical Institute
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
WOOl fibre morphology and structure.pdf for textiles
cloud_computing_Infrastucture_as_cloud_p
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
Developing a website for English-speaking practice to English as a foreign la...
TLE Review Electricity (Electricity).pptx
Web App vs Mobile App What Should You Build First.pdf
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
Tartificialntelligence_presentation.pptx
O2C Customer Invoices to Receipt V15A.pptx

BITS and CHIPSEC as coreboot payloads

  • 1. BITS and CHIPSEC as coreboot payloads OSFC 2018 Piotr Król and Michał Żygowski 1 / 18
  • 2. Introduction Motivation BITS features CHIPSEC features Enabling BITS as payload Enabling CHIPSEC as payload BITS and CHIPSEC in action (demo) Summary Agenda 2 / 18 OSFC 2018 CC BY 4.0 | Piotr Król and Michał Żygowski
  • 3. Piotr Król Michał Żygowski Founder & Embedded Systems Consultant Firmware Engineer michal.zygowski@3mdeb.com linkedin.com/in/michał-żygowski- 88954416b @pietrushnic piotr.krol@3mdeb.com linkedin.com/in/krolpiotr facebook.com/piotr.krol.756859 Introduction 3 / 18 OSFC 2018 CC BY 4.0 | Piotr Król and Michał Żygowski
  • 4. How we validate quality of our firmware? Not enough validation in open source firmware Firmware security is about validation and formal development process BITS and CHIPSEC are recognized frameworks for quality checks Linux UEFI Validation (LUV), what about coreboot? Certification issues Motivation 4 / 18 OSFC 2018 CC BY 4.0 | Piotr Król and Michał Żygowski
  • 5. OS is external firmware customer firmware is treated as part of hardware and should work out of the box OS may introduce another point of failures In following presentation we would like to present our achievements while using BITS and CHIPSEC as validation payloads for MinnowBoard Turbot. http://blog.qatestlab.com/wp-content/uploads/2011/02/validation.jpg Why we should avoid running tests in OS? 5 / 18 OSFC 2018 CC BY 4.0 | Piotr Król and Michał Żygowski
  • 6. system tables ACPI SMBIOS MultiProcessor tables $PIR (PCI Interrupt Routing) table Runtime and Boot Services (Tianocore payload) any other structure that firmware present to OS hardware configuration SPI protection SMRAM protection other spectre mitigation presence vendor specific features (USB DCI, ME, PSP) What we should test? 6 / 18 OSFC 2018 CC BY 4.0 | Piotr Król and Michał Żygowski
  • 7. BITS (BIOS Implementation Test Suite) consist of a GRUB2 bootloader extended with runtime Python support. Consist of Python scripts that validate: ACPI SMRR configuration SMI latency MP Table MSRs Typically it is run using bootable USB created using BITS ISO image Can be run through GRUB menu entries or using batch mode Results can be read directly on screen or saved to filesystem Extensibility: Python interpreter in GRUB2 BITS intro 7 / 18 OSFC 2018 CC BY 4.0 | Piotr Król and Michał Żygowski
  • 8. BITS is quite big in size 45MB - not suitable for SPI flash was solved by utilizing only core (GRUB2+Python) Environment is not user friendly - each modification requires SPI reflashing network boot or using USB for development can solve that live Python usage Build system has real problems since it depends on obsolete libraries we used Docker container for compilation http://clipground.com/images/constraint-clipart-1.jpg Constraints 8 / 18 OSFC 2018 CC BY 4.0 | Piotr Król and Michał Żygowski
  • 9. checks SPI and firmware protection verifies integrity of flash descriptor tests SMM, SMIs and SMM cache poisoning checks MSRs, SMRRs and memory configuration other various tools: NMI sending IOMMU check TPM, EC utility CMOS, PCI, SPD utility etc. CHIPSEC features 9 / 18 OSFC 2018 CC BY 4.0 | Piotr Król and Michał Żygowski
  • 10. utilize GRUB from coreboot - already suitable for SPI flash re-add couple functions required by BITS grub_strcat disable support for software floating point arithmetics using compiler flags small fixes to printf arguments parsing port Python support for GRUB adjust build system hack BITS to correctly handle paths in SPI flash isdir hack enable serial output in toplevel config LZMA compression Enabling BITS as payload 10 / 18 OSFC 2018 CC BY 4.0 | Piotr Król and Michał Żygowski
  • 11. add Python source code to BITS resolve dependency from Python standard library BITS has different needs than CHIPSEC add missing Python standard libraries (xml, JSON, subprocess, distutils...) Implement BITS OS helper Use some methods from BITS as backend for CHIPSEC calls Enabling CHIPSEC as payload 11 / 18 OSFC 2018 CC BY 4.0 | Piotr Król and Michał Żygowski
  • 12. Initial size of USB image - 45MB Cutting off not needed pieces: 12.6MB UEFI support LZMA compression: 3.6MB Solving size issue 12 / 18 OSFC 2018 CC BY 4.0 | Piotr Król and Michał Żygowski
  • 13. FMAP REGION: COREBOOT Name Offset Type Size Comp cbfs master header 0x0 cbfs header 32 none fallback/romstage 0x80 stage 31372 none cpu_microcode_blob.bin 0x7b80 microcode 104448 none fallback/ramstage 0x21400 stage 61533 none config 0x304c0 raw 669 none revision 0x307c0 raw 582 none cmos_layout.bin 0x30a40 cmos_layout 1208 none fallback/dsdt.aml 0x30f40 raw 12528 none fallback/payload 0x34080 simple elf 3643338 none <--- HERE (empty) 0x3ad8c0 null 74968 none fsp.bin 0x3bfdc0 fsp 229376 none (empty) 0x3f7e00 null 30936 none bootblock 0x3ff700 bootblock 1720 none BITS and CHIPSEC in CBFS 13 / 18 OSFC 2018 CC BY 4.0 | Piotr Król and Michał Żygowski
  • 14. BITS and CHIPSEC in GRUB 14 / 18 OSFC 2018 CC BY 4.0 | Piotr Król and Michał Żygowski
  • 15. BITS and CHIPSEC demo 15 / 18 OSFC 2018 CC BY 4.0 | Piotr Król and Michał Żygowski
  • 16. [CHIPSEC] *************************** SUMMARY *************************** [CHIPSEC] Time elapsed 2.762 [CHIPSEC] Modules total 17 [CHIPSEC] Modules failed to run 0: [CHIPSEC] Modules passed 4: [+] PASSED: chipsec.modules.common.spi_fdopss [+] PASSED: chipsec.modules.common.bios_ts [+] PASSED: chipsec.modules.common.bios_kbrd_buffer [+] PASSED: chipsec.modules.common.smrr [CHIPSEC] Modules information 0: [CHIPSEC] Modules failed 5: [-] FAILED: chipsec.modules.common.memlock [-] FAILED: chipsec.modules.common.bios_wp [-] FAILED: chipsec.modules.common.spi_access [-] FAILED: chipsec.modules.common.spi_desc [-] FAILED: chipsec.modules.common.spi_lock [CHIPSEC] Modules with warnings 0: [CHIPSEC] Modules not implemented 8: [*] NOT IMPLEMENTED: chipsec.modules.common.ia32cfg [*] NOT IMPLEMENTED: chipsec.modules.common.bios_smi [*] NOT IMPLEMENTED: chipsec.modules.common.smm [*] NOT IMPLEMENTED: chipsec.modules.common.rtclock [*] NOT IMPLEMENTED: chipsec.modules.memconfig [*] NOT IMPLEMENTED: chipsec.modules.remap [*] NOT IMPLEMENTED: chipsec.modules.smm_dma [*] NOT IMPLEMENTED: chipsec.modules.debugenabled [CHIPSEC] Modules not applicable 0: [CHIPSEC] ***************************************************************** Results 16 / 18 OSFC 2018 CC BY 4.0 | Piotr Król and Michał Żygowski
  • 17. Bare metal (Micro)Python support is important for firmware validation There is not enough validation in firmware We should utilize existing tools that were proved in industry Further steps Mainlining process Consider BITS and CHIPSEC port to MicroPython Fix platform bugs and misconfiguration Summary 17 / 18 OSFC 2018 CC BY 4.0 | Piotr Król and Michał Żygowski
  • 18. Q&A 18 / 18 OSFC 2018 CC BY 4.0 | Piotr Król and Michał Żygowski