T09 · Insecure Skill Coding Practices
- Location
SKILL.md:45- Finding
Kubernetes Secret Bodies Exposed Through RequestResponse Audit Logging
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, line 45
Vulnerability Type: Sensitive information exposure through unsafe audit configuration
Risk Level: HighVulnerable Code Snippet:
yaml apiVersion: audit.k8s.io/v1 kind: Policy rules: - level: RequestResponse omitStages: - RequestReceived resources: - group: "" resources: - secretsTechnical Analysis
The generated audit policy applies the
RequestResponseaudit level to Kubernetes Secret resources. This level records request and response bodies rather than limiting records to metadata.Kubernetes Secret API payloads contain sensitive values in base64-encoded fields. Base64 is not encryption and can be decoded without a key. Consequently, Secret creation, modification, or retrieval operations can place credentials, tokens, certificates, and application secrets into audit records.
The exposure can extend beyond the Kubernetes control plane because audit logs are commonly forwarded to centralized logging, monitoring, archival, or security analytics systems. Every user and service with access to those systems may consequently gain indirect access to cluster secrets.
Attack Path
- An administrator applies or adapts the generated audit policy.
- A user, controller, or workload creates, updates, or reads a Kubernetes Secret.
- The API server records the operation's request or response body under the
RequestResponsepolicy level. - The audit record is retained locally or exported to a centralized logging service.
- An attacker compromises a log-reading account, or an overprivileged logging user searches the audit data.
- The attacker extracts and base64-decodes the Secret values.
- The recovered credentials are used to access workloads, databases, cloud services, or other protected resources.
Impact Assessment
The obtainable privileges depend on the affected Secret contents. Exposure m ...[truncated 378 chars]
- Remediation
View remediation
Remediation Suggestions
- Use the
Metadataaudit level for Secret resources so request and response bodies are not recorded. - Add a dedicated Secret rule before broader audit rules to ensure sensitive resources receive the safer policy.
- Review audit rules for ConfigMaps, token requests, authentication objects, and custom resources that may also contain credentials.
- Restrict audit-log access through narrowly scoped IAM and Kubernetes permissions.
- Encrypt audit logs both in transit and at rest.
- Apply short, documented retention periods appropriate to operational and compliance needs.
- Prevent unrestricted export of sensitive audit events to third-party logging systems.
- Rotate any credentials that may already have been recorded under this policy.
- Add automated tests that reject generated audit policies assigning
Request,RequestResponse, or equivalent body-logging levels to Secret resources.
A safer rule is:
yaml apiVersion: audit.k8s.io/v1 kind: Policy rules: - level: Metadata resources: - group: "" resources: - secrets- Use the
