<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta>
      <journal-title-group>
        <journal-title>February</journal-title>
      </journal-title-group>
      <issn pub-type="ppub">1613-0073</issn>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>Usage for Embedded Applications: Safety and Portability Considerations</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Tancredi Orlando</string-name>
          <email>tancredi.orlando@studenti.unime.it</email>
          <xref ref-type="aff" rid="aff1">1</xref>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Luca D'Agati</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>FrancescoLongo</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Giovanni Merlino</string-name>
          <email>gmerlino@unime.it</email>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Workshop</string-name>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>National Interuniversity Consortium for Informatics (CINI)</institution>
          ,
          <addr-line>Via Ariosto 25, 00185 Rome</addr-line>
          ,
          <country country="IT">Italy</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>University of Messina, Department of Engineering</institution>
          ,
          <addr-line>Contrada di Dio, 98166 Sant'Agata, Messina</addr-line>
          ,
          <country country="IT">Italy</country>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>WebAssembly</institution>
          ,
          <addr-line>Embedded Systems, Safety, Portability, Virtual Machines, WASI</addr-line>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2025</year>
      </pub-date>
      <volume>0</volume>
      <fpage>3</fpage>
      <lpage>8</lpage>
      <abstract>
        <p>WebAssembly is the standard technology to accelerate web-based applications that need to perform computeintensive workloads. Lower-level languages such aCs, C++, and Rust can be used to implement functionalities that are executed by user agents, providing an alternative to JavaScript for performance-critical tasks. In this domain, safety and portability are key aspects: the former is essential to protect users from malicious modules while the latter enables having the exact same WebAssembly code to run seamlessly across browsers, operating systems and hardware architectures.</p>
      </abstract>
      <kwd-group>
        <kwd>Considerations</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        The swift expansion of the Internet of Things ( IoT) and advancements in embedded devices have
underscored the growing need for secure and portable software solutions across diverse environments.
By 2030, the number of embedded systems worldwide is expected to surpass 25 billion [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], reflecting
their critical role in industries ranging from healthcare to manufacturing. Despite their widespread
adoption, the development of embedded systems remains fragmented, largely due to the diversity of
hardware architectures and the lack of standardized software interfaces.
      </p>
      <p>WebAssembly ( Wasm), originally designed to enhance the performance of Web applications, has
emerged as a promising technology to address the challenges of a fragmented compute ecosystem. Its
portable binary instruction format and sandboxed execution model make it a valid option for devices
with heterogeneous architectures that require a robust security model. By abstracting platform-specific
details through a virtual machine,Wasm enables applications to run consistently across diferent
environments, from browsers to standalone runtimes. However, the transition ofWasm from Web
environments to embedded systems introduces new challenges, particularly in achieving seamless
cross-platform portability and ensuring safety in resource-constrained devices.</p>
      <p>This research aims to explore the benefits and challenges of adopting Wasm in embedded
environments, focusing on two critical aspects: safety and portability. Specifically, it investigates how
Wasm’s safety features can enhance memory isolation in systems lacking hardware memory protection</p>
      <p>CEUR</p>
      <p>ceur-ws.org
and evaluates whether its portability promises hold in embedded contexts. Furthermore, it addresses
challenges such as the lack of native support for access to hardware resources and proposes potential
solutions, including Hardware Abstraction LayersH(ALs).</p>
      <p>To address theWasm portability challenges outside of Web environments, the WebAssembly System
Interface (WASI) was introduced as an extension to enhanceWasm’s applicability beyond the browser.
WASI defines a standardized set of APIs for system-level operations, such as file I/O, networking, and
time management, aiming to provide a consistent interface forWasm applications across cloud, desktop,
and edge environments. Despite its potential, the applicability ofWASI to embedded systems remains
limited. Embedded devices often lack full-fledged operating systems and require low-level access to
hardware resources, such asGPIOs and peripherals, whichWASI does not natively support.</p>
      <p>The remainder of this paper is structured as follows. Section 2 analyzes the core principles of
Wasm, focusing on its safety mechanisms and portability features. Section 3 examines the unique
challenges faced by embedded systems, with a focus on security and cross-platform execution. Section
4 investigates the integration ofWasm in embedded systems, analyzing runtime implementations and
emerging solutions for hardware abstraction. Section 5 discusses open challenges in the evolution of
Wasm, particularly in the context of embedded applications.</p>
    </sec>
    <sec id="sec-2">
      <title>2. WebAssembly: Safety and Portability Features</title>
      <p>Wasm combines robust safety guarantees with broad portability features, making it well-suited for
heterogeneous computing environments. Its sandboxed execution model ensures that code runs
securely within strict boundaries, while its platform-agnostic design enables consistent execution across
heterogeneous hardware architectures and operating systems. These complementary attributes form the
foundation of WebAssembly’s design philosophy, addressing security and cross-platform compatibility
as core concerns rather than afterthoughts.</p>
      <p>
        The fundamental deployment and execution unit is aWasm module, that can be represented in both a
human-readable text format (WAT) [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] and a compact binary format W(ASM) [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], with the latter being
the one executed by Wasm runtimes. Modules structure resemble an ELF file, with distinct sections
for diferent types of content. These sections include type definitions, function declarations, tables for
indirect function calls, linear memory specifications, global variables, and export declarations. The
explicit boundary between the module and its host environment is maintained through the import/export
mechanism, where modules explicitly declare functions they require from the host (imports) and
functions they make available to the host (exports). This design allows for predictable interactions while
preserving the security guarantees of the execution model. Prior to execution, each module undergoes
validation to ensure conformance with theWasm specification, including type-checking, providing
static guarantees that complement runtime safety mechanisms.
      </p>
      <p>Figure 1 illustrates howWasm operates, highlighting both its internal memory model and its
integration within a broader application environment 4[]. It shows howWasm executes code and interacts
with other system components.</p>
      <p>The Wasm memory model, shown in Figure 1a, consists of distinct memory regions. The operand
stack is explicitly managed usingWasm instructions and serves as temporary storage for intermediate
computations. MostWasm instructions interact with this stack in some way. For example, instructions
such as local.get and i32.const push values onto the stack. Arithmetic and logical instructions
(i32.add, f64.mul, i32.and) take their operands from the stack and push the result back onto it.</p>
      <p>Separately,Wasm maintains an internal shadow stack, which is managed by the runtime and used to
track function calls, return addresses, and local variables. Unlike the operand stack, the shadow stack
is not accessible toWasm code, ensuring control-flow integrity by preventing direct manipulation of
return addresses.</p>
      <p>The linear memory is a contiguous, byte-addressable region that is entirely separate from the operand
stack and serves as the primary data storage foWrasm programs. Unlike the operand stack, which is
automatically managed, linear memory must be explicitly allocated and resized by theWasm module</p>
      <p>Lmineema_rsMizeemory</p>
      <sec id="sec-2-1">
        <title>Virtual Machine</title>
        <p>0
0x8F00
0x91AA
0x5C41
0x7F12
Call 2
0x5C41</p>
        <sec id="sec-2-1-1">
          <title>Wasm</title>
        </sec>
        <sec id="sec-2-1-2">
          <title>Instructions</title>
          <p>Push</p>
          <p>Pop
mem_size
Stack
(a) Diagram of the Wasm memory model illustrating the
interactions between the operand stack, linear memory, and
instruction execution. The operand stack handles intermediate
computations, the linear memory serves as the primary data
storage, and the instruction execution manages operations on
these components.</p>
        </sec>
      </sec>
      <sec id="sec-2-2">
        <title>Application</title>
        <p>E
x
p
o
s
e
d
F
u
n
c
it
o
n
s</p>
        <p>E
x
p
o
s
e
d
F
u
n
c
it
o
n
s
JS</p>
        <p>WA</p>
        <p>Linear Memory</p>
        <p>Runtime (Browser, Node.js, ...)
(b) Architecture of a typicalWasm
application demonstrating the integration
between Wasm modules and JavaScript
within a managed execution
environment, such as a browser or Node.js.
using instructions such asmemory.grow. Instructions like i32.load, i32.store, and memory.fill
allow Wasm modules to read from and write to linear memory, providing a structured approach to data
storage.</p>
        <p>Figure 1b illustrates the design of a typical application integratinWgasm with JavaScript. TheWasm
module runs within a managed execution environment, such as a browser or Node.js, where it interacts
with JavaScript through function calls and a shared linear memory space. While this shared memory
enables eficient data exchange between Wasm and JavaScript, it also requires careful management to
prevent unintended access or memory safety violations. The interaction between the two is strictly
controlled, with Wasm exposing only explicitly defined functions, reducing the risk of unauthorized
memory access or corruption, as the shared memory is separated from the host’s memory. This
mechanism allows Wasm to integrate with WebAPIs, event-driven architectures, and external resources
while preserving the security guarantees of the execution environment.</p>
        <p>
          This architecture ensures a balance between performance and safety. The sandboxed design isolates
Wasm modules while enabling eficient communication with host environments through shared linear
memory and exposed function interfaces.
2.1. Safety
Wasm’s security model is designed with a multi-layered approach that protects users from potentially
buggy or malicious modules while providing developers with powerful primitives for creating secure
applications. At its core,Wasm represents a carefully designed typed assembly language 5[] that
enforces strict safety guarantees through a combination of static validation and runtime mechanisms.
Sandboxing Wasm modules operate within a sandboxed environment that employs fault isolation
techniques to prevent applications from directly interacting with the host system. This isolation
ensures that modules execute independently and cannot access system resources without going through
controlled APIs [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ]. For instance, in web browsers,Wasm modules are isolated from the Document
Object Model (DOM) [
          <xref ref-type="bibr" rid="ref7">7</xref>
          ] and other browser and operating system resources, ensuring that untrusted
programs cannot manipulate sensitive user data or execute arbitrary commands. This principle extends
to other environments such as serverless computing platforms, where secure execution of untrusted
code is essential to prevent cross-function interference or system breaches.
        </p>
        <p>
          Static Validation and Type Safety Before execution, the Wasm modules undergo a comprehensive
validation to ensure conformity with theWasm specification. The specification explicitly requires
that allWasm code must be validated to guarantee safe execution8[]. Wasm modules must explicitly
declare all accessible functions along with their associated types, ensuring that functions and their
parameters are well-defined and type-checked before execution. Unlike most native architectures, Wasm
enforces a strong typing system for all globals, locals, and function arguments and results. This static
type-checking prevents type confusion vulnerabilities and ensures the integrity of function calls [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ].
Separation of Memory Spaces Wasm enforces a strict separation between the operand stack (used
for function execution) and linear memory (used for general-purpose storage). The operand stack is
used exclusively for temporary computation and is not directly addressable byWasm code, making it
immune to direct corruption. This prevents common exploit techniques that rely on overwriting control
data, such as stack-smashing attacks. In contrast, linear memory is mutable and accessible tWoasm
code, making it a potential target for memory corruption vulnerabilities. AlthoughWasm enforces
bounds checking to prevent out-of-bounds reads and writes, vulnerabilities such as bufer overflows,
use-after-free, and data corruption within the allocated memory region remain possible [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ]. Developers
must carefully manage memory operations to prevent unintended modification of data structures or
security-sensitive information.
        </p>
        <p>
          Data Execution Prevention Wasm enforces Data Execution Prevention D(EP) by strictly separating
executable code from writable memory. The linear memory space is never executable, preventing
code injection attacks. Additionally,Wasm code itself is stored in an immutable, read-only section
inaccessible to the application, meaning that an attacker cannot overwrite existing instructions or
introduce new executable code at runtime. This design makes common exploitation techniques such as
shellcode injection, just-in-time spraying, and self-modifying code attacks infeasible.
Structured Control Flow Instructions within a function are organized into well-defined nested
blocks, with branching operations restricted to jumps to the end of surrounding blocks within the same
function. This strict control prevents jumps to arbitrary addresses and disallows the use of unstructured
goto statements [
          <xref ref-type="bibr" rid="ref10 ref6 ref9">6, 9, 10</xref>
          ]. As a result, executing data in memory as bytecode instructions is not possible,
mitigating exploit techniques like return-oriented programming (ROP) [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ].
        </p>
        <p>
          Shadow Stack Protection Wasm enhances control-flow security by employing a shadow stack,
managed by the Wasm virtual machine and containing return addresses and local variables. Unlike
native execution environments where return addresses are stored directly on the program’s stack,
Wasm’s shadow stack is inaccessible to the executing module, preventing adversaries from modifying
return addresses to hijack control flow. This mitigates common attack techniques such as return address
corruption andROP, which rely on tampering with saved return addresses to execute arbitrary code.
By enforcing an immutable call-return discipline, the shadow stack significantly strengthens Wasm’s
control-flow integrity ( CFI) [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ].
2.2. Portability
Wasm is designed as a portable binary instruction format, intended to execute consistently across diverse
environments, operating systems, and hardware architectures 1[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]. Initially conceived to accelerate
web applications [
          <xref ref-type="bibr" rid="ref12">12</xref>
          ], Wasm has since expanded beyond browsers to run in cloud environments,
IsolatesWasm modules by confining their execution within Privilege escalation,
unauthoa restricted environment, preventing access to system rized system access.
resources without explicit permissions [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ].
        </p>
        <p>Statically verifies that a module conforms to the Wasm Execution of malformed or
malispecification before execution, ensuring that all operations cious binaries, undefined
behavare well-formed and type-safe. ior, type confusion attacks.</p>
        <p>
          Enforces strict typing for function calls, memory accesses, Type confusion vulnerabilities,
and data, ensuring that operations adhere to declared improper memory accesses,
types [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ]. type-based exploitation.
        </p>
        <p>Enforces separation between the operand stack and linear Stack smashing, arbitrary
memmemory, preventing direct corruption of execution state. ory corruption, control data
overwrite.</p>
        <p>
          Enforces structured control flow by restricting branches Control-flow hijacking,
arbito valid targets within well-defined blocks [
          <xref ref-type="bibr" rid="ref6 ref9">6, 9</xref>
          ]. trary code execution,
jumporiented programming.
        </p>
        <p>Maintains an internal, inaccessible stack for storing return Return address corruption, ROP
addresses and call metadata, preventing tampering with attacks, call stack manipulation.
the call/return sequence.</p>
        <p>Ensures linear memory is never executable and code sec- Code injection, shellcode
exetions are immutable, preventing the execution of injected cution, self-modifying code
atcode. tacks.
edge computing platforms, and embedded systems with minimal changes to its core specification,
demonstrating its remarkable portability.</p>
        <p>At its foundation,Wasm achieves portability through a carefully designed stack-based virtual machine
architecture. This approach enables developers to compile code from languages likCe, C++, and Rust
into Wasm modules that can execute wherever a compatible runtime exists, eliminating the need to
tailor applications for each target environment. By providing a consistent runtime environmentW,asm
ensures that applications behave predictably regardless of the underlying platform.
Well-defined Specification The specification outlines a well-defined module structure organized
into various sections, including type declarations, imports, exports, and code definitions. This
standardized structure ensures thatWasm modules can be reliably interpreted across diferent environments.
Wasm provides a compact, well-defined instruction set that includes operations for arithmetic, control
lfow, memory access, and function calls. The limited and precisely specified instruction set contributes
to consistent execution behavior across platforms. The specification includes a rigorous type system
with basic scalar types such as integers and floating-point numbers, along with a type-checking
algorithm that ensures type safety. This type-checking helps prevent platform-specific behaviors that could
compromise portability.</p>
        <p>
          Canonical Execution Environment The Wasm specification assumes that execution environments
ofer characteristics such as 8-bit wide bytes, single byte memory addressing granularity, support for
unaligned memory accesses, two’s complement integers, IEEE 754 floating point numbers, little endian
byte ordering, lock-free atomic operations on 8, 16 and 32-bit values and secure isolation between
Wasm modules. Platforms that do not natively provide these capabilities can still executWeasm code by
having the virtual machine emulate the required behavior, although this may impact performance 1[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ].
        </p>
        <p>
          Host Environment Integration Wasm achieves portability while still allowing interaction with host
environments through a controlled mechanism known as embedding [
          <xref ref-type="bibr" rid="ref13">13</xref>
          ]. Wasm modules can declare
functions they require from the host environment. The Wasm runtime must provide implementations
for these imported functions, allowing modules to access host capabilities. Modules can export functions,
enabling the host environment to call intoWasm code. This bidirectional communication facilitates
integration with diverse host platforms while maintaining a clean separation between thWeasm
execution environment and platform-specific details. This design creates a clear boundary between
portable Wasm code and platform-specific functionality, enhancing portability while enabling practical
application development.
        </p>
        <p>
          Limitations of WebAssembly The core Wasm specification intentionally omits built-in system
calls and common interfaces for accessing underlying system resources such as file systems, network
interfaces, or hardware peripherals 1[
          <xref ref-type="bibr" rid="ref2">2</xref>
          ]. While this design choice enhances security and portability, it
introduces significant limitations for applications requiring system-level interactions, particularly in
embedded contexts. To address this limitation, developers often leverage host-specific APIs or custom
runtime extensions to implement system calls. While this approach provides flexibility, it introduces
fragmentation as diferent environments may require distinct integration strategies.
WebAssembly System Interface To address these limitations without compromising portability,
WASI [
          <xref ref-type="bibr" rid="ref14">14</xref>
          ] has emerged as a standardized solution foWrasm modules to interact with the host
environment in a consistent way across diferent platforms. WASI provides a set of standardizedAPIs for
essential system-level operations such as file I/O, networking, and time management. By
abstracting platform-specific details, WASI enhances portability for applications running on general-purpose
operating systems. WASI is designed around a capability-based security model where applications
must be explicitly granted access to specific resources, enhancing security while providing necessary
functionality.
3. Embedded Systems: Safety and Portability Challenges
The increasing connectivity of embedded systems has created significant security vulnerabilities that
traditional enterprise and desktop computing security techniques fail to address adequately. Resource
constraints represent a fundamental challenge, as embedded systems typically employ low-cost
processors with limited CPU capacity, memory, and power [
          <xref ref-type="bibr" rid="ref15">15</xref>
          ]. These constraints often preclude the
implementation of advanced security mechanisms such as Address Space Layout RandomizationA(SLR),
Data Execution Prevention D(EP), and Control-Flow Integrity (CFI) [
          <xref ref-type="bibr" rid="ref16">16</xref>
          ].
        </p>
        <p>
          Market pressures compound these technical limitations. Manufacturers prioritize producing
featurerich chips at minimal cost, often neglecting long-term security and maintenance considerations. This
economic model creates little incentive to update older devices once deployed, leaving them vulnerable
to emerging threats. Even newly deployed embedded systems frequently run software several years
behind current versions, and available security patches are seldom applied [
          <xref ref-type="bibr" rid="ref17">17</xref>
          ].
        </p>
        <p>
          Programming errors constitute the primary source of vulnerabilities in embedded systems, typically
exploited through bufer overflows or malicious input injection. Weak access control mechanisms
frequently fail to properly authenticate users or enforce secure access policies, creating opportunities for
privilege escalation or impersonation attacks. Additionally, implementation errors in protocol handling
represent another common vulnerability source, more prevalent than design flaws in the protocols
themselves [
          <xref ref-type="bibr" rid="ref18">18</xref>
          ].
        </p>
        <p>Embedded systems present unique portability challenges due to their diverse operating environments.
Many devices operate without general-purpose operating systems, instead relying on bare-metal
programming or lightweight real-time operating systems (RTOS). This diversity requires developers
to interact directly with varied hardware components across diferent devices and manufacturers,
significantly complicating the development process.</p>
        <p>
          HALs partially address these portability challenges by providing standardized interfaces for hardware
resource access [
          <xref ref-type="bibr" rid="ref19">19</xref>
          ]. However, many HAL implementations remain specific to particular hardware
families or vendors, creating inconsistencies when porting applications across diferent platforms. Even
with a HAL, peripheral configuration diferences and other low-level functionalities often necessitate
device-specific code.
        </p>
        <p>The fundamental portability challenge lies in balancing abstraction with performance. WhilHe ALs
abstract certain functionalities, underlying configurations remain tied to specific hardware architectures.
For example, common peripherals like UART or I2C exist across devices, but their initialization and
configuration vary significantly due to diferences in interrupt handling, clock gating, and direct memory
access capabilities. This variance means that while application code may be portable, thHeAL itself
often requires substantial adaptation between platforms.</p>
        <p>
          Vendor-provided HALs frequently lead to vendor lock-in, making platform migration costly and
time-consuming. The embedded-hal Rust project [
          <xref ref-type="bibr" rid="ref20">20</xref>
          ] represents one approach to enhancing
crossplatform portability by providing standardized interfaces (traits) for common peripherals such aGsPIO,
USART, SPI, and I2C. This approach allows developers to write hardware-independent code that can
operate across diverse platforms. However, even this promising approach cannot entirely eliminate
platform-specific code, particularly for peripheral initialization and configuration, which remain highly
dependent on specific hardware architectures [
          <xref ref-type="bibr" rid="ref21">21</xref>
          ].
        </p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>4. WebAssembly on Embedded Systems</title>
      <p>Embedded systems present unique challenges for software deployment due to their resource constraints,
diverse hardware architectures, and critical safety requirements. These systems traditionally rely on
native code compiled specifically for their target platforms, creating significant barriers to software
portability. Wasm, originally designed for browser environments, ofers promising capabilities for these
specialized computing contexts by providing a secure execution model.</p>
      <p>The potential appeal ofWasm for embedded development lies in its ability to address two fundamental
challenges in the field. First, its sandboxed execution model provides valuable security guarantees.
Second, its binary format and virtual machine architecture ofer a path toward greater code
portability across the fragmented landscape of embedded hardware. While these benefits align well with
embedded systems requirements, the introduction of Wasm into this domain requires navigating
significant technical constraints and standards gaps that difer from those encountered in web or server
environments.
4.1. Safe Execution of WebAssembly in Embedded Systems
In embedded environments, security is not just about protecting data: it is about ensuring the correct
operation of critical system functions. Many embedded devices lack hardware-based security measures
such as memory management units that provide memory isolation and protection, making
softwarebased security mechanisms especially important.</p>
      <p>Wasm’s sandboxed execution model addresses these concerns by providing strong isolation between
untrusted code and core system components. This isolation is particularly valuable for embedded
devices that may support dynamic updates or third-party modules. EachWasm module undergoes static
validation before execution, and its program code can’t change after being loaded. This design prevents
runtime modifications or code injection attacks, ensuring that even if a module is compromised, the
attack remains contained and cannot alter the system’s fundamental behavior.</p>
      <p>By requiring modules to declare all imported and exported functions,Wasm enforces fine-grained
control over which parts of the system can be accessed. This mechanism is particularly important in
embedded devices, where direct access to peripherals or sensor data must be carefully restricted. The
explicit boundaries help ensure that only validated, authorized code can interact with critical hardware,
reducing the risk of unauthorized control or exploitation.</p>
      <p>The security benefits of Wasm in embedded systems do come with trade-ofs. The virtual machine
introduces additional overhead for resource allocation, context switching, and isolated memory
management. In resource-constrained environments, this can lead to reduced execution eficiency and
increased power consumption—exchanging some performance for enhanced security. These trade-ofs
must be carefully evaluated based on the specific requirements of each embedded application.
4.2. Challenges in Embedded WebAssembly Deployment
While Wasm provides a portable execution environment for computational logic, its application in
embedded systems faces significant challenges that go beyond those encountered in general-purpose
computing environments.</p>
      <p>A fundamental limitation is Wasm’s lack of standardized interfaces for hardware access. Embedded
systems often require direct, low-level access to hardware resources such as GPIO pins, UART interfaces,
sensors, and actuators. The currentWasm specification does not provide native mechanisms for
interacting with such hardware peripherals. This gap means that while the core computational aspects
of applications can be portable, the hardware interaction layer remains platform-specific.</p>
      <p>The adoption ofWASI has begun to address similar challenges in general-purpose computing
environments by standardizingAPIs for file I/O, networking, time management, and random number
generation. However,WASI was designed with the assumption that the host environment includes an
operating system providing these standard services; such an assumption that doesn’t hold for many
embedded systems that operate without a full-fledged OS.</p>
      <p>
        Eforts to extend WASI for embedded-specific needs are still emerging. Interfaces for common
embedded protocols like I2C and SPI are under development but remain in early proposal stages2[
        <xref ref-type="bibr" rid="ref2 ref23">2, 23</xref>
        ].
The absence of a standardizedHAL specifically designed for Wasm in embedded contexts presents a
significant barrier to widespread adoption in resource-constrained environments.
      </p>
      <p>
        Projects like Embedded WASM [
        <xref ref-type="bibr" rid="ref24">24</xref>
        ] have attempted to create embedded-hal [
        <xref ref-type="bibr" rid="ref20">20</xref>
        ] implementations for
Wasm, but these solutions are still experimental and, in some cases, development appears to have stalled.
Until these challenges are addressed,Wasm’s application in embedded systems will likely remain limited
to specific use cases where its security benefits outweigh the additional complexity of implementation.
      </p>
    </sec>
    <sec id="sec-4">
      <title>5. Conclusions</title>
      <p>This paper has examinedWasm’s potential and limitations in embedded systems contexts. Wasm ofers
significant benefits for embedded applications, particularly through its inherent security features like
sandboxing and isolation. These capabilities are especially valuable in embedded environments where
hardware-based memory protection is typically unavailable due to the absence of virtual memory
systems. Despite being originally designed for web browsers,Wasm’s architecture has demonstrated
remarkable adaptability, enabling its deployment across vastly diferent computing environments from
desktop systems to cloud infrastructure and resource-constrained embedded devices.</p>
      <p>However, our analysis reveals thaWtasm falls short of achieving true “write once, run everywhere”
portability in embedded contexts. While the specification successfully defines a virtual instruction
set architecture and execution model, it deliberately avoids standardizing how modules interact with
host resources. This design choice, which enables flexibility across diverse platforms, simultaneously
creates significant challenges for embedded applications that require consistent hardware access.
The import/export mechanism provides the technical foundation for host interaction, but without
standardized interfaces, true portability remains elusive.</p>
      <p>This limitation becomes particularly evident when comparingWasm’s usage patterns across diferent
environments. In web applications,Wasm typically serves as an acceleration mechanism for
computeintensive tasks within a JavaScript-driven application, requiring only limited host system interaction. By
contrast, standaloneWasm applications require comprehensive system interfaces comparable toPOSIX
APIs to support real-world functionality. TheWASI proposal by theW3C WebAssembly Community
Group attempts to address this gap by providing standardizedAPIs for application development.</p>
      <p>Yet WASI’s current specification primarily targets desktop and cloud environments, ofering limited
value for embedded systems that operate without an underlying operating system. In such environments,
conventional operations like filesystem access or socket communication may be entirely irrelevant. The
emerging eforts to extend WASI with embedded-specific interfaces for protocols like GPIO, SPI, and
I2C represent promising developments, but these standards remain in early stages and insuficient for
comprehensive embedded deployment.</p>
      <p>The diversity of embedded hardware presents additional challenges beyond interface standardization.
Embedded devices vary significantly across manufacturers and even within product families,
necessitating customized initialization code for microcontrollers and peripherals. To mitigate this challenge, we
propose architectural approaches that strongly decouple business logic from hardware-specific
implementation, allowing for targeted customization while preserving application portability. Furthermore,
the development of lightweight, modular runtime environments specifically optimized for
embedded workloads could significantly improve both performance and portability in resource-constrained
contexts.</p>
      <p>By addressing these technical and standardization challengesW,asm could emerge as a
transformative technology for embedded systems development, enabling more secure, portable, and eficient
applications. Such advancement would be particularly valuable for meeting the evolving requirements
of IoT and edge computing ecosystems, where secure code execution and cross-device deployment
represent persistent challenges. The continued evolution ofWasm standards, particularly those focused
on embedded-specific requirements, will largely determine whether this promising technology can
fulfill its potential in the embedded systems domain.</p>
      <p>Declaration on Generative AI: The author(s) have not employed any Generative AI tools.</p>
      <p>Funding: This work was partially supported by the MUR National Recovery and Resilience Plan funded by the European
Union – NextGenerationEU through Project “SERICS – Security and Rights in CyberSpace” under Grant PE00000014.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>J. Shehu</given-names>
            <surname>Yalli</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. Hilmi</given-names>
            <surname>Hasan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Abubakar</surname>
          </string-name>
          <string-name>
            <surname>Badawi</surname>
          </string-name>
          ,
          <article-title>Internet of Things (IoT): Origins, embedded technologies, smart applications, and its growth in the last decade</article-title>
          ,
          <source>IEEE Access 12</source>
          (
          <year>2024</year>
          )
          <fpage>91357</fpage>
          -
          <lpage>91382</lpage>
          . doi:
          <volume>10</volume>
          .1109/ACCESS.
          <year>2024</year>
          .
          <volume>3418995</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>WebAssembly</given-names>
            <surname>Community</surname>
          </string-name>
          <string-name>
            <surname>Group</surname>
          </string-name>
          , WebAssembly text format,
          <year>2024</year>
          . URL: https://webassembly. github.io/spec/core/text/index.html.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>WebAssembly</given-names>
            <surname>Community</surname>
          </string-name>
          <string-name>
            <surname>Group</surname>
          </string-name>
          , WebAssembly binary format,
          <year>2024</year>
          . URL: https://webassembly. github.io/spec/core/binary/index.html.
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>T.</given-names>
            <surname>Brito</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Lopes</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Santos</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. F.</given-names>
            <surname>Santos</surname>
          </string-name>
          ,
          <string-name>
            <surname>Wasmati:</surname>
          </string-name>
          <article-title>An eficient static vulnerability scanner for webassembly</article-title>
          ,
          <source>Computers &amp; Security</source>
          <volume>118</volume>
          (
          <year>2022</year>
          ). doi:
          <volume>10</volume>
          .1016/j.cose.
          <year>2022</year>
          .
          <volume>102745</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>B. C.</given-names>
            <surname>Pierce</surname>
          </string-name>
          ,
          <source>Advanced Topics in Types and Programming Languages</source>
          , The MIT Press,
          <year>2004</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>WebAssembly</given-names>
            <surname>Community</surname>
          </string-name>
          <string-name>
            <surname>Group</surname>
          </string-name>
          , WebAssembly documentation - security,
          <year>2017</year>
          . URL: https: //webassembly.org/docs/security/.
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>M. W.</given-names>
            <surname>Docs</surname>
          </string-name>
          ,
          <source>WebAssembly concepts</source>
          ,
          <year>2024</year>
          . URL: https://developer.mozilla.org/en-US/docs/ WebAssembly/Concepts.
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>M.</given-names>
            <surname>Vassena</surname>
          </string-name>
          , WebAssembly foundations,
          <year>2024</year>
          . URL: https://ics-websites.science.uu.nl/docs/vakken/ mlbs/lectures/lec5/notes/1-core-wasm.
          <source>md.html.</source>
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>D.</given-names>
            <surname>Lehmann</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Kinder</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Pradel</surname>
          </string-name>
          ,
          <article-title>Everything old is new again: Binary security of WebAssembly, in: 29th USENIX Security Symposium (USENIX Security 20)</article-title>
          , USENIX Association,
          <year>2020</year>
          , pp.
          <fpage>217</fpage>
          -
          <lpage>234</lpage>
          . URL: https://www.usenix.org/conference/usenixsecurity20/presentation/lehmann.
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>M.</given-names>
            <surname>Vassena</surname>
          </string-name>
          , WebAssembly control-flow,
          <year>2024</year>
          . URL: https://ics-websites.science.uu.nl/docs/vakken/ mlbs/notes/2-control-flow.
          <source>md.html.</source>
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11] WebAssembly Community Group, WebAssembly documentation - portability,
          <year>2015</year>
          . URL: https: //webassembly.org/docs/portability/.
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>A.</given-names>
            <surname>Haas</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Rossberg</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D. L.</given-names>
            <surname>Schuf</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B. L.</given-names>
            <surname>Titzer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Holman</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Gohman</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Wagner</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Zakai</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Bastien</surname>
          </string-name>
          ,
          <article-title>Bringing the web up to speed with webassembly</article-title>
          ,
          <source>SIGPLAN Not</source>
          .
          <volume>52</volume>
          (
          <year>2017</year>
          )
          <fpage>185</fpage>
          -
          <lpage>200</lpage>
          . URL: https://doi.org/10.1145/3140587.3062363. doi:
          <volume>10</volume>
          .1145/3140587.3062363.
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13] WebAssembly Community Group, WebAssembly specification - appendix - embedding,
          <year>2024</year>
          . URL: https://webassembly.org/docs/portability/.
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14] WebAssembly Community Group,
          <source>WebAssembly System Interface</source>
          ,
          <year>2024</year>
          . URL: https://github.com/ WebAssembly/WASI.
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <given-names>P.</given-names>
            <surname>Koopman</surname>
          </string-name>
          ,
          <article-title>Embedded system security</article-title>
          ,
          <source>Computer</source>
          <volume>37</volume>
          (
          <year>2004</year>
          )
          <fpage>95</fpage>
          -
          <lpage>97</lpage>
          . doi:
          <volume>10</volume>
          .1109/
          <string-name>
            <surname>MC</surname>
          </string-name>
          .
          <year>2004</year>
          .
          <volume>52</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [16]
          <string-name>
            <given-names>X.</given-names>
            <surname>Zhou</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Zhou</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Xun</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Lu</surname>
          </string-name>
          ,
          <article-title>A survey of the security analysis of embedded devices</article-title>
          ,
          <source>Sensors</source>
          <volume>23</volume>
          (
          <year>2023</year>
          ). URL: https://www.mdpi.com/1424-8220/23/22/9221. doi:
          <volume>10</volume>
          .3390/s23229221.
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [17]
          <string-name>
            <given-names>B.</given-names>
            <surname>Schneier</surname>
          </string-name>
          ,
          <source>Security risks of embedded systems</source>
          ,
          <year>2014</year>
          . URL: https://www.schneier.com/blog/ archives/2014/01/security_risks_9.html.
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          [18]
          <string-name>
            <given-names>D.</given-names>
            <surname>Papp</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            <surname>Ma</surname>
          </string-name>
          , L. Buttyan,
          <article-title>Embedded systems security: Threats, vulnerabilities, and attack taxonomy</article-title>
          ,
          <source>in: 2015 13th Annual Conference on Privacy, Security and Trust (PST)</source>
          ,
          <year>2015</year>
          , pp.
          <fpage>145</fpage>
          -
          <lpage>152</lpage>
          . doi:
          <volume>10</volume>
          .1109/PST.
          <year>2015</year>
          .
          <volume>7232966</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          [19]
          <string-name>
            <given-names>K.</given-names>
            <surname>Popovici</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Jerraya</surname>
          </string-name>
          , Hardware Abstraction Layer, Springer Netherlands, Dordrecht,
          <year>2009</year>
          , pp.
          <fpage>67</fpage>
          -
          <lpage>94</lpage>
          . URL: https://doi.org/10.1007/978-1-
          <fpage>4020</fpage>
          -9436-
          <issue>1</issue>
          _4. doi:
          <volume>10</volume>
          .1007/978-1-
          <fpage>4020</fpage>
          -9436-
          <issue>1</issue>
          _
          <fpage>4</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          [20]
          <article-title>rust embedded, A Hardware Abstraction Layer (HAL) for embedded systems</article-title>
          ,
          <year>2024</year>
          . URL: https: //github.com/rust-embedded/embedded-hal.
        </mixed-citation>
      </ref>
      <ref id="ref21">
        <mixed-citation>
          [21]
          <string-name>
            <given-names>M.</given-names>
            <surname>Geisler</surname>
          </string-name>
          , Comprehensive Rust - embedded-hal,
          <year>2024</year>
          . URL: https://google.github.io/ comprehensive-rust/bare-metal/microcontrollers/embedded-hal.html.
        </mixed-citation>
      </ref>
      <ref id="ref22">
        <mixed-citation>
          [22] WebAssembly Community Group,
          <source>I2C API for WASI</source>
          ,
          <year>2024</year>
          . URL: https://github.com/WebAssembly/ wasi-i2c.
        </mixed-citation>
      </ref>
      <ref id="ref23">
        <mixed-citation>
          [23] WebAssembly Community Group,
          <source>SPI API for WASI</source>
          ,
          <year>2024</year>
          . URL: https://github.com/WebAssembly/ wasi-spi.
        </mixed-citation>
      </ref>
      <ref id="ref24">
        <mixed-citation>
          [24]
          <string-name>
            <surname>Embedded</surname>
            <given-names>WASM</given-names>
          </string-name>
          Working Group,
          <article-title>WebAssembly for embedded devices</article-title>
          ,
          <year>2023</year>
          . URL: https://github. com/embedded-wasm.
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>