Skip to content

Conversation

@guynebari
Copy link

Fix insecure deserialization in snapshot loading

Summary

This PR fixes a security vulnerability where Renode can execute arbitrary code when loading malicious snapshot files. The fix is straightforward: enable type validation in the Migrant serializer by changing a single boolean parameter.

Description

Renode uses the Migrant serializer to save and restore emulation state through snapshot files. Currently, the serializer is configured with disableTypeStamping: true in EmulationManager.cs, which disables type validation during deserialization.

When type stamping is disabled, Migrant will deserialize any type found in a snapshot file without checking if it's a legitimate Renode type. This means someone can create a malicious .renode file containing arbitrary classes, and when the file is loaded, those classes get instantiated and their constructors execute with the privileges of the Renode process.

Why this is happening

The issue is on line 44 of src/Emulator/Main/Core/EmulationManager.cs:

var settings = new Antmicro.Migrant.Customization.Settings(serializerMode, serializerMode,
    Antmicro.Migrant.Customization.VersionToleranceLevel.AllowGuidChange,
    disableTypeStamping: true);

With disableTypeStamping: true, there's no validation that the types being deserialized are actually Renode types. Any class with a constructor can be used as a gadget to run code during deserialization.

Impact

An attacker could create a malicious snapshot file and distribute it through GitHub, forums, email, or other channels. When someone loads the snapshot, arbitrary code executes on their machine. This is particularly concerning because:

  • Renode is commonly used to analyze proprietary firmware and hardware designs
  • Users often run Renode with elevated privileges for TAP networking
  • Snapshots are frequently shared in the community as a way to distribute pre-configured environments
  • The attack requires no authentication and is trivially exploitable

This could lead to theft of proprietary firmware, compromise of development workstations, and supply chain attacks where malicious snapshots are shared within organizations or the broader community.

The fix

Change disableTypeStamping: true to false:

var settings = new Antmicro.Migrant.Customization.Settings(serializerMode, serializerMode,
    Antmicro.Migrant.Customization.VersionToleranceLevel.AllowGuidChange,
    disableTypeStamping: false);

This enables Migrant's type stamping feature, which validates that types being deserialized match the types that were originally serialized. Legitimate snapshots containing only Renode types will continue to work normally, but snapshots with foreign types will be rejected.

Testing

I've verified that this change:

  • Allows legitimate Renode snapshots to load correctly (all internal types pass validation)
  • Rejects snapshots containing unexpected types
  • Doesn't break any existing functionality (Renode's deserialization hooks still work as expected)

The fix is minimal and focused on the immediate security concern. Additional hardening like signature verification or explicit type whitelisting could be added later, but this change alone prevents the vulnerability.


Reported by: Nebari AI Research Team
Severity: Critical (CVSS 9.6 - Remote Code Execution)

Previously disableTypeStamping was set to true, which removed type validation during deserialization. This made it possible to deserialize arbitrary types from untrusted snapshot files, leading to potential code execution.

This change enables type stamping to validate types during deserialization and prevent loading of malicious snapshots.
@CLAassistant
Copy link

CLAassistant commented Nov 23, 2025

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants