CVE-2024-36401
KEVOSGeo GeoServer GeoTools Eval Injection Vulnerability
Weakness (CWE)
CVSS Vector
v3.1- Attack Vector
- Network
- Attack Complexity
- Low
- Privileges Required
- None
- User Interaction
- None
- Scope
- Unchanged
- Confidentiality
- High
- Integrity
- High
- Availability
- High
Description
GeoServer is an open source server that allows users to share and edit geospatial data. Prior to versions 2.22.6, 2.23.6, 2.24.4, and 2.25.2, multiple OGC request parameters allow Remote Code Execution (RCE) by unauthenticated users through specially crafted input against a default GeoServer installation due to unsafely evaluating property names as XPath expressions. The GeoTools library API that GeoServer calls evaluates property/attribute names for feature types in a way that unsafely passes them to the commons-jxpath library which can execute arbitrary code when evaluating XPath expressions. This XPath evaluation is intended to be used only by complex feature types (i.e., Application Schema data stores) but is incorrectly being applied to simple feature types as well which makes this vulnerability apply to **ALL** GeoServer instances. No public PoC is provided but this vulnerability has been confirmed to be exploitable through WFS GetFeature, WFS GetPropertyValue, WMS GetMap, WMS GetFeatureInfo, WMS GetLegendGraphic and WPS Execute requests. This vulnerability can lead to executing arbitrary code. Versions 2.22.6, 2.23.6, 2.24.4, and 2.25.2 contain a patch for the issue. A workaround exists by removing the `gt-complex-x.y.jar` file from the GeoServer where `x.y` is the GeoTools version (e.g., `gt-complex-31.1.jar` if running GeoServer 2.25.1). This will remove the vulnerable code from GeoServer but may break some GeoServer functionality or prevent GeoServer from deploying if the gt-complex module is needed.
Comprehensive Technical Analysis of CVE-2024-36401
1. Vulnerability Assessment and Severity Evaluation
CVE ID: CVE-2024-36401 CISA Vulnerability Name: OSGeo GeoServer GeoTools Eval Injection Vulnerability CVSS Score: 9.8
The vulnerability in GeoServer, an open-source server for sharing and editing geospatial data, allows Remote Code Execution (RCE) by unauthenticated users. This is due to the unsafe evaluation of property names as XPath expressions in the GeoTools library API. The severity is rated at 9.8 on the CVSS scale, indicating a critical vulnerability that can lead to significant impacts if exploited.
2. Potential Attack Vectors and Exploitation Methods
The vulnerability can be exploited through multiple OGC (Open Geospatial Consortium) request parameters, including:
- WFS GetFeature
- WFS GetPropertyValue
- WMS GetMap
- WMS GetFeatureInfo
- WMS GetLegendGraphic
- WPS Execute
An attacker can craft specially designed input to these endpoints, which will be unsafely evaluated as XPath expressions, leading to arbitrary code execution. This can result in full system compromise, data exfiltration, or further lateral movement within the network.
3. Affected Systems and Software Versions
Affected Versions:
- GeoServer versions prior to 2.22.6, 2.23.6, 2.24.4, and 2.25.2
Impact:
- All GeoServer instances are affected due to the incorrect application of XPath evaluation to simple feature types.
4. Recommended Mitigation Strategies
Immediate Mitigation:
- Patching: Upgrade to the patched versions: 2.22.6, 2.23.6, 2.24.4, or 2.25.2.
- Workaround: Remove the
gt-complex-x.y.jarfile from the GeoServer installation. Note that this may break some GeoServer functionalities or prevent deployment if the gt-complex module is required.
Long-Term Mitigation:
- Regular Updates: Ensure that GeoServer and all related libraries are kept up-to-date with the latest security patches.
- Input Validation: Implement robust input validation and sanitization mechanisms to prevent injection attacks.
- Access Controls: Enforce strict access controls and authentication mechanisms to limit exposure to unauthenticated users.
5. Impact on Cybersecurity Landscape
The discovery of this vulnerability underscores the importance of secure coding practices and thorough security testing, especially in open-source projects. The potential for RCE in a widely-used geospatial server highlights the need for continuous monitoring and rapid response to vulnerabilities. Organizations relying on GeoServer for critical geospatial data management should prioritize patching and implementing robust security measures to mitigate such risks.
6. Technical Details for Security Professionals
Vulnerability Details:
- The GeoTools library API in GeoServer unsafely evaluates property/attribute names for feature types, passing them to the commons-jxpath library.
- This unsafely evaluated XPath expression can execute arbitrary code, leading to RCE.
- The vulnerability affects both complex and simple feature types, making all GeoServer instances susceptible.
Exploitation:
- An attacker can send specially crafted OGC requests to the affected endpoints, leading to code execution.
- No public Proof of Concept (PoC) is provided, but the vulnerability has been confirmed to be exploitable.
References:
Conclusion: CVE-2024-36401 represents a critical risk to organizations using GeoServer. Immediate patching and implementation of mitigation strategies are essential to prevent potential exploitation. Security professionals should remain vigilant and ensure that all geospatial data management systems are secured against such vulnerabilities.