GHSA-CFQV-CV4G-HW85
Chromium in the 8.39.0 image accepts the compromised eMudhra intermediates after each start
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Remediación | Parche v8.40.0 | github.com/gotenberg/gotenberg/v8 · -6 d desde divulgación | |
| Divulgación | Publicada | GHSA-CFQV-CV4G-HW85 divulgada | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
The 8.39.0 release notes list the eMudhra fix (#1699) under Security Fixes and say "Chromium 156 rejects them". The OS bundle and the Java trust store in the image are fixed. Chromium is not fixed when it starts.
Chromium 156.0.8078.47 in `gotenberg/gotenberg:8.39.0` accepts a TLS chain through the compromised intermediate `EM DV TLS CA - G3B` to `emSign ECC Root CA - G3`. It also accepts such a leaf certificate that was never logged to Certificate Transparency. Chromium rejects these chains only after its component updater writes a CRLSet and PKI metadata into the Chromium profile. In our test, that took 102 to 104 seconds.
Gotenberg makes this window repeat:
- Chromium starts at the first conversion (`--chromium-auto-start` defaults to `false`). That conversion always runs before the download.
- Each start uses a new profile directory (`b.userProfileDirPath = b.fs.NewDirPath()` in `pkg/modules/chromium/browser.go`). The downloaded components do not carry over to the next start.
- Chromium restarts every 100 conversions by default (`--chromium-restart-after`), after a crash, and after `--chromium-idle-shutdown-timeout` when it is set. Each restart opens the window again.
- We expect that Chromium never gets the protection when the container cannot reach Google's component update servers. We did not test this.
Details
Suggested fix: ship an NSS database in the image that marks both roots as distrusted. Chromium reads `$HOME/.pki/nssdb` and obeys a `p,p,p` trust entry from the first request. We tested this on top of 8.39.0. All four `emudhra` hosts failed with `ERR_CERT_AUTHORITY_INVALID`.
Please also correct the 8.39.0 release notes, which tell users that Chromium rejects the roots.
Proof of concept
docker run --rm -d --name gtb -p 127.0.0.1:3000:3000 gotenberg/gotenberg:8.39.0 gotenberg --log-level=debug
until curl -sf -o /dev/null http://127.0.0.1:3000/health; do sleep 1; done
# Run this right away. Chromium starts at the first conversion.
for h in untrusted-root.badssl.com dv-g3b-emudhra.we-have-a-problem.com dv-g3b-noct-emudhra.we-have-a-problem.com; do
curl -s -o /dev/null -H "Gotenberg-Trace: $h" -F "url=https://$h/" http://127.0.0.1:3000/forms/chromium/convert/url
done
docker logs gtb 2>&1 | jq -rR 'fromjson? | select(.msg | test("EventLoadingFailed fired: net::ERR_CERT|fired for main page")) | "\(.correlation_id) \(.msg[0:140])"'When the main document fails with a certificate error, Gotenberg renders Chromium's error page and returns `200`. Read the result in the debug log, not in the HTTP status.
- Expected: `EventLoadingFailed fired: net::ERR_CERT_...` for all three hosts.
- Actual: `ERR_CERT_AUTHORITY_INVALID` for `untrusted-root.badssl.com` (the control), and `fired for main page ... Status:200` for both eMudhra hosts.
Wait until `CertificateRevocation` and `PKIMetadata` appear in the Chromium profile under `/tmp` (about 2 minutes), and run the loop again. Now all three hosts fail with `ERR_CERT_AUTHORITY_INVALID`.
The test hosts come from https://emudhra.we-have-a-problem.com/. `openssl s_client` inside the container shows the real chain, not a proxy: leaf <- `EM DV TLS CA - G3B` <- `emSign Root TLS CA - G3` <- `emSign ECC Root CA - G3`.
Our results below.
We used `--chromium-restart-after=0` so that Chromium did not restart during the test. Times are seconds since container start, when each conversion ended.
| URL | Time | Result |
|---|---|---|
| `example.com` | 11 s | Loaded (control) |
| `untrusted-root.badssl.com` | 15 s | `ERR_CERT_AUTHORITY_INVALID` (control) |
| `dv-g3b-emudhra.we-have-a-problem.com` | 18 s | Loaded |
| `dv-g3b-aaa-emudhra.we-have-a-problem.com` | 22 s | `ERR_CERT_AUTHORITY_INVALID` |
| `dv-g3b-noct-emudhra.we-have-a-problem.com` (leaf not in CT) | 25 s | Loaded |
| `dv-g3b-aaa-noct-emudhra.we-have-a-problem.com` | 28 s | `ERR_CERT_AUTHORITY_INVALID` |
| CRLSet 10882 and PKIMetadata 1825 written to the profile | 102-104 s | |
| All four `emudhra` hosts again | 131-154 s | `ERR_CERT_AUTHORITY_INVALID` |
Impact
Anyone can recover the private keys of the compromised intermediates from the certificates (see the checker page). A network attacker between Gotenberg and a remote host can issue a certificate for any hostname, and does not need to log it to CT. While the window is open, Chromium accepts that certificate for:
- the target URL of `/forms/chromium/convert/url` and `/forms/chromium/screenshot/url`;
- each remote resource (CSS, fonts, scripts, images) that an HTML or Markdown conversion loads.
The attacker can then change the content of the generated PDF or screenshot. The attacker can also read what Chromium sends to that host, including headers and cookies that the caller sets with `extraHttpHeaders` and `cookies`.
Patches
Fixed on `main` for 8.40.0 by ce26468 https://github.com/gotenberg/gotenberg/commit/ce2646869d660b8cd25ee580430d425321a55956, and on `next` for 9.0.0 by a3c89a2 https://github.com/gotenberg/gotenberg/commit/a3c89a233296f2394913daff30a744f3d4d1f43d. The images ship a Chromium managed policy, `CADistrustedCertificates`, that distrusts `emSign ECC Root CA - G3`, `emSign Root TLS CA - G3` and `AAA Certificate Services`. It applies from the first request, whatever the user or `HOME`, and without access to Google's update servers. With the PoC, both eMudhra hosts fail with `ERR_CERT_AUTHORITY_INVALID` on the first conversions after start.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
gogithub.com/gotenberg/gotenberg/v8 |
Corregida | v8.40.0 | -6 d | v8.40.0 no afectada |
v8.40.0Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/gotenberg/gotenberg/security/advisories/GHSA-cfqv-cv4g-hw85Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
