The vulnerability is a Server-Side Request Forgery (SSRF) that exists in multiple components of Gotenberg. The root cause is twofold: a lack of default deny-list for HTTP/HTTPS targets on the main Chromium conversion endpoint, and a general vulnerability to redirect-based bypasses on all endpoints that make outbound requests.
The analysis of the patches between the vulnerable version and the patched version revealed several key changes. The commit 35f1a990a65cff4abc98561644d805d66993128d introduced a pinningProxy to handle outbound requests from Chromium, effectively mitigating the redirect-based bypass by ensuring that every request, including those after a redirect, is validated. It also introduced the allowPrivateIPs flag, which was a step towards fixing the SSRF.
The commit 7a914fce6537a0f35ae58bc386bf9401555923eb completed the fix by introducing deny-private-ips and deny-public-ips flags for all outbound requests, including those from the webhook and downloadFrom features. The default behavior was changed to be permissive, but operators can now secure their instances by enabling these flags.
The identified vulnerable functions are the ones that were making outbound requests without proper validation. These functions were modified in the patches to include the new security features. Specifically, chromium.chromiumBrowser.do, the handler in webhook.webhookMiddleware, and api.Context.downloadFrom were all found to be making calls to gotenberg.FilterOutboundURL without the necessary options to prevent SSRF attacks. The gotenberg.FilterOutboundURL function itself was also identified as a key component of the vulnerability, as its previous implementation was insufficient to prevent these attacks.