Skip to content

GeoJSON URL validation can expose server files and environment variables to unauthorized users

Critical
rlotun published GHSA-w73v-6p7p-fpfr Oct 5, 2021

Package

OSS and EE (Metabase)

Affected versions

x.40.0, x.40.1, x.40.2, x.40.3, x.40.4

Patched versions

x.40.5, x.41

Description

Impact

We've discovered a potential security issue with the custom GeoJSON map (admin->settings->maps->custom maps->add a map) support and potential local file inclusion (including environment variables). Only versions x.40.0-x.40.4 are affected.

Patches

This issue is fixed in a new maintenance release (0.40.5 and 1.40.5), and any subsequent release after that (including x.41+).

Workarounds

If you’re on an affected version (x.40.0-x.40.4), upgrade immediately.

If you’re unable to upgrade immediately, you can mitigate this by including rules in your reverse proxy or load balancer or WAF. Here are examples for ALB and Nginx, though it is recommended to block the endpoint /api/geojson completely:

ALB:

    Path containing /api/geojson
    Query string of url is starting with "file:" or "http://169.254.169.254"
    Return fixed response 403

Nginx:

location ~* /api/geojson {
  if ($args ~* "(^|&)url=(%|file|http.+169\.254\.\d+\.\d+)" ) {
    add_header Content-Type text/plain always;
    return 403 "File URIs and Metadata API URL are forbidden.";
  }
  rewrite ^(.*)$ $1 break;
  try_files $uri @metabase;
}

References

https://www.metabase.com/docs/latest/administration-guide/20-custom-maps.html

Credits

Thanks to (Twitter handles): @XNL_h4ck3r @iBruteSec @Vermsec @HolyBugx @Netmous3

Severity

Critical
9.9
/ 10

CVSS base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Changed
Confidentiality
High
Integrity
Low
Availability
Low
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:L/A:L

CVE ID

CVE-2021-41277

Weaknesses