← Security advisories
Apache Camel security advisory

CVE-2026-95629

Camel-Docling: Unvalidated output path header enables writing conversion output to an arbitrary directory in DoclingProducer

Description

DoclingProducer runs the external docling tool in CLI mode, the default, and tells it where to write the converted document through the --output flag. When the CamelDoclingOutputFilePath header was set, addOutputDirectoryArguments handed its value to that flag verbatim: the value was not normalized, an absolute path or a path containing .. segments was accepted as given, and no endpoint option could confine it to a directory. The custom-argument validation added by the fix for CVE-2026-40047 refuses the --output and -o flags in the CamelDoclingCustomArguments header and tells callers to choose the output directory with this header instead, so the one value that decides where docling writes reached the command line without any of the checks applied to custom arguments. Docling writes the conversion result, as Markdown, HTML, JSON or text, into that directory, naming the file after the input file, and the producer afterwards removes only its own temporary directory, so the file is left in place. A party able to set the header could therefore have conversion output created in any directory the Camel process can write to. The content of such a file is the conversion of the document carried by the message, so it is shaped by whoever supplies that document without being written byte for byte, and when the document content arrives in the message body the producer stores it under a random temporary name, which the output file then carries. The header belongs to the Camel header namespace, which consumers applying Camel's default header filtering, such as the JMS and Kafka consumers, remove from incoming messages, so the issue is reached where a route forwards externally influenced values into the header or where a consumer maps incoming headers without that filtering. The docling-serve mode does not use the header.

Mitigation

Users are recommended to upgrade to version 4.23.0, which fixes the issue. If users are on the 4.22.x releases stream, then they are suggested to upgrade to 4.22.2. If users are on the 4.18.x releases stream, then they are suggested to upgrade to 4.18.5. The fix adds an outputBaseDirectory endpoint option that is unset by default, so after upgrading, set it on every docling endpoint whose CamelDoclingOutputFilePath header can carry a value influenced from outside the deployment; without it the header is normalized but can still name any directory. The 4.15.x to 4.17.x and 4.19.x to 4.21.x release lines reached end of life before this issue was resolved and will not receive a fix, so deployments on them must move to a supported release. For deployments that cannot upgrade immediately, do not build the CamelDoclingOutputFilePath header from values that originate outside the deployment, remove that header from messages that arrive from outside before they reach a docling endpoint, and make sure that consumers which map incoming message headers drop the Camel header namespace, so that only the route itself chooses the output directory.

Credit

This issue was discovered by Zhixi "Jace" Sun, independent security researcher

Notes

The JIRA ticket: https://issues.apache.org/jira/browse/CAMEL-24894 refers to the commits that resolved the issue, and has more details.

The fix was merged on main in https://github.com/apache/camel/pull/26737 (commit 48485d408f190c46ef408ba4ba75e45b4e8ffb04), and backported to camel-4.22.x in https://github.com/apache/camel/pull/27365 (commit 4f8eb14999163523af6b77d08bfd1b9e79ee49c0) and to camel-4.18.x in https://github.com/apache/camel/pull/27362 (commit 54552df4b9e512cb2025fad22b88429ef0e0169c).

The CamelDoclingOutputFilePath header is now normalized lexically before it is passed to docling, and a new outputBaseDirectory endpoint option confines it: when the option is set, a relative header value is resolved against that directory, and a value that resolves outside it, including an absolute path, is rejected with an IOException before docling is started. The containment is lexical and does not resolve symbolic links, as with inputBaseDirectory. The option is unset by default so that existing routes keep working, and with it unset the header is normalized but can still name any directory, so deployments in which the header can carry a value influenced from outside the deployment must set the option after upgrading. The upgrade guide describes the change in its notes for 4.23, 4.22.2 and 4.18.5.

The header has reached the docling output flag unchanged since camel-docling was introduced in 4.15.0, so every release of the 4.15.x to 4.22.x lines before the fixed versions is affected, whether or not it carries the CVE-2026-40047 fix.

This issue is related to CVE-2026-40047, which concerned insufficient validation of the CamelDoclingCustomArguments header in the same component: the validation that fix put in place refuses the output flags among the custom arguments and names this header as the way to choose the output directory, but the header itself was left unchecked. The outputBaseDirectory option is the output-side counterpart of the inputBaseDirectory option introduced by the fix for CVE-2026-78163, which concerned how the same producer interpreted a String message body as an input location. A separate gap in the custom-argument validation, which did not reject absolute paths, was fixed in the same releases and is covered by a separate advisory. It is classified as CWE-22 (Improper Limitation of a Pathname to a Restricted Directory).

References