Skip to content

SSRF to Cloud (AWS, GCP, Azure) Services Metadata Services (IMDS) not Blocked by Default

Critical
SquidDev published GHSA-7p4w-mv69-2wm2 Jul 7, 2023

Package

CC-Tweaked (Minecraft Mod)

Affected versions

All

Patched versions

1.106.0
maven cc.tweaked:cc-tweaked-1.19.3-core (Maven)
All
None
maven cc.tweaked:cc-tweaked-1.19.4-core (Maven)
All
1.106.0

Description

Summary

If the cc-tweaked plugin is running on a Minecraft server hosted on a popular cloud hosting providers, like AWS, GCP, and Azure, those metadata services API endpoints are not forbidden (aka "blacklisted") by default. As such, any player can gain access to sensitive information exposed via those metadata servers, potentially allowing them to pivot or privilege escalate into the hosting provider.

This is a follow up of a vulnerability that @JLLeitschuh also reported back in 2017: dan200/ComputerCraft#170

Details

The default set of patterns that are forbidden by CC-Tweaked are defined by this predicate:

final class PrivatePattern implements AddressPredicate {
static final PrivatePattern INSTANCE = new PrivatePattern();
@Override
public boolean matches(InetAddress socketAddress) {
return socketAddress.isAnyLocalAddress()
|| socketAddress.isLoopbackAddress()
|| socketAddress.isLinkLocalAddress()
|| socketAddress.isSiteLocalAddress();
}
}

This, by default, this does include the IP or Domains that most IMDS use:

  • IPv4: 169.254.169.254
  • metadata.google.internal (in the case of GCP)

However, this, by default, does not include the IPs used by other popular IMDS:

  • Oracle Cloud: 192.0.0.192
  • Alibaba Cloud: 100.100.100.200
  • AWS: fd00:ec2::254

PoC

http.get("http://100.100.100.200/[cloud host specific path]"):readAll()

Impact

This can allow a player on a server, using a cc-tweaked computer to retrieve sensitive information like:

  • User-data passed to the system at boot time (could contain secrets)
  • IAM role credentials (could allow access to the greater AWS cloud account)
  • Managed identity credentials (could allow access to the Azure account)
  • Service account tokens (allowing access to the GCP account)

References

Related

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
Low
User interaction
None
Scope
Changed
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:L/UI:N/S:C/C:H/I:H/A:N

CVE ID

CVE-2023-37262

Weaknesses

Credits