Описание
KubeVela Terraform remote loader DoS via unbounded file read
Summary
KubeVela's Terraform remote configuration loader can be abused to make vela-core read an unbounded byte stream into memory, causing an out-of-memory kill and a control-plane denial of service.
The issue is reachable when a user with permission to create or update a core.oam.dev/v1beta1 ComponentDefinition registers a Terraform remote schematic that points to a malicious or compromised git repository. The repository can contain a variables.tf symlink that resolves to /dev/zero after checkout. vela-core follows the symlink and calls os.ReadFile before HCL parsing, so memory grows until the controller is OOM killed.
Details
The affected code is in pkg/controller/utils/capability.go, inside GetTerraformConfigurationFromRemote:
https://github.com/kubevela/kubevela/blob/a24d3a9c6/pkg/controller/utils/capability.go#L231-L242
When a ComponentDefinition uses:
the controller clones the user-supplied git repository and then reads variables.tf or main.tf from the checkout. The read path is built from attacker-controlled repository contents and terraform.path, but the code does not verify:
- whether the target is a regular file;
- whether the resolved path remains inside the clone cache;
- how large the file is before reading it.
Both os.Stat and os.ReadFile follow symlinks. If the repository contains variables.tf -> ../../../../../../dev/zero, then after checkout under the default cache path this symlink resolves to /dev/zero. os.Stat succeeds, and os.ReadFile reads from /dev/zero, which never returns EOF.
The failure happens during os.ReadFile, before the content reaches HCL parsing or ParseTerraformVariables, so later validation cannot prevent the OOM.
This vulnerability also has a path-traversal-like aspect, because symlinks and terraform.path can steer the read target outside the intended repository path. However, exposing arbitrary file contents would require the read data to pass HCL parsing before anything is written to a ConfigMap. Therefore, this report focuses on the availability impact caused by the unbounded read in os.ReadFile before HCL parsing, rather than a confidentiality impact.
PoC
Prerequisites:
- KubeVela is installed with the default configuration, for example in a kind cluster:
- I reproduced this with
oamdev/vela-core:v1.10.8and avela-corememory limit of 1Gi. - The attacker has
create/updatepermissions forcore.oam.dev/v1beta1ComponentDefinitionin any namespace. - The tester can create a git repository that
vela-corecan clone.
- Create a test git repository. In the repository root, add a relative
variables.tfsymlink that resolves to/dev/zeroafter checkout, then push it:
- Create
poc-componentdefinition.yaml. Replaceconfigurationwith the repository URL from step 1:
The workload GVK should reference a type that exists in the cluster, such as apps/v1 Deployment.
- Apply the manifest and observe
vela-core:
- Confirm the OOMKilled termination:
Expected result:
The pod may then enter CrashLoopBackOff.
If the reconcile fails with stat .../main.tf: no such file or directory, check that the symlink is relative and resolves to /dev/zero from the checkout location. If the same ComponentDefinition was already reconciled, remove the stale clone cache under /root/.vela/terraform/<name> and retry.
Impact
This is a denial-of-service vulnerability affecting KubeVela control-plane availability.
A user who can create or update ComponentDefinition objects can cause the cluster-wide vela-core controller to be OOM killed.
If vela-core has a memory limit, the impact is likely contained to repeated OOMKilled restarts of the controller Pod. If no effective memory limit is configured, the unbounded read can also pressure node memory and affect other workloads running on the same node.
Ссылки
- https://github.com/kubevela/kubevela/security/advisories/GHSA-fmgp-q6jx-gg3x
- https://github.com/kubevela/kubevela/pull/7191
- https://github.com/kubevela/kubevela/pull/7192
- https://github.com/kubevela/kubevela/commit/65dedda40a69cc1eccf4072a4c835e5b9f13334e
- https://github.com/kubevela/kubevela/commit/7a4e59b2958ce1cf031fafbc188d6fafe8fe4d2e
- https://github.com/kubevela/kubevela/commit/f6a64398b5e0065c57c3a0fb6765dd3dc48c749d
- https://github.com/kubevela/kubevela/releases/tag/v1.10.9
- https://github.com/kubevela/kubevela/releases/tag/v1.11.0-alpha.4
- https://github.com/kubevela/kubevela/releases/tag/v1.9.14
Пакеты
github.com/oam-dev/kubevela
< 1.9.14
1.9.14
github.com/oam-dev/kubevela
>= 1.10.0-alpha.1, < 1.10.9
1.10.9
github.com/oam-dev/kubevela
>= 1.11.0-alpha.1, < 1.11.0-alpha.4
1.11.0-alpha.4
Связанные уязвимости
KubeVela is an open source application delivery platform. Prior to 1.9.14, from 1.10.0-alpha.1 until 1.10.9, and from 1.11.0-alpha.1 until 1.11.0-alpha.4, the Terraform remote configuration loader in pkg/controller/utils/capability.go, GetTerraformConfigurationFromRemote, clones a repository supplied through a core.oam.dev/v1beta1 ComponentDefinition and follows repository-controlled variables.tf or main.tf symlinks. A user with permission to create or update ComponentDefinition objects can point variables.tf to /dev/zero through terraform.path, after which os.Stat and os.ReadFile follow the link and read an unbounded stream before ParseTerraformVariables or HCL parsing can reject the content. The read can exhaust memory, OOM-kill the cluster-wide vela-core controller, cause repeated Pod restarts, and pressure node memory when no effective container limit is configured. This issue is fixed in versions 1.9.14, 1.10.9, and 1.11.0-alpha.4.