Summary
MapFish Print contains an XML External Entity (XXE) vulnerability in its GML layer processing. An unauthenticated attacker may supply a remote GML document that causes the server to read local files or make requests to internal services when external entities and DTDs are processed.
Affected context
The vulnerability occurs in MapFish Print deployments that expose the /api/print3/print endpoint and allow requests to specify an attacker-controlled GML layer URL. The fetched XML is processed by the GML layer parser without sufficiently restricting external entities or external DTDs. Deployments are particularly exposed when the printing service can access sensitive local files, service-account credentials, certificates, or internal network endpoints.
Exploit preconditions
- Attack surface: The publicly reachable
/api/print3/printendpoint and its GML layer URL handling - Required access: No authentication may be required when the endpoint is exposed to an attacker
- Trigger point: Retrieval and parsing of attacker-controlled XML and DTD content by the GML layer parser
- Why exploitation is possible: External entities and DTDs are processed, allowing XML content to reference local files or initiate server-side network requests
Why this happens
The underlying bug is insecure XML parser configuration. The GML layer processing accepts external XML declarations without disabling external entity resolution and external DTD loading. This maps to CWE-611: Improper Restriction of XML External Entity Reference, where attacker-controlled XML can cause the application to resolve entities against local resources or network locations during parsing.
Potential impact
- An attacker may read sensitive local files
- Kubernetes service-account tokens or certificates could be exposed
- The service may be abused to access internal HTTP endpoints
- Internal network topology or service responses could be disclosed
- Compromised credentials could enable further unauthorized access
General mitigation guidance
Mitigation generally focuses on making XML parsing safe by default and reducing trust in externally supplied layer URLs.
Common defensive patterns include:
- Disable external entity resolution and external DTD loading in every XML parser used for untrusted content
- Use hardened, namespace-aware XML processing configurations with entity expansion restricted
- Validate GML structure against an allowlisted schema before application processing
- Restrict layer URLs to approved schemes, hosts, and network destinations
- Apply outbound network controls so printing services cannot reach sensitive internal endpoints
- Run the service with least-privilege filesystem and network permissions
- Keep secrets, tokens, and certificates outside locations readable by the application process where practical
- Apply layered response and error handling so parser failures cannot disclose fetched content
How teams detect issues like this
Organizations can identify similar issues through:
- Static analysis rules for XML parser settings that leave external entities or DTDs enabled
- Code review checks for XML parsing of user-controlled URLs or documents
- Tests using benign external-entity and internal-request canaries in isolated environments
- Monitoring for unexpected outbound requests from the printing service
- Web application logs showing unusual GML layer URLs, external DTD references, or parser errors containing sensitive data
- Network policy enforcement that blocks unnecessary egress from the application
Automated security review tools may help detect unsafe parser configuration, but runtime and network controls should provide defense in depth.

