Skip to content

Spin applications with specific configuration vulnerable to potential network sandbox escape

Critical severity GitHub Reviewed Published May 8, 2024 in fermyon/spin • Updated May 8, 2024

Package

cargo spin-sdk (Rust)

Affected versions

< 2.4.3

Patched versions

2.4.3

Description

Impact

Some specifically configured Spin applications that use self requests without a specified URL authority can be induced to make requests to arbitrary hosts via the Host HTTP header.

If an application's manifest contains a component with configuration such as

allowed_outbound_hosts = ["http://self", "https://self"]

and code such as

 let res: Response = spin_sdk::http::send(
        Request::new(Method::Get, "/") // Note: the request URI does not contain a URL authority
 ).await?;

Then that application can be induced to send an outgoing request to another host (leading the app to process the response assuming it comes from another component in the same application). This can be induced with a request such as

curl -H"Host: google.com:80" localhost:3000 # Assuming the application is served on localhost:3000

Note: If using a SDK that does not use wasi:http/outgoing-handler, the port can be omitted from the URL.

Vulnerable Configurations

The following conditions need to be met for an application to be vulnerable:

  1. The environment Spin is deployed in routes requests to the Spin runtime based on the request URL instead of the Host header, and leaves the Host header set to the original value by the client.
  2. The Spin application's component handling the incoming request is configured with an allowed_outbound_hosts list containing "self".
  3. In reaction to an incoming request, the component makes an outbound request whose URL doesn't include the hostname/port.

If all of these conditions apply, then Spin will use the inbound request's Host header to determine the authority part of the URL if none is explicitly provided in the request's URL.

Setups known not to be vulnerable

Fermyon's Fermyon Cloud serverless product and applications hosted on it are known not to be vulnerable.

Patches

Has the problem been patched? What versions should users upgrade to?
Spin version 2.4.3 is being released with this advisory going public.

Workarounds

For deployments of Spin, a workaround is to ensure that the Host header is sanitized to match the application a request is routed to.

For individual applications, multiple workarounds exist:

  1. Ensure that outgoing requests always sanitize the Host header
  2. Ensure that outgoing requests always provide the hostname in the URL and use that hostname in the allowed_outbound_hosts list instead of self
  3. When using Spin 2.4, use application-internal service chaining for intra-application requests

References

@lann lann published to fermyon/spin May 8, 2024
Published by the National Vulnerability Database May 8, 2024
Published to the GitHub Advisory Database May 8, 2024
Reviewed May 8, 2024
Last updated May 8, 2024

Severity

Critical

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N

EPSS score

0.043%
(11th percentile)

Weaknesses

CVE ID

CVE-2024-32980

GHSA ID

GHSA-f3h7-gpjj-wcvh

Source code

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.