kubectl creating secrets from stringData leaves secret in plain text
- Disclosed after 6 months
Report Submission Form
Summary:
kubectl creating secrets from stringData leaves secret in plain text
Kubernetes Version:
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.3", GitCommit:"1e11e4a2108024935ecfcb2912226cedeafd99df",GitTreeState:"clean", BuildDate:"2020-10-14T12:50:19Z", GoVersion:"go1.15.2", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.3", GitCommit:"1e11e4a2108024935ecfcb2912226cedeafd99df", GitTreeState:"clean", BuildDate:"2020-10-14T12:41:49Z", GoVersion:"go1.15.2", Compiler:"gc", Platform:"linux/amd64"}
Component Version:
n/a
Steps To Reproduce:
Create a secret using stringData and query it.
$ cat sec.yaml
kind: Secret
apiVersion: v1
metadata:
name: stupid
stringData:
user: clear
password: revealed
$ kubectl get secret stupid -o yaml
apiVersion: v1
data:
password: cmV2ZWFsZWQ=
user: Y2xlYXI=
kind: Secret
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"v1","kind":"Secret","metadata":{"annotations":{},"name":"stupid","namespace":"default"},"stringData":{"password":"revealed","user":"clear"}}
creationTimestamp: "2021-02-12T10:11:02Z"
Even if you update the secret, the new value is then shown in the last-applied-configuration. Meaning the base64 "protection" against inadvertent disclosure is pointless. kubectl should probably either obscure or base64 the values in last-applied for secrets.
Supporting Material/References:
[list any additional material (e.g. screenshots, logs, etc.)]
- [attachment / reference]
Impact
An attacker could oversee a non-obfuscated secret.
(It seems fairly unlikely/minor but you've gone to the trouble of base64 encoding it for a reason. Why would that reason apply for the actual value but 2 lines further down no longer apply?)
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is known
A low-severity info disclosure bug in https://github.com/kubernetes/kubectl, rated CVSS 3.5. HackerOne made it public on 21 August 2021.
About Info disclosure
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.