{"id":"CVE-2026-71308","aliases":["CVE-2026-71308","GHSA-cfh6-pv5c-38jv","PYSEC-2026-3675"],"related":[],"kind":"vulnerability","state":"published","title":"Lemur: Unchecked `replaces[]` lets any user silence notifications and hijack auto-rotation for arbitrary certificates","summary":"Lemur manages TLS certificate creation. From 0.5.0 until 1.9.3, certificate create, upload, and edit requests accepted replaces[] or replacements identifiers that AssociatedCertificateSchema resolved with fetch_objects without a CertificatePermission check. Assigning those objects to Certificate.replaces invoked an append listener that disabled the victim certificate notifications and marked it as replaced. The victim was then excluded from get_all_pending_reissue, and certificate_rotate could deploy the attacker certificate to endpoints serving the victim. An authenticated non-read-only user could target certificates for which the user had no ownership or role, suppress lifecycle automation, and cause fleet-wide TLS disruption or unauthorized substitution. The fix authorizes every referenced replacement certificate before mutation. This issue is fixed in version 1.9.3.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Lemur manages TLS certificate creation. From 0.5.0 until 1.9.3, certificate create, upload, and edit requests accepted replaces[] or replacements identifiers that AssociatedCertificateSchema resolved with fetch_objects without a CertificatePermission check. Assigning those objects to Certificate.replaces invoked an append listener that disabled the victim certificate notifications and marked it as replaced. The victim was then excluded from get_all_pending_reissue, and certificate_rotate could deploy the attacker certificate to endpoints serving the victim. An authenticated non-read-only user could target certificates for which the user had no ownership or role, suppress lifecycle automation, and cause fleet-wide TLS disruption or unauthorized substitution. The fix authorizes every referenced replacement certificate before mutation. This issue is fixed in version 1.9.3.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nRepo under test: https://github.com/Netflix/lemur\n\nThe certificate create and upload endpoints accept a `replaces[]` (alias `replacements`) array that is resolved to live `Certificate` ORM objects with no ownership or `CertificatePermission` check on the referenced certificates. The SQLAlchemy `Certificate.replaces` append listener then immediately sets `victim.notify = False` and populates `victim.replaced`. From that point the victim certificate is excluded from auto-reissue, its expiration notifications are silenced, and the periodic `certificate_rotate` Celery task deploys the attacker's certificate (`endpoint.certificate.replaced[0]`) onto every endpoint serving the victim certificate.\n\nAny authenticated non-read-only user can therefore silently substitute their own certificate onto production load balancers and Kubernetes secrets they hold no role on, while suppressing the legitimate certificate's lifecycle automation.\n\n## Affected route\n\n`POST /api/1/certificates`\n`POST /api/1/certificates/upload`\n`PUT /api/1/certificates/<id>`\n\n## Affected code\n\n- [`lemur/certificates/schemas.py:402`](https://github.com/Netflix/lemur/blob/main/lemur/certificates/schemas.py#L402) — `replaces = fields.Nested(AssociatedCertificateSchema, missing=[], many=True)` accepted on create/upload/edit\n- [`lemur/schemas.py:152`](https://github.com/Netflix/lemur/blob/main/lemur/schemas.py#L152) — `AssociatedCertificateSchema` resolves any certificate by id/name via `fetch_objects(Certificate, data)` with no permission check\n- [`lemur/certificates/views.py:651`](https://github.com/Netflix/lemur/blob/main/lemur/certificates/views.py#L651) — only `StrictRolePermission().can()` gates `/certificates/upload`; no check on `data['replaces']`\n- [`lemur/certificates/models.py:506`](https://github.com/Netflix/lemur/blob/main/lemur/certificates/models.py#L506) — `@event.listens_for(Certificate.replaces, 'append')` sets `value.notify = False` on the victim\n- [`lemur/certificates/service.py:277`](https://github.com/Netflix/lemur/blob/main/lemur/certificates/service.py#L277) — `get_all_pending_reissue()` filters `not_(Certificate.replaced.any())`, excluding the victim\n- [`lemur/certificates/cli.py:347`](https://github.com/Netflix/lemur/blob/main/lemur/certificates/cli.py#L347) — `request_rotation(endpoint, endpoint.certificate.replaced[0], message, commit)` deploys the attacker cert\n- [`lemur/common/celery.py:638`](https://github.com/Netflix/lemur/blob/main/lemur/common/celery.py#L638) — periodic `certificate_rotate` task runs `cli_certificate.rotate(..., commit=True)`\n- [`lemur/deployment/service.py:17`](https://github.com/Netflix/lemur/blob/main/lemur/deployment/service.py#L17) — `endpoint.source.plugin.update_endpoint(endpoint, new_cert)` pushes to ELB/CloudFront/ACM/K8s\n\n## Impact\n\nAn authenticated insider or holder of a stolen low-privilege token can, without holding any role on a target certificate:\n\n1. Upload a self-signed or attacker-minted certificate listing arbitrary high-value production certificate IDs in `replaces`.\n2. Immediately disable expiration notifications and auto-reissue for those production certificates.\n3. On the next scheduled `certificate_rotate` Celery run, have the attacker's certificate pushed to every endpoint (AWS ELB/CloudFront/ACM, Kubernetes, SFTP, etc.) currently serving the victim certificate, while the legitimate certificate is detached.\n\nMinimum impact is fleet-wide TLS denial of service equivalent to mass revocation. Where internal clients trust the substituted chain (or combined with the sub-CA finding LEMUR-BUG-07), it escalates to TLS interception. This directly violates the invariant that a user may only modify or revoke a certificate if they are its owner, a member of an owning role, or an administrator.\n\n## Root cause\n\n`AssociatedCertificateSchema.get_object` calls `fetch_objects(Certificate, data)` and returns the ORM rows verbatim. No caller on the create/upload/edit path iterates the resolved `replaces` list to enforce `CertificatePermission` before the model assigns them, and the `Certificate.replaces` append event listener mutates the victim row (`notify = False`) as a side effect of ORM collection assignment. The direct revoke endpoint *does* enforce `CertificatePermission`, but this `replaces` path achieves an equivalent or worse outcome while bypassing it entirely.\n\n## Validated evidence\n\nStatic trace, confirmed by code inspection (validation status: `CONFIRMED`):\n\n- `replaces` is accepted in `CertificateInputSchema` / `CertificateUploadInputSchema` and resolved via `fetch_objects(Certificate, ...)` with no per-object authorization.\n- `grep -n CertificatePermission lemur/certificates/views.py` shows the check is applied to `PUT`/`DELETE`/`revoke`/`export` paths but never to the `replaces` payload of `POST /certificates` or `POST /certificates/upload`.\n- The Celery `certificate_rotate` task and `cli.rotate()` consume `Endpoint.replaced.any()` unconditionally and deploy `replaced[0]` with `commit=True`.\n\n## Proof of concept / reproducer\n\nStatus: reconstructed from source report (static control-flow trace; not executed against a live CA).\n\nPreconditions: attacker is an authenticated Lemur user holding any role other than `read-only` (default `StrictRolePermission` config). `<VICTIM_CERT_ID>` is any certificate id readable via `GET /api/1/certificates`.\n\n```bash\n# 1. Upload an attacker-controlled cert that \"replaces\" the victim\ncurl -sS -X POST \"<TARGET_BASE_URL>/api/1/certificates/upload\" \\\n  -H \"Authorization: Bearer <AUTH_TOKEN>\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n        \"name\": \"attacker-replacement\",\n        \"owner\": \"attacker@example.com\",\n        \"body\": \"-----BEGIN CERTIFICATE-----\\n<ATTACKER_CERT_PEM>\\n-----END CERTIFICATE-----\",\n        \"privateKey\": \"-----BEGIN PRIVATE KEY-----\\n<ATTACKER_KEY_PEM>\\n-----END PRIVATE KEY-----\",\n        \"replaces\": [{\"id\": <VICTIM_CERT_ID>}]\n      }'\n\n# 2. Observe victim.notify is now false and victim is queued for rotation\ncurl -sS \"<TARGET_BASE_URL>/api/1/certificates/<VICTIM_CERT_ID>\" \\\n  -H \"Authorization: Bearer <AUTH_TOKEN>\" | jq '.notify, .replaced'\n\n# 3. On the next certificate_rotate Celery beat tick, the attacker cert is\n#    deployed to every endpoint that was serving <VICTIM_CERT_ID>.\n```\n\nStatic-trace validation command from the source report:\n\n```bash\ngrep -n 'replaces' lemur/certificates/schemas.py lemur/certificates/views.py lemur/schemas.py \\\n  && grep -n 'CertificatePermission' lemur/certificates/views.py\n```\n\nSource artifact: `audit/harnesses/public-repo-threat-model-harness/results/netflix-lemur-100run-mythos-20260627T051129Z/findings.jsonl` (run_083, finding cluster `lemur-replaces-unauth`, 7/100 runs).\n\n## Suggested fix\n\nBefore persisting `replaces`/`replacements` on certificate create, upload, and edit, iterate each referenced certificate and enforce the same `CertificatePermission(owner_role, cert.roles)` check used by the revoke endpoint ([`views.py:1677-1685`](https://github.com/Netflix/lemur/blob/main/lemur/certificates/views.py#L1677)); reject with 403 if the caller is not creator/owner/role-member/admin for any target. Additionally, move the `value.notify = False` side effect out of the SQLAlchemy append listener so an authorization failure cannot leave a victim certificate partially mutated, and emit an `audit_log` entry whenever a certificate is marked as replaced.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Lemur gestiona la creación de certificados TLS. Desde la versión 0.5.0 hasta la 1.9.3, las solicitudes de creación, carga y edición de certificados aceptaban identificadores de replaces[] o replacements que AssociatedCertificateSchema resolvía con fetch_objects sin una verificación de CertificatePermission. Asignar esos objetos a Certificate.replaces invocaba un append listener que deshabilitaba las notificaciones del certificado víctima y lo marcaba como reemplazado. La víctima era entonces excluida de get_all_pending_reissue, y certificate_rotate podía desplegar el certificado del atacante a los puntos finales que servían a la víctima. Un usuario autenticado no de solo lectura podía atacar certificados sobre los cuales el usuario no tenía propiedad o rol, suprimir la automatización del ciclo de vida y causar una interrupción de TLS en toda la flota o una sustitución no autorizada. La solución autoriza cada certificado de reemplazo referenciado antes de la mutación. Este problema está solucionado en la versión 1.9.3.","source":"nvd"}],"published":"2026-08-18T19:00:40.503Z","modified":"2026-10-22T22:10:00.250Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H","score":8.1,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H","score":8.1,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H","score":8.1,"rating":"HIGH"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H","score":8.1,"rating":"HIGH"}],"cwes":["CWE-639","CWE-862"],"affected":[{"ranges":[{"version":">= 0.5.0, < 1.9.3","status":"affected"}],"vendor":"Netflix","product":"lemur","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0.5.0","status":"affected","fixed":"1.9.3"}],"ecosystem":"PyPI","package":"lemur","purl":"pkg:pypi/lemur","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0.5.0","status":"affected","fixed":"1.9.3"}],"ecosystem":"PyPI","package":"lemur","purl":"pkg:pypi/lemur","source":"pysec"}],"references":[{"url":"https://github.com/Netflix/lemur/security/advisories/GHSA-cfh6-pv5c-38jv","tags":["exploit","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/Netflix/lemur/commit/286874535160952143b0afe2d356642669f9d4c6","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/Netflix/lemur/releases/tag/v1.9.3","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/Netflix/lemur","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://pypi.org/project/lemur","tags":["package"],"sources":["pysec"]},{"url":"https://github.com/advisories/GHSA-cfh6-pv5c-38jv","tags":["advisory"],"sources":["pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-71308","tags":["advisory"],"sources":["pysec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-08-18T19:34:39.582Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-71308","url":"https://www.cve.org/CVERecord?id=CVE-2026-71308","licence":"CVE Terms of Use","modified":"2026-08-18T19:34:59.015Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-cfh6-pv5c-38jv","url":"https://github.com/advisories/GHSA-cfh6-pv5c-38jv","licence":"CC-BY-4.0","modified":"2026-08-19T12:55:54.108Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-71308","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-71308","licence":"Public domain","modified":"2026-10-22T22:10:00.250Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-3675","url":"https://osv.dev/vulnerability/PYSEC-2026-3675","licence":"CC-BY-4.0","modified":"2026-08-19T12:45:11.230Z"}],"updatedAt":"2026-11-25T22:59:33.572Z","epss":{"score":0.00217,"percentile":0.12919,"date":"2026-12-01T12:00:22.000Z"}}