Skip to content

SSRF to cloud (AWS, GCP, Azure) service metadata services (IMDS) and local IPv6 addresses not blocked by default

Critical
asiekierka published GHSA-vvfj-xh7c-j2cm Jul 7, 2023

Package

OpenComputers (Minecraft Mod)

Affected versions

1.2.0+

Patched versions

1.8.3
maven li.cil.oc:OpenComputers:MC1.7.10-1.5.+:api (Maven)
All
1.8.3

Description

Summary

If the OpenComputers mod is installed as part of a Minecraft server hosted on a popular cloud hosting provider, such as 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.

In addition, IPv6 addresses are not correctly filtered at all, allowing broader access into the local IPv6 network.

This is a follow up of a vulnerability that @JLLeitschuh also reported back in 2017:

Details

The default set of domains that are forbidden by OpenComputers are defined here:

# This is a list of forbidden domain names. If an HTTP request is made
# or a socket connection is opened the target address will be compared
# to the addresses / address ranges in this list. It it is present in this
# list, the request will be denied.
# Entries are either domain names (www.example.com) or IP addresses in
# string format (10.0.0.3), optionally in CIDR notation to make it easier
# to define address ranges (1.0.0.0/8). Domains are resolved to their
# actual IP once on startup, future requests are resolved and compared
# to the resolved addresses.
# By default all local addresses are blocked. This is only meant as a
# thin layer of security, to avoid average users hosting a game on their
# local machine having players access services in their local network.
# Server hosters are expected to configure their network outside of the
# mod's context in an appropriate manner, e.g. using a system firewall.
blacklist: [
"127.0.0.0/8"
"0.0.0.0/8"
"10.0.0.0/8"
"192.168.0.0/16"
"172.16.0.0/12"
]

And those are interpreted here:

class AddressValidator(val value: String) {
val validator: (InetAddress, String) => Option[Boolean] = try cidrPattern.findFirstIn(value) match {
case Some(cidrPattern(address, prefix)) =>
val addr = InetAddresses.coerceToInteger(InetAddresses.forString(address))
val mask = 0xFFFFFFFF << (32 - prefix.toInt)
val min = addr & mask
val max = min | ~mask
(inetAddress: InetAddress, host: String) => Some(inetAddress match {
case v4: Inet4Address =>
val numeric = InetAddresses.coerceToInteger(v4)
min <= numeric && numeric <= max
case _ => true // Can't check IPv6 addresses so we pass them.
})
case _ =>
val address = InetAddress.getByName(value)
(inetAddress: InetAddress, host: String) => Some(host == value || inetAddress == address)
} catch {
case t: Throwable =>
OpenComputers.log.warn("Invalid entry in internet blacklist / whitelist: " + value, t)
(inetAddress: InetAddress, host: String) => None
}
def apply(inetAddress: InetAddress, host: String) = validator(inetAddress, host)
}

Unfortunately, by default, this list does not include the IP or Domains used by most IMDS:

  • IPv4: 169.254.169.254
  • IPv6: fd00:ec2::254 (in the case of AWS)
  • metadata.google.internal (in the case of GCP)
  • Oracle Cloud: 192.0.0.192
  • Alibaba Cloud: 100.100.100.200

Impact

This can allow a player on a server using an OpenComputers computer to access parts of the private IPv4 address space, as well as the whole IPv6 address space, in order 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)

This issue affects every version of OpenComputers with the Internet Card feature enabled; that is, OpenComputers 1.2.0 and above in their most common, default configurations.

Mitigations

  • The following mitigation strategies are available, in order from most to least recommended:
    • Upgrading to a non-affected version of OpenComputers (v1.8.3 for Minecraft 1.7.10 and 1.12.2),
    • Disabling the Internet Card feature completely,
    • If using OpenComputers 1.3.0 or above, the following can also be done:
      • Using the allow list (opencomputers.internet.whitelist option) - this will prohibit connections to any IP addresses and/or domains not listed.
      • Adding the following entries to the block list (opencomputers.internet.blacklist option):
      "100.64.0.0/10",
      "169.254.0.0/16",
      "192.0.0.0/24",
      "192.0.2.0/24",
      "198.18.0.0/15",
      "198.51.100.0/24",
      "203.0.113.0/24",
      "224.0.0.0/3"

Note that, while filtering IPv6 addresses is not directly supported, thanks to an IPv4 coercion implemented by OpenComputers 1.3.0 and above, blocking 224.0.0.0/3 will also block all IPv6 addresses.

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-37261

Weaknesses

Credits