CVE-2019-11250 remains in effect.
Kubernetes logs bearer tokens in debug output because the curl command generation does not mask sensitive headers. An attacker with log access could replay the token to impersonate a user.
Originally disclosed on HackerOne
- Triaged in 35 days
- Fixed in 2 months
- Paid in 2 months
- Disclosed after 4 months
Report Submission Form
Summary:
"CVE-2019-11250: TOB-K8S-001: Bearer tokens are revealed in logs" remains in effect.
Kubernetes Version:
Effects at least all versions since 1.4.
- This was determined with some
gitarchaeology. This was determined by following the code snippet from it's current location inkubernetes/staging/src/k8s.io/client-go/transport/round_trippers.go - The snippet was last meaningfully modified
- It's current location in The snippet remains relatively unchanged since
Component Version:
I'm not sure.
Steps To Reproduce:
- Spin up a cluster with high verbosity: klog.V(9).Enabled()
- Watch logs round_trippers.go
curl -k -v -X<> -H "Authorization: <token>" <...>
I was having trouble getting a cluster spun up, so I have not managed a live reproduction.
Supporting Material/References:
[Issue #81146: Kubernetes 3rd Party Security Audit Findings] (https://github.com/kubernetes/kubernetes/issues/81146)
[Issue #81114: CVE-2019-11250: TOB-K8S-001: Bearer tokens are revealed in logs] (https://github.com/kubernetes/kubernetes/issues/81114)
[Partial fix for #81114: PR #81330]
(https://github.com/kubernetes/kubernetes/pull/81330).
Note that only debuggingRoundTripper.RoundTrip only masks headers in the if rt.levels[debugRequestHeaders] block, exposure is also present in the
if rt.levels[debugCurlCommand] {klog.Infof("%s", reqInfo.toCurl())} preceding it.
At kubernetes/staging/src/k8s.io/client-go/transport/round_trippers.go:416:
func (rt *debuggingRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
reqInfo := newRequestInfo(req)
if rt.levels[debugJustURL] {
klog.Infof("%s %s", reqInfo.RequestVerb, reqInfo.RequestURL)
}
if rt.levels[debugCurlCommand] {
klog.Infof("%s", reqInfo.toCurl())
}
if rt.levels[debugRequestHeaders] {
klog.Infof("Request Headers:")
for key, values := range reqInfo.RequestHeaders {
for _, value := range values {
value = maskValue(key, value)
klog.Infof(" %s: %s", key, value)
}
}
}
// <function continues>
}
At kubernetes/staging/src/k8s.io/client-go/transport/round_trippers.go:338:
// toCurl returns a string that can be run as a command in a terminal (minus the body)
func (r *requestInfo) toCurl() string {
headers := ""
for key, values := range r.RequestHeaders {
for _, value := range values {
headers += fmt.Sprintf(` -H %q`, fmt.Sprintf("%s: %s", key, value))
}
}
return fmt.Sprintf("curl -k -v -X%s %s '%s'", r.RequestVerb, headers, r.RequestURL)
}
Correction will be a one-line diff to use maskValue in this loop as well.
Impact
Alice logs into a Kubernetes cluster and is issued a Bearer token. The system logs her token. Eve, who has access to the logs but not the production Kubernetes cluster, replays Alice’s Bearer token, and can masquerade as Alice to the cluster.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The debugging round tripper logs the full curl command including unmasked Authorization headers, because the masking function is only applied in a separate header-logging block.
Impact
An attacker with access to logs but not the cluster could replay the token to masquerade as the user; the report notes no live reproduction was achieved.
What the attacker needed
High verbosity logging enabled; access to logs
The fix
The fix should apply the existing masking function to the curl command generation as well, a one-line change.
How it was found
- Spin up a cluster with high verbosity logging enabled.
- Watch the logs for the curl command output that includes the Authorization header.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When Kubernetes runs with very detailed logging, it prints the full curl command it would use to make a request. That command includes the Authorization header, which holds a secret token. Anyone who can read those logs can copy the token and use it to act as the user.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.