Most server motherboards include a Baseboard Management Controller (BMC): a small, separate computer that runs independently of the main CPU and manages power, sensors, fans, and remote access. On most boards the BMC runs proprietary firmware, and while OpenBMC is an open source replacement, hardware support is per board and usually requires some reverse engineering and debugging.

The Supermicro X11SSM-F, a sibling of the X11SSH-F and X11SSL-F, was for a long time the main server-grade motherboard with coreboot support, thanks to the port by 9elements. These boards are now fairly cheap on the secondhand market and a good platform to experiment with open firmware. Its BMC is an ASPEED AST2400. We based this port on the earlier OpenBMC work for the closely related X11SSH-F by HardenedVault and by 3mdeb, which we used as a starting point.

We have been working on this both for the infrastructure we run ourselves, including our Tor nodes, and for the associative ISP ProcioNet that some of us also run.

The Supermicro X11SSM-F motherboard layout, from the board manual.
The Supermicro X11SSM-F motherboard layout, from the board manual.

Terminology #

  • BMC: the management controller. Here, an ASPEED AST2400 (a 32-bit ARM926 SoC) with its own 128 MiB of RAM and a 32 MiB SPI flash chip. ASPEED parts are the common choice for this role; the newest, the AST2600, adds more hardware security measures.
  • AHB (Advanced High-performance Bus): the AST2400’s internal bus. It connects the CPU, clocks, memory controller and flash controller.
  • SuperIO: a legacy I/O block exposed to the host over the LPC bus. On this board the AST2400 is itself the SuperIO.
  • CVE-2019-6260: a set of ASPEED debug bridges that let the host reach the BMC’s AHB from the host side. Vendor firmware usually leaves them enabled.

Starting in emulation #

The first step, as always, is recon. The board shipped with firmware 1.78 and the latest was 1.82, so we downloaded both and checked public CVEs, to see whether code execution was reachable with something already known. It probably was, but the bug hunting was part of the fun, so we took 1.82 as our baseline. We then ran the stock firmware under QEMU’s supermicrox11-bmc machine, which emulates an AST2400. Running the stock image in the emulator speeds up static reverse engineering: we can probe the vendor’s tools and firmware layout, and develop and test the flashing and boot tooling before touching real hardware.

An emulator does not reproduce the real I/O and interfaces of the hardware. Some of those can be modelled in QEMU, but with no real effect. When the hardware is available, debugging on it is less error prone.

Getting code execution on the BMC #

The vendor firmware exposes many interfaces, but SSH only reaches their SMASH shell; there is no way to run commands on the underlying operating system, which is really just a very old U-Boot and Linux. We quickly found an authenticated remote code execution vulnerability in the stock firmware. It was a previously unknown issue, one of five we reported to Supermicro (more on this after the disclosure process), including an unauthenticated but less reliable one. For our own board an authenticated RCE is enough, and the stock firmware even ships a friendly gdbserver. We exploited the issue and then patched dropbear to spawn /bin/sh instead of the SMASH binary.

From there we probed the stock tools to map the register states, communication interfaces, drivers, and addresses, and built tooling that lets an agent automatically power cycle, exploit, test, and debug, as described below.

Testing kernels from RAM #

Flashing directly during development, with no hardware way to recover, is a bad idea. We can reflash the SPI chip as root, but with no serial access (to drive U-Boot, for instance) and no hardware programmer, any panic that leaves the BMC off the network is unrecoverable.

With code execution on the BMC, most testing needs no flashing at all: we can swap the running kernel directly. We wrote a small loader that places a kernel and ramdisk into unused BMC DRAM (above the region the stock kernel uses), plus a short ARM stub that stops the SoC’s DMA engines and jumps to the new kernel. This is effectively a minimal kexec implementation.

This let us iterate on an OpenBMC kernel and device tree on real hardware without ever writing to flash: a broken boot needed only a power cycle. For visibility we enabled ramoops, which keeps the kernel console in a DRAM ring buffer that survives a reset; we read it back from the vendor BMC’s root shell after a soft reboot.

The software-only development loop: entry point, recon, kexec, ramoops, and recovery
The software-only development loop: entry point, recon, kexec, ramoops, and recovery

culvert, and a patch #

Later we found culvert, a tool that reaches the BMC’s internal bus from the host through the CVE-2019-6260 debug bridges and can drive the ASPEED flash controller. It did not work on this board out of the box, however: culvert had no AST2400 flash support, and its AST2400 clock gating (used to pause the ARM so the host can take the flash controller) wrote a register directly, overwriting unrelated strap bits and hanging the bus.

We fixed both: we added the AST2400 flash controller node, and changed the clock gating to a read-modify-write that preserves the other bits. The two changes are small and are now submitted upstream.

Verifying the flash path #

Before writing anything, we verified the full read and write path:

  1. We read the entire 32 MiB flash back over the P2A bridge and kept it as an exact copy.
  2. We erased the chip and wrote that same stock image back, verified the read-back matched byte for byte, and confirmed the BMC booted the stock firmware again.

Since erase, program, verify, and boot all worked over the host interface, we decided to move forward and try to write a real OpenBMC image, based on the previous work and our own discoveries.

How we locked ourselves out #

The write succeeded and verified, but as we waited for it to start answering pings, it never came up, and every bridge from the host to the BMC now returned 0xffffffff.

It turns out we flashed the wrong image: one we had tested in RAM via the procedure above, but never in QEMU, and which had a different partition layout than flash booting needs. The device tree still described the flash with the layout we had used for RAM booting, a single read-only partition, rather than the real OpenBMC layout (bootloader, environment, kernel, read-only root, read-write overlay). With no root filesystem to mount, OpenBMC’s init stops and the kernel panics. We reproduced this exactly in QEMU afterwards; it was not a hardware fault.

The second mistake made the failure unrecoverable. OpenBMC, correctly and unlike the vendor firmware, hardens itself against access driven from the host. Our image was broken, but the kernel still came up far enough to apply that hardening: the aspeed-p2a-ctrl driver disabled the P2A bridge, and the SuperIO decode fronting the iLPC2AHB bridge was then turned off.

The result is a BMC that is powered but unreachable: we cannot reach it through culvert, nor on its own. In theory there is a window during bring-up where culvert should work, during the U-Boot phase, before the kernel loads the hardening driver. But we cannot power cycle the BMC without cycling the host, so from software alone we can never win the race of having the host already up while the BMC is still booting. Recovery now needs hands on the board: toggling the JPB1 BMC-enable jumper, or, failing that, using a SOIC clip and a flash programmer to restore it.

What the attempt produced #

The port is not finished, but the work has concrete results, which we will build on.

A connectivity map of the BMC. Supermicro does not publish schematics, so we reconstructed the relevant parts from probing, the firmware, coreboot, and the manual:

  • the flash is a 32 MiB MX25L25635F (SOIC-16), near the PCH’s fourth PCIe slot;
  • the host reaches the BMC over LPC (the AST2400 is the board’s SuperIO: COM ports, KCS/IPMI at 0xca2, a virtual UART) and over PCIe (an AST1150 bridge to the ASPEED VGA function; BAR0 is the framebuffer, BAR1 is the P2A window);
  • the BMC console is UART5, which this board does not route to any accessible header; the host’s COM1/COM2 are the AST2400’s SuperIO UARTs, not the BMC console;
  • eth0 is MAC1 over NC-SI to the host NIC; eth1 is MAC2 over RGMII to the dedicated IPMI port;
How the host reaches the BMC’s internal AHB bus through the SuperIO (iLPC2AHB) and PCIe (P2A) bridges
How the host reaches the BMC’s internal AHB bus through the SuperIO (iLPC2AHB) and PCIe (P2A) bridges

We also produced an upstream culvert patch, adding AST2400 flash support and fixing the clock gating. As we restore the board, we will finish the work and also offer patches for OpenBMC upstream.

Conclusion #

This was an experiment in doing hardware work without physical access to the board. It was also a good way to understand several of the components better, in particular the bridges between the host and the BMC. We scripted most of the process: power control through a relay driven over the network, so the board could reboot on its own, and then the exploitation and the tests. With that in place we could compile, test, and collect logs with no manual steps. Loops like this are efficient, especially on boards where OpenBMC already boots.

We will continue our research into firmware and into opening up more of our infrastructure, contributing upstream where possible. We will publish a writeup of the vulnerabilities, and hopefully the final part of this porting work, in the coming weeks.