Skip to content
Access control Disclosed report Intermediate CVE-2020-8553

Compromise of auth via subset/superset namespace names.

The nginx ingress controller generated htpasswd filenames by concatenating namespace and ingress name with a hyphen, allowing a user who can create namespaces and ingresses to overwrite another ingress's authentication file. An attacker could thereby remove the HTTP authentication protecting another ingress.

alex_orange Follow

Originally disclosed on HackerOne

Medium 6.6 View original
  • Triaged in 34 hours
  • Fixed in 3 months
  • Paid in 15 days
  • Disclosed after 9 months

Report Submission Form

Summary:

Use of nginx.ingress.kubernetes.io/auth* annotations results in a file named {namespace}-{ingress}.passwd. If user knows the namespace and ingress of an ingress they want to compromise they need to be able to create a namespace that is some subset of {namespace}-{ingress}. Then they create an ingress with the remainder of the name and a passwd file of their choosing, this overwrites the other namespace's passwd file and effectively removes the auth layer provided by nginx ingress.

Kubernetes Version:

$ kubectl version Client Version: version.Info{Major:"1", Minor:"16+", GitVersion:"v1.16.5-beta.0", GitCommit:"224be7bdce5a9dd0c2fd0d46b83865648e2fe0ba", GitTreeState:"archive", BuildDate:"2019-12-31T22:42:08Z", GoVersion:"go1.12.13", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.2", GitCommit:"c97fe5036ef3df2967d086711e6c0c405941e14b", GitTreeState:"clean", BuildDate:"2019-10-15T19:09:08Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"linux/amd64"}

Installed via kubeadm on gentoo (though I don't think this is relevant to vulnerability).

Component Version:

quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.26.1

Steps To Reproduce:

  1. Install nginx ingress
  2. Create namespace a and ingress b-c within a with an auth annotation.
  3. Create namespace a-b and ingress c within a-b with an auth annotation that overrides the passwd file from #2.
  4. Auth to ingress on a/b-c is now governed by the htpasswd file generated for a-b/c.

Suggested Resolution:

  1. Change line 141 of internal/ingress/annotations/auth/main.go to %v/%v/%v.
  2. Create folder to go along with.
  3. Check that the folder and file will actually be in the right location (.. is allowed as a namespace).

Impact

Attacker can override the htpasswd file of another ingress effectively neutralizing the http authentication.

The original report as published on HackerOne, by alex_orange. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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

Likely the htpasswd filename was constructed by concatenating namespace and ingress name with a hyphen without escaping or using a directory structure, allowing name collisions.

Impact

An attacker could override the htpasswd file of another ingress, effectively neutralising the HTTP authentication.

What the attacker needed

Ability to create namespaces; ability to create ingresses; knowledge of target namespace and ingress name

The fix

The suggested resolution is to change the filename format to use a directory structure (%v/%v/%v) and ensure the path is correct, also considering that '..' is allowed as a namespace.

How it was found

  1. Install nginx ingress
  2. Create namespace a and ingress b-c within a with an auth annotation
  3. Create namespace a-b and ingress c within a-b with an auth annotation that overrides the passwd file from step 2
  4. Auth to ingress on a/b-c is now governed by the htpasswd file generated for a-b/c

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.

The ingress controller is a component that manages web traffic in Kubernetes. It stored password files for basic authentication using a name built from the namespace and ingress name joined by a hyphen. Because names can contain hyphens, someone could create a namespace and ingress whose combined name matched another ingress's password file, replacing it and bypassing the login prompt.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More from Kubernetes

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.