CVE-2021-40822 Overview
CVE-2021-40822 is a Server-Side Request Forgery (SSRF) vulnerability affecting GeoServer, a popular open-source server for sharing geospatial data. The vulnerability exists in GeoServer through version 2.18.5 and versions 2.19.x through 2.19.2, allowing attackers to exploit the proxy host configuration option to perform unauthorized server-side requests.
Critical Impact
This SSRF vulnerability enables unauthenticated attackers to force the GeoServer instance to make arbitrary HTTP requests to internal or external resources, potentially exposing sensitive internal services, cloud metadata endpoints, and confidential data that should not be accessible from external networks.
Affected Products
- OSGeo GeoServer versions up to and including 2.18.5
- OSGeo GeoServer versions 2.19.0 through 2.19.2
- Any deployments using the proxy host configuration feature
Discovery Timeline
- 2022-05-02 - CVE-2021-40822 published to NVD
- 2024-11-21 - Last updated in NVD database
Technical Details for CVE-2021-40822
Vulnerability Analysis
This Server-Side Request Forgery (SSRF) vulnerability resides in GeoServer's proxy host configuration functionality. GeoServer provides an option for administrators to configure a proxy host that the server uses when making outbound HTTP requests. However, insufficient validation of user-supplied input in this configuration allows attackers to manipulate the proxy settings to redirect requests to arbitrary destinations.
The vulnerability is classified under CWE-918 (Server-Side Request Forgery), which occurs when a web application fetches a remote resource without properly validating the user-supplied URL. In this case, the proxy host setting can be exploited to make the GeoServer instance act as a proxy for accessing internal network resources that would otherwise be unreachable from an external attacker's position.
The attack requires no authentication and can be executed remotely over the network, making it particularly dangerous for internet-facing GeoServer deployments. Successful exploitation allows attackers to read sensitive data from internal systems, including cloud instance metadata services (such as AWS 169.254.169.254), internal databases, and other services protected behind network firewalls.
Root Cause
The root cause of this vulnerability is improper input validation in the proxy host configuration mechanism. GeoServer fails to adequately sanitize and validate URLs provided for the proxy host setting, allowing attackers to specify arbitrary internal or external destinations. The application does not implement proper restrictions on which hosts can be contacted through the proxy functionality, enabling SSRF attacks against internal infrastructure.
Attack Vector
The attack vector is network-based, requiring no privileges or user interaction. An attacker can exploit this vulnerability by manipulating the proxy host configuration option to redirect server-side requests. This allows the attacker to:
- Access internal network services that are not directly accessible from the internet
- Retrieve cloud metadata containing sensitive credentials and configuration data
- Scan internal network infrastructure to discover additional attack surfaces
- Potentially pivot to other internal systems using the compromised GeoServer as a proxy
The vulnerability enables attackers to bypass network segmentation and firewall protections by leveraging the trusted position of the GeoServer instance within the target network.
Detection Methods for CVE-2021-40822
Indicators of Compromise
- Unusual outbound HTTP requests from GeoServer to internal IP addresses (e.g., 10.x.x.x, 172.16.x.x, 192.168.x.x)
- Requests to cloud metadata endpoints such as 169.254.169.254 originating from the GeoServer process
- Unexpected modifications to proxy host configuration settings in GeoServer
- Anomalous network traffic patterns showing GeoServer connecting to services it normally wouldn't access
Detection Strategies
- Monitor GeoServer access logs for requests containing internal IP addresses or localhost references in proxy-related parameters
- Implement network-level monitoring to detect outbound connections from GeoServer to unexpected internal destinations
- Deploy web application firewall (WAF) rules to detect and block SSRF attack patterns targeting the proxy configuration
- Review GeoServer configuration changes and audit logs for unauthorized proxy host modifications
Monitoring Recommendations
- Enable verbose logging on GeoServer to capture detailed request information including proxy-related activities
- Configure network segmentation monitoring to alert on GeoServer instances attempting to reach internal-only services
- Implement egress filtering rules and monitor for violations from GeoServer hosts
- Set up alerts for any access attempts to cloud metadata services from application servers
How to Mitigate CVE-2021-40822
Immediate Actions Required
- Upgrade GeoServer to version 2.19.3 or later immediately, which contains the fix for this vulnerability
- For the 2.18.x branch, upgrade to the latest patched version available
- If immediate patching is not possible, disable or restrict access to the proxy host configuration feature
- Implement network-level controls to prevent GeoServer from accessing internal services or cloud metadata endpoints
Patch Information
The vulnerability has been addressed in GeoServer version 2.19.3 and subsequent releases. The fix is tracked in OSGeo Issue GEOS-10229. Organizations should review the version comparison between 2.19.2 and 2.19.3 to understand the specific changes implemented. The latest releases can be obtained from the GeoServer GitHub Releases page.
Workarounds
- Implement strict network segmentation to isolate GeoServer instances from sensitive internal resources
- Configure firewall rules to block outbound connections from GeoServer to internal IP ranges and cloud metadata services
- Disable the proxy host configuration feature if not required for your deployment
- Deploy a reverse proxy in front of GeoServer with SSRF protection capabilities to filter malicious requests
# Example iptables rules to block SSRF to internal networks and cloud metadata
# Block access to common internal IP ranges from GeoServer host
iptables -A OUTPUT -d 169.254.169.254 -j DROP
iptables -A OUTPUT -d 10.0.0.0/8 -j DROP
iptables -A OUTPUT -d 172.16.0.0/12 -j DROP
iptables -A OUTPUT -d 192.168.0.0/16 -j DROP
iptables -A OUTPUT -d 127.0.0.0/8 -j DROP
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


