{"id":"GHSA-g532-v72x-9hhj","aliases":[],"summary":"Unbounded memory allocation in template rendering may cause controller denial of service","published_at":"2026-11-10T13:20:56Z","modified_at":"2026-11-10T13:20:56Z","products":[{"slug":"external-secrets","name":"External Secrets Operator","category":"kubernetes-container"}],"rating":{"severity":"medium","score":6.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","attack_path":"internet_authenticated","user_interaction":false,"malicious":false},"fix_available":true,"kev":{"listed":false,"ransomware":false},"public_exploit":false,"exploits":[],"priority":7.5,"record_count":1,"vendors":["GitHub"],"details":"## Impact\r\n\r\nOn affected versions, the template engine that renders `ExternalSecret`, `ClusterExternalSecret` and `PushSecret` targets evaluates user-supplied Go templates without bounding the memory a single rendered value may consume.\r\nTemplate functions that take their output size from a numeric argument like `until`, `seq`, `repeat`, `(n)indent`, `rand*` and others allocate that output in full before anything is rendered, and the rendered result accumulates in an unbounded buffer.\r\n\r\nA single templated value such as `{{ until 35000000 | join \" \" }}` is therefore enough to exhaust the controller's memory. The process is terminated by the OOM killer, and because the object stays in the cluster it is rendered again on the next reconcile, so the controller crash-loops instead of recovering.\r\n\r\nThis halts reconciliation on ALL the namespaces covered by the instance.\r\nRecovery requires an administrator to inspect logs and find the culprint before the object can be removed.\r\nWe have added, in debug mode, the ability to log which ExternalSecret enters and leaves templating. This allows a deployer to pinpoint the secrets causing the DoS (the one which does not leave templating).\r\n\r\nExploitation requires permission to create or update one of these resources in a single namespace\r\nThe resource is valid against the CRD schema and its cost only materializes during rendering, so admission validation accepts it.\r\n\r\n## Workarounds\r\n\r\nUpgrade to v2.15.0 (Helm chart 2.15.0). If you cannot upgrade immediately:\r\n\r\n- Restrict create and update on `ExternalSecret`, `ClusterExternalSecret` and `PushSecret` to trusted principals. Note that the common edit `ClusterRole` grants these verbs on every custom resource in a namespace.\r\n- Alternatively, reject the generative template functions in `spec.target.template` with a `ValidatingAdmissionPolicy`. This is a denylist and *will not cover every way of constructing a large value*.\r\n- Limit the controller's watched namespaces reduces the blast radius (confines an outage to the namespace that caused it).\r\n\r\nContainer memory limits are not a workaround. They make the OOM faster and more reproducible, and the controller still crash-loops. Running without a memory limit is worse rather than better: the process can consume node memory until the kernel OOM killer affects unrelated workloads.\r\n\r\n## Background\r\n\r\nExternal Secrets Operator renders user-supplied Go templates, extended with an in-tree copy of the Sprig function library, inside the shared controller process. Most template functions produce output proportional to their input, but a number of them size their output from a numeric argument instead. For those, a few bytes of resource specification turn into an arbitrarily large allocation, and the allocation happens inside the function before a single byte reaches the template writer. The writer itself collected the result in a plain buffer, so even incremental output had no ceiling.\r\n\r\nIn a cluster-wide controller scenario, every field of a namespaced custom resource is input from a tenant who may be hostile, and the usual boundary (admission validation) cannot help here. The request is well-formed and its cost becomes apparent only during evaluation, so the limit has to live in the evaluator rather than in the schema or the webhook.\r\n\r\nv2.15.0 bounds these functions directly: functions that build a collection are capped at 10,000 elements, functions that build a string are capped just below 1 MiB, and the engine renders into a buffer that enforces the same 1 MiB cap per rendered value. Exceeding either limit now fails that one resource with an error on its status, while the controller continues to serve every other tenant. These limits bound memory per rendered value; they do not bound evaluation time, so hardening of the template engine continues in subsequent releases.","affected_stack":[{"ecosystem":"Go","package":"github.com/external-secrets/external-secrets","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"2.15.0"}]}],"fixed":["2.15.0"],"provider":"github-repo-advisories","source":"GHSA-g532-v72x-9hhj","relation":"self"}],"affected_other":[],"product_status":[],"records":[{"provider":"github-repo-advisories","source_id":"GHSA-g532-v72x-9hhj","relation":"self","url":"https://github.com/external-secrets/external-secrets/security/advisories/GHSA-g532-v72x-9hhj","license":"GitHub Terms of Service","published_at":"2026-11-10T13:20:56Z","modified_at":"2026-11-10T13:20:56Z","summary":"Unbounded memory allocation in template rendering may cause controller denial of service","details":"## Impact\r\n\r\nOn affected versions, the template engine that renders `ExternalSecret`, `ClusterExternalSecret` and `PushSecret` targets evaluates user-supplied Go templates without bounding the memory a single rendered value may consume.\r\nTemplate functions that take their output size from a numeric argument like `until`, `seq`, `repeat`, `(n)indent`, `rand*` and others allocate that output in full before anything is rendered, and the rendered result accumulates in an unbounded buffer.\r\n\r\nA single templated value such as `{{ until 35000000 | join \" \" }}` is therefore enough to exhaust the controller's memory. The process is terminated by the OOM killer, and because the object stays in the cluster it is rendered again on the next reconcile, so the controller crash-loops instead of recovering.\r\n\r\nThis halts reconciliation on ALL the namespaces covered by the instance.\r\nRecovery requires an administrator to inspect logs and find the culprint before the object can be removed.\r\nWe have added, in debug mode, the ability to log which ExternalSecret enters and leaves templating. This allows a deployer to pinpoint the secrets causing the DoS (the one which does not leave templating).\r\n\r\nExploitation requires permission to create or update one of these resources in a single namespace\r\nThe resource is valid against the CRD schema and its cost only materializes during rendering, so admission validation accepts it.\r\n\r\n## Workarounds\r\n\r\nUpgrade to v2.15.0 (Helm chart 2.15.0). If you cannot upgrade immediately:\r\n\r\n- Restrict create and update on `ExternalSecret`, `ClusterExternalSecret` and `PushSecret` to trusted principals. Note that the common edit `ClusterRole` grants these verbs on every custom resource in a namespace.\r\n- Alternatively, reject the generative template functions in `spec.target.template` with a `ValidatingAdmissionPolicy`. This is a denylist and *will not cover every way of constructing a large value*.\r\n- Limit the controller's watched namespaces reduces the blast radius (confines an outage to the namespace that caused it).\r\n\r\nContainer memory limits are not a workaround. They make the OOM faster and more reproducible, and the controller still crash-loops. Running without a memory limit is worse rather than better: the process can consume node memory until the kernel OOM killer affects unrelated workloads.\r\n\r\n## Background\r\n\r\nExternal Secrets Operator renders user-supplied Go templates, extended with an in-tree copy of the Sprig function library, inside the shared controller process. Most template functions produce output proportional to their input, but a number of them size their output from a numeric argument instead. For those, a few bytes of resource specification turn into an arbitrarily large allocation, and the allocation happens inside the function before a single byte reaches the template writer. The writer itself collected the result in a plain buffer, so even incremental output had no ceiling.\r\n\r\nIn a cluster-wide controller scenario, every field of a namespaced custom resource is input from a tenant who may be hostile, and the usual boundary (admission validation) cannot help here. The request is well-formed and its cost becomes apparent only during evaluation, so the limit has to live in the evaluator rather than in the schema or the webhook.\r\n\r\nv2.15.0 bounds these functions directly: functions that build a collection are capped at 10,000 elements, functions that build a string are capped just below 1 MiB, and the engine renders into a buffer that enforces the same 1 MiB cap per rendered value. Exceeding either limit now fails that one resource with an error on its status, while the controller continues to serve every other tenant. These limits bound memory per rendered value; they do not bound evaluation time, so hardening of the template engine continues in subsequent releases.","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","source":"GHSA-g532-v72x-9hhj"}],"affected":[{"ecosystem":"Go","package":"github.com/external-secrets/external-secrets","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"2.15.0"}]}],"fixed":["2.15.0"],"provider":"github-repo-advisories","source":"GHSA-g532-v72x-9hhj","relation":"self"}],"product_status":[],"references":[{"type":"ADVISORY","url":"https://github.com/external-secrets/external-secrets/security/advisories/GHSA-g532-v72x-9hhj"}]}],"references":[{"type":"ADVISORY","url":"https://github.com/external-secrets/external-secrets/security/advisories/GHSA-g532-v72x-9hhj"}],"sources":[{"provider":"github-repo-advisories","source_id":"GHSA-g532-v72x-9hhj","url":"https://github.com/external-secrets/external-secrets/security/advisories/GHSA-g532-v72x-9hhj","license":"GitHub Terms of Service","modified_at":"2026-11-10T13:20:56Z","relation":"self"}]}
