Sthenos: Building Your Own Cross-Architecture Embedded Hacking Arsenal

Felix Eberstaller (Head of Vulnerability Research · Lime Security)

BruCON 0x11 · Day 1 · Gouden Carolus

Overview

In the realm of operational technology (OT) and embedded systems, security assessments often hit a significant roadblock: the sheer diversity and obscurity of target hardware architectures. Felix Eberstaller, Head of Vulnerability Research at Lime Security, presented "Sthenos: Building Your Own Cross-Architecture Embedded Hacking Arsenal" at BruCON, addressing this pervasive challenge. His talk introduced Sthenos, an open-source tool designed to simplify the complex and often frustrating process of cross-compiling essential penetration testing and red teaming utilities for a multitude of embedded CPU architectures.

Watch on YouTube

Visual summary for Sthenos: Building Your Own Cross-Architecture Embedded Hacking Arsenal by Felix Eberstaller
Visual summary for Sthenos: Building Your Own Cross-Architecture Embedded Hacking Arsenal by Felix Eberstaller

Key moments

  1. 0:00 Introduction: The pain of embedded toolchains
  2. 3:00 Why it's hard: CPU architecture challenges
  3. 8:40 Static linking as a solution for portability
  4. 10:00 Introducing Sthenos: Musl vs. Glibc
  5. 16:00 Sthenos demo: Compiling a custom MIPS tool
  6. 28:00 Real-world use case: Solar park assessment
  7. 37:00 Sthenos future plans and community call

Sthenos: Building Your Own Cross-Architecture Embedded Hacking Arsenal

Speakers: Felix Eberstaller, Head of Vulnerability Research, Lime Security

Conference: BruCON

YouTube: https://www.youtube.com/watch?v=j9caOKTUMmQ

Overview

In the realm of operational technology (OT) and embedded systems, security assessments often hit a significant roadblock: the sheer diversity and obscurity of target hardware architectures. Felix Eberstaller, Head of Vulnerability Research at Lime Security, presented "Sthenos: Building Your Own Cross-Architecture Embedded Hacking Arsenal" at BruCON, addressing this pervasive challenge. His talk introduced Sthenos, an open-source tool designed to simplify the complex and often frustrating process of cross-compiling essential penetration testing and red teaming utilities for a multitude of embedded CPU architectures.

The core problem Sthenos tackles is the "pain" of generating functional binaries for systems that frequently deviate from standard x86 or ARM environments. These systems, ranging from industrial control systems (ICS) and SCADA devices to routers and specialized network equipment, often run on obscure MIPS, PowerPC, SPARC, RISC-V, or LoongArch variants, with specific compiler flags for floating-point support, endianness, and C library implementations. Sthenos aims to abstract away this complexity, providing a streamlined, Docker-based solution for creating statically linked binaries that are portable and reliable, even in highly constrained environments where traditional security tools are absent.

Eberstaller highlighted the growing relevance of such a tool not only for OT pentesters but also for red teams. As adversaries seek blind spots, embedded devices, often lacking sophisticated EDR or SIEM solutions, become attractive targets for persistence. Sthenos empowers security professionals to overcome the inherent architectural hurdles, enabling dynamic analysis, exploitation, and reconnaissance on these critical but often overlooked systems.

Background

▶ Watch: Introduction: The pain of embedded toolchains (0:00)

The landscape of embedded systems, particularly within industrial and critical infrastructure environments, presents a unique set of challenges for security researchers and attackers alike. While modern embedded systems increasingly adopt Linux, older or specialized platforms might still run proprietary operating systems like VxWorks, QNX, or even bare-metal code. Regardless of the OS, gaining shell access, whether intended or through exploitation, often necessitates further dynamic analysis, which in turn requires custom tooling.

The fundamental hurdle lies in the vast diversity of CPU architectures and their intricate variants. Unlike the relatively standardized x86 or common ARM architectures, embedded systems can feature:

  • MIPS: A common architecture, but with numerous versions (e.g., MIPS32 V2), endianness (little-endian vs. big-endian), and crucial floating point support differences (hard float vs. soft float). Compiling a binary with hard float support for a soft float architecture will result in an illegal instruction error and crash as soon as a floating-point operation is attempted.
  • PowerPC, SPARC, RISC-V, LoongArch: These, along with other less common architectures, each have their own instruction sets and optional hardware extensions (e.g., crypto acceleration, vector operations) that must be precisely matched during compilation.

Beyond the CPU itself, the choice of C library (libc) is a critical factor. Different implementations exist, such as glibc (GNU C Library), musl, uClibc, dietlibc, and newlib. While all aim for POSIX compliant functionality, they often have distinct extensions and are not always binary compatible. Notably, glibc has numerous versions that are often incompatible with each other, leading to runtime failures if a binary is linked against the wrong version. Furthermore, embedded systems can have non-standard linker paths, which, while patchable with tools like patchelf, add another layer of complexity.

Building a toolchain (compiler, assembler, linker) for these specific targets is arduous. While GCC offers the broadest support across architectures, more modern compilers like Clang or LLVM may lack support for some of the more obscure or older variants. This complexity multiplies when tools have multiple dependencies. For instance, compiling tcpdump requires libpcap, which in turn might have its own dependencies, creating a recursive compilation nightmare where each library needs to be cross-compiled correctly. This process is time-consuming and prone to errors, often consuming significant project resources.

The traditional "oldest trick in the book" to circumvent these dynamic linking issues is static linking. This involves bundling all necessary libraries, including the libc functions, directly into a single executable. The primary advantages are:

  • Portability: The binary runs on any Linux system with the same architecture, regardless of the installed libc version or linker paths.
  • Ease of Deployment: No need to transfer multiple shared libraries or manage LD_LIBRARY_PATH.

However, static linking comes with a significant drawback: binary size. A statically linked curl binary, for example, can be several megabytes, which is often infeasible for storage-constrained embedded systems with limited flash memory (e.g., 4MB ROM).

Previous attempts to simplify this problem, such as NUD's "steady binaries" GitHub repository (which, despite 3.5K stars, was last updated eight years ago and lacks support for modern architectures like RISC-V or LoongArch), or projects like SW packages, have fallen short in providing comprehensive, up-to-date, and easily extensible support for the full spectrum of embedded architectures. This void is precisely what Sthenos aims to fill.

For static linking, the choice of libc is crucial. Eberstaller advocates for musl as the preferred option due to its small footprint, high portability, and POSIX compliance. In contrast, glibc, while widely available and fully POSIX compliant with extensions, is significantly larger due to its extensive legacy code. A simple "Hello World" program, dynamically linked, might be a few kilobytes. Statically linked with musl, it grows to about 20 kilobytes. With glibc, it can balloon to half a megabyte. This size difference becomes critical when deploying an arsenal of tools. Sthenos adopts a strategy of defaulting to musl and falling back to glibc only when a tool requires glibc-specific functions.

Key Findings

▶ Watch: Static linking as a solution for portability (8:40)

Sthenos emerges as a comprehensive solution designed to alleviate the "pain" associated with cross-compiling for diverse embedded architectures. Its key contributions and findings include:

  • Broad Architecture Support: Sthenos supports approximately 50 distinct CPU architectures and their variants, encompassing common platforms like ARM and MIPS (including 10 different MIPS variants), as well as less common or older architectures such as SPARC, PowerPC, RISC-V, and LoongArch. This extensive coverage is a significant improvement over existing solutions.
  • Versatile Compilation Targets: The tool can compile both static binaries (the primary goal for portability) and shared libraries. The ability to generate shared libraries is particularly useful for techniques like LD_PRELOAD, allowing for runtime function overriding, which can be critical for exploits or dynamic analysis.
  • Integrated Tool Arsenal: Sthenos comes pre-packaged with a selection of essential tools for embedded security assessments, including:
  • gdbserver, strace, ltrace for dynamic analysis and reverse engineering.
  • busybox (including a patched "no drop" version to retain SUID bits) for core utilities, netcat, HTTP/FTP servers.
  • Custom reverse shells and shell helpers, demonstrated to be effective in exploiting vulnerabilities like the sudo C hard exploit.
  • TLS preloader for disabling TLS validation across various libraries (OpenSSL, WolfSSL, mbedTLS), aiding in traffic interception.
  • netcat, nmap, microsocks (a tiny SOCKS proxy).
  • Open-Source and Extensible Design: Unlike proprietary or abandoned projects, Sthenos is open-source, promoting transparency and community contribution. Its design, primarily based on Bash scripts and Docker, makes it highly portable and easy to adapt to new architectures or integrate custom tools.
  • Supply Chain Security: Recognizing the inherent risks of downloading source code from various online repositories, Sthenos implements strong supply chain risk mitigation. All dependencies are "pinned" using SHA512 hash verification, ensuring that downloaded source code has not been tampered with.
  • Optimized for Embedded Constraints: By prioritizing musl for static linking, Sthenos generates binaries with a significantly smaller footprint compared to glibc, making them more suitable for storage-constrained embedded devices. The fallback to glibc ensures compatibility for tools that specifically require its extensions.
  • User-Friendly Workflow: Sthenos streamlines the cross-compilation process from days or weeks of manual configuration and debugging into a few simple commands, significantly enhancing efficiency for pentesters and red teamers.

Technical Deep Dive

▶ Watch: Introducing Sthenos: Musl vs. Glibc (10:00)

Sthenos achieves its broad compatibility and ease of use through a well-structured, Docker-based architecture primarily driven by Bash scripts. This design choice is deliberate, leveraging Bash's strengths in managing environment variables and build processes, which are central to cross-compilation.

At its core, Sthenos operates within Docker containers, ensuring that the build environment is isolated, reproducible, and does not "mess up" the host system. This containerization also contributes to its portability, as the entire build chain, including compilers and libraries, is self-contained.

A crucial technical aspect is Sthenos's intelligent approach to C library selection. It defaults to musl for static linking, known for its small size and POSIX compliance. However, it incorporates a fallback mechanism to glibc when a target tool specifically relies on glibc's extensions or non-standard functions. This hybrid approach ensures both minimal binary size for most tools and maximum compatibility for specialized ones.

The build process for integrating a new tool or compiling an existing one follows a consistent pattern, managed by the Bash scripts:

  1. Definition: Each tool's build script defines its source URL and a mandatory SHA512 hash for supply chain risk mitigation. This pinning ensures the integrity of the downloaded source code.
  2. Environment Setup: Functions like create_build_dir and get_output_path prepare the necessary directories.
  3. Source Acquisition: Library functions like download_and_extract handle fetching and unpacking the source code.
  4. Compiler Flags: The tool automatically retrieves appropriate compiler flags for the selected target architecture and libc variant.
  5. Configuration: This is often the most customized part, where configure scripts are invoked with specific options to enable/disable features, define dependencies (e.g., OpenSSL for curl), and set installation paths.
  6. Compilation: A simple make command then initiates the compilation, leveraging the pre-configured toolchain within the Docker environment.

A prime example of the technical challenges Sthenos abstracts away is the compilation of ltrace. This seemingly straightforward utility, which traces library calls, is notoriously difficult to cross-compile statically, especially with musl. Eberstaller detailed the intricate steps:

  1. Base Dependencies: ltrace requires standard libraries like zlib, libm, and libpthread. While zlib is relatively easy, libm and libpthread are part of the libc environment.
  2. lutils Dependency: ltrace depends on lutils, a utility library. This is where the glibc vs. musl conflict becomes prominent. lutils relies on glibc-specific functions such as argp (for argument parsing), arp (for address resolution), and various functions to retrieve stack information, which are often absent or implemented differently in musl.
  3. Custom Patches for lutils: To build lutils with musl, Sthenos requires extensive custom patches. These patches address missing constants and register definitions that are typically defined by glibc but are not present in musl's headers or are defined with different values.
  4. Custom Patches for ltrace: Even after successfully building lutils, ltrace itself demands further custom patches. Similar to lutils, it expects certain register definitions and constants that are part of the glibc environment.
  5. Optional libbfd: For advanced features like symbol demangling, libbfd (Binary File Descriptor library) might also be required, adding another layer of compilation complexity.

This multi-stage patching and dependency resolution for ltrace vividly illustrates the "lot of hoops to jump to" that Sthenos automates. By encapsulating these specific architectural and libc-related quirks within its build scripts, Sthenos transforms what would be days of manual debugging into a single command. The caching mechanism further optimizes this, storing compiled toolchains and common dependencies (like OpenSSL) to accelerate subsequent builds.

Demo / Proof of Concept

▶ Watch: Real-world use case: Solar park assessment (28:00)

Felix Eberstaller's presentation included several compelling demonstrations and real-world use cases that underscored Sthenos's utility.

He began by showcasing the GitHub repository for Sthenos, highlighting a special BruCON release that offers pre-compiled binaries for a wide array of tools and target architectures. This immediate availability allows users to quickly deploy tools without needing to compile them from scratch. For those who prefer to build themselves, the repository provides the full source code and build scripts.

The command-line interface of Sthenos (build.sh) was demonstrated, illustrating its simplicity. Users can list supported tools and architectures using build.sh -h. To compile a specific tool, like nmap, for a particular architecture, such as mips32el-sf (MIPS 32-bit, little-endian, soft float), the command is straightforward: build.sh -t nmap -a mips32el-sf. The demo showed how Sthenos intelligently uses its caching feature, quickly compiling the tool if the toolchain and dependencies are already cached.

A key feature demonstrated was the ability to compile a custom tool. Eberstaller introduced a simple C "canary" program, custom-tool, designed to test fundamental platform functions. By running build.sh -t custom-tool -a mips32el-sf -f (the -f forces a rebuild), the tool was compiled. Verification was done using QEMU (qemu-mips), which successfully executed the custom-tool-musl binary, confirming its validity for the target MIPS architecture. This custom tool serves as an excellent template for users to compile their own C/C++ code without deep interaction with Sthenos's internal build chain.

A compelling real-world scenario involved a solar park assessment. During an on-site penetration test, the team gained root shell access to the LTE modem gateway of the solar park. This device, running on a MIPS architecture, had a severely limited operating system with no useful tools for monitoring network connections. Crucially, they couldn't simply unplug the device. Using Sthenos, the team quickly cross-compiled tcpdump for the target MIPS platform. Deploying this custom tcpdump binary on the gateway allowed them to intercept and analyze all network traffic, successfully identifying remote access connections and saving the assessment. This example perfectly illustrated how Sthenos addresses critical needs in time-sensitive, resource-constrained environments.

For a live demonstration, Eberstaller attempted to showcase Sthenos on a physical OpenWrt router (MIPS-based). While network connectivity issues prevented the full live transfer, the conceptual workflow was clear:

  1. On the attacker's machine, compile busybox-musl using Sthenos.
  2. Use busybox's integrated HTTP server to host the compiled tools.
  3. On the target router, use wget (if available, or busybox's own wget utility) to download the Sthenos-compiled binaries from the attacker's HTTP server into a writable directory like /tmp.
  4. Execute the tools directly on the router.

Despite the live router hiccup, the utility of other Sthenos-compiled tools was shown in QEMU:

  • microsocks: A tiny (around 16KB) SOCKS proxy was demonstrated. Compiling and running microsocks allows for network pivoting across compromised devices, creating a covert channel through the router.
  • ltrace: Running the Sthenos-compiled ltrace on a simple binary in QEMU showcased its ability to trace libc function calls, providing invaluable insights for dynamic analysis and reverse engineering on target systems.

These demonstrations collectively proved Sthenos's capability to generate functional, architecture-specific binaries, empowering security professionals to operate effectively in challenging embedded environments.

Defensive Implications

▶ Watch: Sthenos future plans and community call (37:00)

While Sthenos is primarily an offensive security tool, its capabilities carry significant defensive implications for organizations operating with embedded systems and OT environments. Understanding how attackers can leverage such tools is crucial for building robust defenses:

  1. Custom Tool Deployment: Defenders must recognize that attackers are not limited to pre-installed utilities or common Linux packages. Tools like Sthenos enable adversaries to deploy highly customized, statically linked binaries tailored for any obscure CPU architecture. This means relying solely on known file hashes or typical package manager installations for detection is insufficient.
  2. Blind Spots in Monitoring: Embedded systems, industrial control devices, and network equipment are often "blind spots" in traditional security monitoring. They typically lack EDR (Endpoint Detection and Response) agents or comprehensive SIEM (Security Information and Event Management) integration. Sthenos allows attackers to persist and conduct reconnaissance in these unmonitored areas, making detection extremely difficult.
  3. Bypassing Library Dependencies: The emphasis on static linking with musl means that deployed binaries do not rely on the target system's glibc version or other shared libraries. This bypasses any defensive measures that might assume dynamic linking or specific library versions. Defenders cannot rely on patching glibc alone to mitigate risks from custom binaries.
  4. Enhanced Persistence and Pivoting: Tools like busybox (with full features enabled) and microsocks provide attackers with powerful capabilities for persistence, file transfer, and network pivoting. busybox can act as a fully featured command-and-control utility, while microsocks enables covert SOCKS proxies, allowing attackers to tunnel traffic and traverse segmented networks.
  5. Exploitation of Vulnerabilities: The ability to compile custom reverse shells and LD_PRELOAD libraries (as demonstrated with the sudo C hard exploit) allows attackers to quickly weaponize newly discovered vulnerabilities or adapt existing exploits for specific embedded platforms. This reduces the window for defenders to patch or respond.
  6. Data Exfiltration and Interception: Tools like tcpdump (as shown in the solar park example) and the TLS preloader enable attackers to intercept and analyze network traffic, including encrypted communications, providing valuable intelligence or allowing for data exfiltration.

Defensive Strategies:

  • Network Segmentation and Egress Filtering: Implement strict network segmentation to limit lateral movement. Crucially, enforce strong egress filtering on embedded devices to prevent them from making unauthorized outbound connections, hindering command-and-control and data exfiltration attempts.
  • Integrity Monitoring: Implement file integrity monitoring (FIM) for critical system binaries and directories on embedded devices. Look for unauthorized new executables, especially in writable locations like /tmp or /var.
  • Process Monitoring: Monitor for unusual process execution, such as unknown binaries running from unexpected locations or processes with unusual parent-child relationships.
  • Firmware Hardening and Patching: Regularly update and patch embedded device firmware to address known vulnerabilities. Remove unnecessary services and binaries to reduce the attack surface.
  • Robust Authentication and Access Control: Enforce strong, unique credentials and multi-factor authentication where possible. Implement least privilege access for all users and services on embedded devices.
  • Behavioral Anomaly Detection: Develop baselines for normal network traffic and device behavior. Any deviation, such as a router initiating unexpected outbound connections or a SCADA device running unusual processes, should trigger an alert.
  • Supply Chain Security: For critical embedded components, verify the integrity of firmware and software updates through cryptographic signatures and secure boot mechanisms.

By understanding the offensive capabilities that Sthenos represents, defenders can better anticipate attacker methodologies and implement more effective, tailored security controls for their critical embedded and OT assets.

Key Takeaways

  • Embedded systems present unique security challenges: The vast diversity of CPU architectures, libc implementations, and resource constraints makes traditional security tooling and methodologies ineffective.
  • Sthenos simplifies cross-compilation: The tool automates the complex process of building statically linked binaries for ~50 embedded CPU architectures, significantly reducing the "pain" and time investment for pentesters and red teamers.
  • Static linking with musl is key for portability: Sthenos prioritizes musl for its small footprint and POSIX compliance, generating compact, portable binaries suitable for storage-constrained devices, while falling back to glibc for specific tool requirements.
  • Comprehensive arsenal for dynamic analysis and exploitation: Sthenos includes essential tools like busybox, gdbserver, strace, ltrace, microsocks, and custom shells, enabling deep analysis, persistence, and network pivoting on target systems.
  • Open-source, Docker-based, and secure design: Its Bash-scripted, Docker-containerized architecture ensures ease of use, extensibility, and supply chain security through SHA512 hash pinning of dependencies.
  • Defenders must anticipate custom tooling: Organizations need to assume attackers will deploy specialized, statically linked binaries on embedded and OT devices, necessitating strong network segmentation, egress filtering, file integrity monitoring, and robust access controls as primary defensive strategies.

About the Speaker(s)

Felix Eberstaller is the Head of Vulnerability Research at Lime Security, an Austrian company specializing in OT pentesting, consulting, and training. With over nine years of experience as a researcher, Felix is recognized as an expert in Industrial Control Systems (ICS) and SCADA security, focusing extensively on critical infrastructure and the energy sector. In addition to his professional work, he actively contributes to the security community by writing a blog and developing open-source tools, of which Sthenos is a prime example. His deep practical experience in embedded and OT environments directly informed the development of Sthenos, addressing a significant pain point he encountered in his daily work.

Reviews

Dr. Zero (Offensive Security Researcher) — SOLID

This isn't breaking new exploitation ground, but it's a godsend for anyone who has ever lost three days fighting toolchains to get a static binary onto a MIPS32 router. Eberstaller dropped a highly polished, offensive-focused cross-compilation framework that actually solves the libc footprint problem. If you do OT or IoT device testing, clone this immediately.

Heather Calloway (CISO) — SOLID

Sthenos automates the hardest part of compromising operational technology: cross-compiling toolkits for obscure embedded architectures. For CISOs in manufacturing, energy, or logistics, this signals the end of relying on architectural obscurity as a defensive control. I'd mandate my OT security lead to review our factory-floor egress filtering this week.

→ Top-rated talks at BruCON 0x11

All talks from BruCON 0x11