security
config_error
ai_generated
partial
Kubernetes 密钥以明文形式存储在 etcd 中
Kubernetes secret is stored in plaintext in etcd
ID: security/kubernetes-secret-etcd-plaintext
80%修复率
86%置信度
1证据数
2023-05-22首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| Kubernetes 1.24 | active | — | — | — |
| Kubernetes 1.28 | active | — | — | — |
| etcd 3.5 | active | — | — | — |
根因分析
Kubernetes 密钥是 base64 编码的,但除非配置了静态加密,否则在 etcd 中不会加密存储,任何有权访问 etcd 的人都会暴露敏感数据。
English
Kubernetes secrets are base64-encoded but not encrypted at rest in etcd unless encryption at rest is configured, exposing sensitive data to anyone with etcd access.
官方文档
https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/解决方案
-
为 Kubernetes 密钥启用静态加密。编辑 kube-apiserver 配置,添加包含 `aescbc` 等提供程序的 EncryptionConfiguration 文件。示例:`--encryption-provider-config=/etc/kubernetes/enc/enc.yaml`。
-
使用外部密钥管理系统,如 HashiCorp Vault 或 AWS Secrets Manager,并在应用程序中引用它们,而不是将密钥存储在 etcd 中。
-
将 etcd 访问限制为仅控制平面节点,并对所有 etcd 连接使用 TLS 客户端认证。
无效尝试
常见但无效的做法:
-
90% 失败
Setting base64 encoding as encryption is a common misconception; base64 is not encryption and can be trivially decoded.
-
50% 失败
Using network policies to restrict etcd access doesn't protect against attackers who compromise a pod with etcd access.
-
70% 失败
Deleting the secret from etcd without cleaning up backups leaves the plaintext data in backup snapshots.