Firecracker's microVM metadata service (MMDS): what it is and how to use it safely
Cloud VMs have a metadata endpoint at 169.254.169.254 that tells the instance about itself. Firecracker has its own version, the microVM Metadata Service (MMDS). It is a small, useful feature, and also one that people tend to use for things it is not suited to. This post goes through how it works, according to Firecracker's MMDS user guide and MMDS design doc as of November 2026, and where its edges are.
It describes Firecracker, not any specific platform's configuration.
What MMDS is
MMDS is a mutable JSON data store inside the Firecracker process. The host writes to it through the Firecracker API; the guest reads from it over HTTP, at an IPv4 address that defaults to 169.254.169.254 and can be changed.
The guest's requests never leave the Firecracker process. Firecracker runs a minimal HTTP/TCP/IPv4 stack, called Dumbo in the design doc, inside the network device emulation. When a frame from the guest is addressed to the MMDS IP, Firecracker answers it itself instead of writing it to the host TAP device.
Turning it on
By default MMDS is not reachable from the guest. It has to be configured before boot, and it is tied to a network interface:
- Attach a network interface (
PUT /network-interfaces/{id}). - Configure MMDS (
PUT /mmds/config) with the list of interface IDs that may reach it, and optionally anipv4_addressand aversion.
Enabling MMDS without a network interface is an error. Inside the guest, you add a route so packets for the MMDS IP go out the right interface, for example ip route add 169.254.170.2 dev eth0.
Writing data
The host puts JSON into the store with PUT /mmds, which replaces the contents, or PATCH /mmds, which applies an RFC 7396 JSON Merge Patch. Either works before boot or while the VM runs. GET /mmds from the host reads it back.
The store is bounded. Its size limit comes from the --mmds-size-limit flag, and if that is not set, from --http-api-max-payload-size, which defaults to 51200 bytes. The design doc warns that raising it means storing and serving more data through the API's HTTP processing. MMDS is for small facts about the VM, not for files.
Reading data from the guest: V1 and V2
There are two access methods.
V1 is a plain GET to the MMDS IP, with the path as a JSON Pointer into the store (for example /latest/meta-data). It is deprecated and will be removed in the next major version. For compatibility it answers GET requests even with an invalid or missing token; two metrics, mmds.rx_invalid_token and mmds.rx_no_token, count those so you can tell whether guests are ready for V2.
V2 is session based, modelled on AWS's IMDSv2:
- The guest sends
PUT /latest/api/tokenwith anX-metadata-token-ttl-secondsheader between 1 and 21600. The request must not carryX-Forwarded-For. - MMDS answers with a token in plain text.
- Every
GETuntil the token expires must carry it inX-metadata-token.
The AWS-style header names (X-aws-ec2-metadata-token-ttl-seconds, X-aws-ec2-metadata-token) are accepted too, so tools written for EC2 metadata often work unchanged.
The version is set in /mmds/config with "version": "V2". If you leave it out, the default is V1, so set it explicitly.
What MMDS is good for
- Identity and configuration the guest needs at boot. A sandbox id, a role name, which region it is in, a hostname.
- Small values that change while running. A flag the host flips with
PATCH, such as "drain and exit". - Bootstrap pointers. Where to fetch a larger config, if the guest has a network that allows it.
What it is not good for
Secrets for untrusted code. Anything in MMDS can be read by any process in the guest that can reach the MMDS IP over an allowed interface. V2's token stops some request-forgery tricks, such as a server in the guest being tricked into fetching a URL, but it does not stop code running in the guest from asking for a token itself. If the code in the guest is the thing you do not trust, such as code an AI agent wrote, then a secret in MMDS is a secret you gave to that code. For agent workloads, credentials belong behind a broker that hands out short-lived, narrowly scoped values per run, or nowhere near the guest at all.
Bulk data. The store is small by design, see above.
A filtering boundary. The design doc says plainly that operators should not rely on the MMDS stack to filter packets addressed to the MMDS IP out of the guest's traffic. Guest traffic is untrusted and should be filtered on the host.
The host-side rules the docs ask for
Two notes from the MMDS design doc and the production host setup guide belong in any Firecracker deployment:
- Block the real cloud metadata service. If your Firecracker hosts run on a cloud VM, guest packets to
169.254.169.254that Firecracker does not answer itself, for example on an interface without MMDS, go to the TAP device like any other traffic and can reach the host's own metadata service, along with whatever credentials it hands out. The production guide gives annftrule that drops packets fromtap*interfaces to that address, and aniptables-nftequivalent. - Do not count on the TX rate limiter for MMDS. Frames answered by MMDS never reach the TAP device, so they are not charged to the interface's TX rate limiter. Bound the CPU Firecracker spends answering them with a cgroup CPU quota instead.
The first one is the important one. A metadata endpoint reachable from untrusted code is a well-known path to cloud credentials, and Firecracker's docs are clear that it does not filter traffic for you.
Where Sandscale fits
On Sandscale you do not configure MMDS. Each sandbox is its own Firecracker microVM; you give it metadata through labels and metadata when you create it, and you give it secrets through Vault: the SDK's vaultEnv option hands named Vault values to the sandbox's environment only, and the values never pass through the SDK, its answer or an audit entry. That still puts the value in the guest, so the advice above applies: give a run only the secrets that run needs. Keeping secrets out of agent prompts covers the pattern.
Originally published on the Sandscale blog.