Skip to content

Conversation

@Chocapikk
Copy link
Contributor

Hello Metasploit Team,

Description

This PR adds an auxiliary module for CVE-2025-58360, an XML External Entity (XXE) vulnerability in GeoServer that allows unauthenticated attackers to read arbitrary files from the server's file system via the WMS GetMap operation.

Vulnerability Overview

GeoServer versions <= 2.25.5 and >= 2.26.0, <= 2.26.1 contain an XXE vulnerability in the WMS GetMap operation. The vulnerability occurs when processing Styled Layer Descriptor (SLD) XML data, which allows attackers to inject malicious XML entities that reference local files.

This allows unauthenticated attackers to:

  • Read arbitrary files from the server's file system
  • Access sensitive configuration files
  • Potentially read credentials or other sensitive data

The vulnerability is accessible through the /geoserver/wms endpoint by sending a POST request with a malicious SLD containing an XXE entity. The file content is returned in the error message when the layer name contains the XXE entity reference.

Module Capabilities

  • Exploits unauthenticated XXE to read arbitrary files
  • Randomizes WMS GetMap parameters (width, height, bbox) for evasion
  • Extracts file content from error messages
  • Stores retrieved files as loot
  • Includes full documentation with Docker lab setup instructions

Testing

Successfully tested against GeoServer 2.25.5 using Docker. The module successfully reads files such as /etc/passwd and other system files.

Thanks!

@Chocapikk Chocapikk force-pushed the geoserver branch 3 times, most recently from 2d64527 to 99e4c78 Compare December 12, 2025 15:10
<!DOCTYPE StyledLayerDescriptor [
<!ENTITY #{entity_name} SYSTEM "file://#{file_path}">
]>
<StyledLayerDescriptor version="1.0.0">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can the version be randomized?

Comment on lines 75 to 83
# Randomize bbox coordinates (valid geographic bounds) using Rex::Text
# Generate min_x, max_x ensuring min_x < max_x
min_x = (-180.0 + (Rex::Text.rand_text_numeric(3).to_i % 179)).round(2)
max_x = (min_x + 0.1 + (Rex::Text.rand_text_numeric(3).to_i % ((180.0 - min_x) * 10).to_i) / 10.0).round(2)
max_x = [max_x, 180.0].min

# Generate min_y, max_y ensuring min_y < max_y
min_y = (-90.0 + (Rex::Text.rand_text_numeric(2).to_i % 89)).round(2)
max_y = (min_y + 0.1 + (Rex::Text.rand_text_numeric(2).to_i % ((90.0 - min_y) * 10).to_i) / 10.0).round(2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure this could be simplified to some calls to rand

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants