AWS Load Balancer Controller Managed Security Groups can be replaced by an unprivileged attacker
The AWS Load Balancer Controller identified its managed security group by tags alone, so an attacker who could create a security group with the same tags and a lower ID could make the controller attach it to the ALB instead. The attacker could then open all ports on the load balancer or block legitimate traffic.
Originally disclosed on HackerOne
- Triaged in 53 days
- Paid in 5 months
- Disclosed after 11 months
Report Submission Form
Summary:
When creating an Ingress of class alb, by default, AWS Load Balancer Controller creates a managed SG and attaches it to the created ALB. This SG limits which ports of the ALB are accessible by whom.
An attacker is able to craft another SG that can be used to trick AWS Load Balancer Controller into changing the SG attached to an ALB. This is possible even though the attacker doesn't have permission to modify the ALB or the managed SG and also doesn't have access to the K8s cluster where the Ingress was created.
AWS Load Balancer Controller uses tree tags to associate a SG on AWS to the supposed managed SG created for an ALB: elbv2.k8s.aws/cluster, ingress.k8s.aws/stack, and ingress.k8s.aws/resource. When there are multiple SGs that match the expected tag values, the controller attaches the first one returned by the AWS SDK to the ALB and deletes the other ones. The API call returns SGs sorted by their respective ids.
If a SG is created with the tags expected by AWS Load Balancer Controller and its id is less than the one from the legit SG, the controller deletes the original SG and attaches the one created by the attacker to the ALB. An attacker is now able to manipulate SG rules for the ALB as they please.
Kubernetes Version:
version.Info{Major:"1", Minor:"20+", GitVersion:"v1.20.4-eks-6b7464", GitCommit:"6b746440c04cb81db4426842b4ae65c3f7035e53", GitTreeState:"clean", BuildDate:"2021-03-19T19:33:03Z", GoVersion:"go1.15.8", Compiler:"gc", Platform:"linux/amd64"}
Component Version:
AWS Load Balancer Controller v2.2.0
Steps To Reproduce:
- A developer creates an application, deploys it to K8s, and exposes it using an Ingress with class
alb.
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.9/docs/examples/echoservice/echoserver-namespace.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.9/docs/examples/echoservice/echoserver-service.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.9/docs/examples/echoservice/echoserver-deployment.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.9/docs/examples/echoservice/echoserver-ingress.yaml
- An attacker crafts an evil-twin of the managed SG attached to the target ALB. The attacker either knows the cluster name, namespace, and name of the Ingress related to the target ALB, or it needs to be able to describe the load balancer and its security group to acquire this information. If the id of the managed SG is unknown, the attacker may assume that its value is as low as
sg-00800000000000000and create a SG that has an id even lower, covering more than 96% of the possible security groups with a couple of minutes of brute-forcing.
VPC_ID=vpc-00123456789abcdef
CLUSTER_NAME=kind
NAMESPACED_NAME=echoserver/echoserver
MANAGED_SG_ID=sg-00123456789abcdef
MANAGED_SG_10=$(echo ${MANAGED_SG_ID} | awk '{ print "ibase=16;" toupper(substr($0,4)) }' | bc)
while true
do
UNMANAGED_SG_ID=$(aws ec2 create-security-group --description unmanaged-sg --group-name unmanaged-sg --vpc-id ${VPC_ID} | jq -r .GroupId)
UNMANAGED_SG_10=$(echo ${UNMANAGED_SG_ID} | awk '{ print "ibase=16;" toupper(substr($0,4)) }' | bc)
if [ ${UNMANAGED_SG_10} -lt ${MANAGED_SG_10} ]
then
break
fi
aws ec2 delete-security-group --group-id ${UNMANAGED_SG_ID}
done
aws ec2 create-tags --resources ${UNMANAGED_SG_ID} --tags "Key=elbv2.k8s.aws/cluster,Value=${CLUSTER_NAME}" "Key=ingress.k8s.aws/stack,Value=${NAMESPACED_NAME}" "Key=ingress.k8s.aws/resource,Value=ManagedLBSecurityGroup"
-
With the environment set, the attacker now should wait or somehow cause AWS Load Balancer Controller to reconcile the target load balancer. The reconciliation is normally triggered when the Ingress resource is modified or when the Pod of the controller restarts or is recreated, like when the Node where the controller was running is drained on a downscale procedure. Without another exploit or with a higher privilege on the account, user interaction is required.
-
After reconciliation, the load balancer has the malicious security group attached instead of the managed one that was created by the controller. The attacker modifies the SG rules and either gains access to the service or causes a denial of service.
Impact
The attacker has access to all ports of the targeted ALB and can possibly gain access to sensitive data from the service behind the load balancer or make calls that would cause some problem. It is also capable of blocking access of legitimate clients to the service, causing a denial of service.
Context
The AWS Load Balancer Controller is a Kubernetes component that reconciles AWS resources for Ingresses of class alb. When such an Ingress is created, the controller creates an Application Load Balancer and, by default, a managed security group (SG) that it attaches to that ALB. The managed SG is what limits which ports of the ALB are reachable, and by whom.
The controller keeps track of which AWS security group belongs to which Ingress through three tags on the SG:
elbv2.k8s.aws/clusteringress.k8s.aws/stackingress.k8s.aws/resource
The report shows that this tag-based association can be hijacked: an attacker who can create security groups in the VPC can craft one that the controller mistakes for its own managed SG, and the controller will then attach the attacker's SG to the ALB and delete the legitimate one. The attacker does not need permission to modify the ALB or the managed SG, and does not need access to the Kubernetes cluster where the Ingress lives.
Setup
The issue was reproduced against the following versions:
| Component | Version |
|---|---|
| Kubernetes | v1.20.4-eks-6b7464 (major 1, minor 20+) |
| AWS Load Balancer Controller | v2.2.0 |
The full Kubernetes version string reported is:
version.Info{Major:"1", Minor:"20+", GitVersion:"v1.20.4-eks-6b7464", GitCommit:"[redacted]", GitTreeState:"clean", BuildDate:"2021-03-19T19:33:03Z", GoVersion:"go1.15.8", Compiler:"gc", Platform:"linux/amd64"}
The attacker's precondition is the ability to create security groups in the VPC that hosts the target ALB. To build the correct tags, the attacker needs the cluster name and the namespace and name of the Ingress behind the target ALB; the managed SG id can be read from the load balancer or guessed (see step 2). The first three can be known in advance or obtained by describing the load balancer and its security group; the managed SG id can likewise be read from the load balancer, or guessed (see step 2).
Finding it
The controller resolves the managed SG for an ALB by querying AWS for security groups carrying the three expected tag values. When more than one SG matches those values, the controller does not treat the situation as an error. It takes the first SG returned by the AWS SDK, attaches it to the ALB, and deletes the other matching SGs. The API returns SGs sorted by their ids.
That ordering is the flaw. If an attacker creates a security group with the expected tags and an id lower than the legitimate managed SG's id, the attacker's SG sorts first. The controller then deletes the original managed SG and attaches the attacker's SG to the ALB. From that point the attacker controls the SG rules for the ALB.
Exploitation
Step 1: a legitimate Ingress of class alb
A developer deploys an application and exposes it through an Ingress of class alb. The report uses the echoserver example manifests:
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.9/docs/examples/echoservice/echoserver-namespace.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.9/docs/examples/echoservice/echoserver-service.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.9/docs/examples/echoservice/echoserver-deployment.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.9/docs/examples/echoservice/echoserver-ingress.yaml
This creates the namespace, service, deployment and Ingress. The controller responds by creating the ALB and its managed SG, tagged with the cluster, stack and resource values that identify it.
Step 2: craft an evil twin security group
The attacker creates a security group in the same VPC and gives it the three tags the controller expects. The goal is an id numerically lower than the managed SG's id, because the AWS API returns SGs sorted by id and the controller picks the first match.
The script below takes the managed SG id, converts its hexadecimal suffix to decimal, then loops creating and deleting security groups until it gets one whose id is lower. If the managed SG id is unknown, the attacker can assume a value as low as sg-00800000000000000 and create a group with an even lower id, which the report says covers more than 96% of the possible security groups with a couple of minutes of brute-forcing.
VPC_ID=vpc-00123456789abcdef
CLUSTER_NAME=kind
NAMESPACED_NAME=echoserver/echoserver
MANAGED_SG_ID=sg-00123456789abcdef
MANAGED_SG_10=$(echo ${MANAGED_SG_ID} | awk '{ print "ibase=16;" toupper(substr($0,4)) }' | bc)
while true
do
UNMANAGED_SG_ID=$(aws ec2 create-security-group --description unmanaged-sg --group-name unmanaged-sg --vpc-id ${VPC_ID} | jq -r .GroupId)
UNMANAGED_SG_10=$(echo ${UNMANAGED_SG_ID} | awk '{ print "ibase=16;" toupper(substr($0,4)) }' | bc)
if [ ${UNMANAGED_SG_10} -lt ${MANAGED_SG_10} ]
then
break
fi
aws ec2 delete-security-group --group-id ${UNMANAGED_SG_ID}
done
aws ec2 create-tags --resources ${UNMANAGED_SG_ID} --tags "Key=elbv2.k8s.aws/cluster,Value=${CLUSTER_NAME}" "Key=ingress.k8s.aws/stack,Value=${NAMESPACED_NAME}" "Key=ingress.k8s.aws/resource,Value=ManagedLBSecurityGroup"
The variables at the top hold the VPC id, the cluster name, the namespaced Ingress name and the managed SG id. The awk/bc pipeline strips the sg- prefix, uppercases the hex suffix and converts it to decimal so the two ids can be compared. The loop creates a group, compares, and deletes it if it is not lower. Once a lower id is found, create-tags applies the three tags: elbv2.k8s.aws/cluster set to the cluster name, ingress.k8s.aws/stack set to the namespaced name, and ingress.k8s.aws/resource set to ManagedLBSecurityGroup.
Step 3: trigger reconciliation
With the evil twin in place, the attacker waits for, or causes, the controller to reconcile the target load balancer. Reconciliation is normally triggered when the Ingress resource is modified, or when the controller Pod restarts or is recreated, for example when the Node running it is drained during a downscale. The report notes that without another exploit or higher privileges on the account, user interaction is required at this point.
Step 4: the swap
After reconciliation, the load balancer has the malicious security group attached instead of the managed one the controller created. The attacker then edits the SG rules to either gain access to the service or cause a denial of service.
Root cause
The controller identifies its managed SG purely by tag values and assumes at most one SG carries them. When several match, it silently picks the first one returned by the AWS SDK and deletes the rest. Because the API sorts by id, the selection is effectively "lowest id wins", a property an attacker with permission to create security groups can control.
Impact
With the malicious SG attached, the attacker has access to all ports of the targeted ALB. That can expose sensitive data from the service behind the load balancer, or allow calls that cause problems in the service. The attacker can also block legitimate clients from reaching the service, causing a denial of service. The report rates this as medium severity with a CVSS score of 5.5, weakness resource injection.
Fix
The report does not describe a fix. The behaviour it identifies implies the controller should not resolve its managed SG by tag alone when multiple SGs match, and should not delete SGs it did not create; it should treat a duplicate tag match as an error rather than picking the lowest id.
Variants to test
- Other controllers that resolve cloud resources by tags: check whether a duplicate tag match is rejected or silently resolved by ordering. A positive result is a second resource with the same tags being adopted or the legitimate one being deleted.
- Other tag sets used by the same controller for other resource types: look for the same "first match wins" pattern. A positive result is a resource you created being attached to a victim's load balancer.
- Guessing the managed resource id when it cannot be read: the report's
sg-00800000000000000assumption is a concrete starting point. A positive result is a created resource with a lower id that the controller adopts.
Hunting notes
This class of bug hides wherever a controller or operator maps cloud resources to Kubernetes objects through tags or names, and where the cloud API returns multiple matches. During recon, look for ALBs and other cloud resources whose tags name a cluster, namespace and object, and check whether you can create resources in the same account or VPC with the same tags. The signal is a controller that reconciles by tag lookup without an ownership check. To show impact, demonstrate that the controller attaches your resource and removes the legitimate one, then show what the new rules allow or block; here that meant access to all ports of the ALB and the ability to deny service to legitimate clients.
What happened, in plain words
A company runs an application on Kubernetes, a system for running software in containers across a group of machines. To let people on the internet reach that application, it uses a special piece of software called the AWS Load Balancer Controller. That controller watches Kubernetes and, when it sees a request to publish an application, it builds the matching pieces in Amazon Web Services (AWS), Amazon's cloud platform.
One of those pieces is a security group. A security group is a firewall rule set: it says which network ports are open and which addresses are allowed to connect. The controller creates a security group for each published application and attaches it to the load balancer, the front door that spreads incoming traffic to the application.
The report shows that an attacker who is allowed to create security groups in the same cloud network can build a fake one that the controller mistakes for its own. The controller then attaches the fake firewall to the victim's load balancer and deletes the real one. The attacker never needs permission to touch the load balancer, never needs to touch the real security group, and never needs access to the Kubernetes cluster. Once the swap happens, the attacker decides which ports are open, so they can let themselves in or lock everyone else out.
This kind of mistake is called resource injection: the attacker slips a resource they control into a place where the system expects only its own resource.
Context
The product and the feature
Kubernetes lets you describe what you want to run in a file, and a controller keeps the real world matching that description. The AWS Load Balancer Controller is one such controller. It looks for Kubernetes objects called Ingresses of class alb. An Ingress is a rule that says "send traffic for this web address to this application". The class alb tells the controller to use an AWS Application Load Balancer (ALB) to do the job.
When the controller sees such an Ingress, it does two things by default:
- It creates an ALB in AWS.
- It creates a managed security group and attaches it to that ALB.
The word "managed" means the controller considers the security group its own property and looks after it. That security group is the only thing deciding which ports of the ALB are reachable and from where.
How the controller recognises its own security group
AWS lets you put tags on resources. A tag is just a label made of a key and a value, like a sticky note on a box. The controller writes three tags on the security group it creates:
elbv2.k8s.aws/clusteringress.k8s.aws/stackingress.k8s.aws/resource
Later, when the controller needs to find "its" security group again, it asks AWS: give me the security groups that carry these three tag values. It trusts the answer completely.
The report shows that this trust can be abused. An attacker who can create security groups in the same VPC (a Virtual Private Cloud, an isolated network inside AWS) can craft one with the same three tags. The controller then treats the attacker's security group as its own, attaches it to the ALB and deletes the genuine one. The attacker needs no permission on the ALB or on the managed security group, and no access to the Kubernetes cluster.
Setup
The issue was reproduced against these versions:
| Component | Version |
|---|---|
| Kubernetes | v1.20.4-eks-6b7464 (major 1, minor 20+) |
| AWS Load Balancer Controller | v2.2.0 |
The full Kubernetes version string reported is:
version.Info{Major:"1", Minor:"20+", GitVersion:"v1.20.4-eks-6b7464", GitCommit:"[redacted]", GitTreeState:"clean", BuildDate:"2021-03-19T19:33:03Z", GoVersion:"go1.15.8", Compiler:"gc", Platform:"linux/amd64"}
This is a block of text that Kubernetes prints when you ask it which version it is. Each field is a label followed by a value: Major and Minor are the version numbers, GitVersion is the exact build, GitCommit is the code revision it was built from, BuildDate is when it was compiled, GoVersion is the programming language toolchain used, and Platform says it runs on 64-bit Linux. You do not need to understand every field; the point is simply to pin down exactly what was tested, so that someone else can repeat the experiment on the same software.
What the attacker needs before starting
The attacker must be able to create security groups in the VPC that hosts the target ALB. The report also describes describing the load balancer and its security group to obtain the needed details.
To build the correct tags, the attacker needs four pieces of information:
- The cluster name: the name of the Kubernetes cluster.
- The namespace: a folder-like grouping inside Kubernetes.
- The name of the Ingress behind the target ALB.
- The id of the managed security group.
The first three are either known in advance or obtained by describing the load balancer and its security group. The managed security group id can also be read the same way, or guessed, as step 2 explains.
Finding it
Here is the flaw in one paragraph. To find its managed security group, the controller asks AWS for security groups carrying the three expected tag values. If more than one security group matches, the controller does not stop and complain. It takes the first one the AWS software library (the SDK, a toolkit for talking to AWS from code) hands back, attaches it to the ALB, and deletes the other matching ones. The AWS API (the web interface AWS exposes for programs to call) returns security groups sorted by their ids.
That sorting is the weakness. Security group ids look like sg- followed by hexadecimal characters (0 to 9 and A to F). If an attacker creates a security group with the expected tags and an id that sorts lower than the real one, the attacker's group comes first. The controller deletes the genuine managed security group and attaches the attacker's group to the ALB. From then on, the attacker writes the firewall rules for that load balancer.
Exploitation
Step 1: a legitimate Ingress of class alb
First, a developer does the normal thing: deploys an application and publishes it through an Ingress of class alb. The report uses the echoserver example files, which are small demo manifests published by the project:
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.9/docs/examples/echoservice/echoserver-namespace.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.9/docs/examples/echoservice/echoserver-service.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.9/docs/examples/echoservice/echoserver-deployment.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.9/docs/examples/echoservice/echoserver-ingress.yaml
Line by line:
kubectlis the command-line tool for talking to Kubernetes.apply -fmeans "read this file and make the cluster match it".- The first line creates a namespace, the folder that will hold the demo.
- The second line creates a service, a stable internal address that other parts of the cluster use to reach the application.
- The third line creates a deployment, which tells Kubernetes to run the application's containers and keep them running.
- The fourth line creates the Ingress, the publishing rule. This is the line that matters for the attack, because it is what makes the controller build the ALB and its managed security group.
Why this step exists: the attack needs a victim. This step produces the ALB and the managed security group that the attacker will later impersonate. The controller tags that security group with the cluster, stack and resource values that identify it, and those tags are exactly what the attacker will copy.
Step 2: craft an evil twin security group
The attacker now creates a security group in the same VPC and gives it the three tags the controller expects. The goal is an id that is numerically lower than the managed security group's id, because the AWS API returns security groups sorted by id and the controller picks the first match.
The script below reads the managed security group id, converts its hexadecimal suffix to a decimal number, then loops creating and deleting security groups until it gets one whose id is lower. If the managed security group id is unknown, the attacker can assume a value as low as sg-00800000000000000 and create a group with an even lower id. The report says this covers more than 96% of the possible security groups with a couple of minutes of brute-forcing (trying many values quickly until one works).
VPC_ID=vpc-00123456789abcdef
CLUSTER_NAME=kind
NAMESPACED_NAME=echoserver/echoserver
MANAGED_SG_ID=sg-00123456789abcdef
MANAGED_SG_10=$(echo ${MANAGED_SG_ID} | awk '{ print "ibase=16;" toupper(substr($0,4)) }' | bc)
while true
do
UNMANAGED_SG_ID=$(aws ec2 create-security-group --description unmanaged-sg --group-name unmanaged-sg --vpc-id ${VPC_ID} | jq -r .GroupId)
UNMANAGED_SG_10=$(echo ${UNMANAGED_SG_ID} | awk '{ print "ibase=16;" toupper(substr($0,4)) }' | bc)
if [ ${UNMANAGED_SG_10} -lt ${MANAGED_SG_10} ]
then
break
fi
aws ec2 delete-security-group --group-id ${UNMANAGED_SG_ID}
done
aws ec2 create-tags --resources ${UNMANAGED_SG_ID} --tags "Key=elbv2.k8s.aws/cluster,Value=${CLUSTER_NAME}" "Key=ingress.k8s.aws/stack,Value=${NAMESPACED_NAME}" "Key=ingress.k8s.aws/resource,Value=ManagedLBSecurityGroup"
Line by line:
VPC_ID=vpc-00123456789abcdefstores the id of the network where the target load balancer lives. The attacker must create the fake security group in the same VPC, because that is where the controller looks.CLUSTER_NAME=kindstores the cluster name. This value will go into the first tag.NAMESPACED_NAME=echoserver/echoserverstores the namespace and Ingress name joined by a slash. This value will go into the second tag.MANAGED_SG_ID=sg-00123456789abcdefstores the id of the real, managed security group that the attacker wants to beat.- The
MANAGED_SG_10=...line turns that id into a decimal number.echoprints the id,awkbuilds a small arithmetic instruction that says "read the following as hexadecimal" (ibase=16) and uppercases the part after thesg-prefix (substr($0,4)skips the first three characters), andbcis a calculator that evaluates it. The result is stored inMANAGED_SG_10. while truestarts a loop that runs until something inside it stops it.- The first line inside the loop creates a new security group with
aws ec2 create-security-group, giving it a description, a name and the VPC id.jq -r .GroupIdpicks the new group's id out of the JSON answer AWS sends back, and stores it inUNMANAGED_SG_ID. - The next line converts that new id to decimal the same way as before, storing it in
UNMANAGED_SG_10. if [ ${UNMANAGED_SG_10} -lt ${MANAGED_SG_10} ]asks: is the new id lower than the managed one? If yes,breakleaves the loop, keeping the new group.- If not,
aws ec2 delete-security-groupthrows the new group away and the loop tries again. This is the brute-forcing: create, compare, delete, repeat, until a low enough id appears. - The final
aws ec2 create-tagsline puts the three tags on the surviving group.elbv2.k8s.aws/clustergets the cluster name,ingress.k8s.aws/stackgets the namespaced name, andingress.k8s.aws/resourcegets the literal valueManagedLBSecurityGroup.
Why this step exists: the controller finds its security group by tags and then picks the first match in id order. The attacker is manufacturing a group that carries the right labels and wins that ordering.
Step 3: trigger reconciliation
With the evil twin in place, the attacker waits for, or causes, the controller to reconcile the target load balancer. Reconciliation is the controller's periodic habit of comparing what it wants with what exists and correcting the difference; it is the moment the controller goes looking for its security group again.
Reconciliation normally happens when:
- The Ingress resource is modified.
- The controller's own Pod (the container it runs in) restarts or is recreated, for example when the machine running it is drained during a downscale.
The report notes that without another exploit or higher privileges on the account, user interaction is required at this point. In plain terms: the attacker cannot force the moment themselves with only the permissions described, so they have to wait for a normal event or persuade someone to cause one.
Step 4: the swap
After reconciliation, the load balancer has the malicious security group attached instead of the managed one the controller created. The attacker then edits the rules in that security group to either gain access to the service or cause a denial of service.
Why this step matters: the swap itself is only the means. The payoff is control of the firewall rules in front of the victim's application.
Root cause
The controller identifies its managed security group purely by tag values, and assumes at most one security group carries them. When several match, it silently picks the first one the AWS SDK returns and deletes the rest. Because the API sorts by id, the selection is effectively "lowest id wins", and an attacker with permission to create security groups can control that property.
From the outside it looks like the controller doing its normal job.
Impact
With the malicious security group attached, the attacker has access to all ports of the targeted ALB. That can expose sensitive data from the service behind the load balancer, or allow calls that cause problems in the service. The attacker can also block legitimate clients from reaching the service, causing a denial of service.
The report rates this as medium severity with a CVSS score of 5.5, weakness resource injection. CVSS is a standard scoring system for the seriousness of a security flaw; 5.5 sits in the middle of the scale.
Fix
The report does not describe a fix. The behaviour it identifies implies the controller should not resolve its managed security group by tag alone when multiple security groups match, and should not delete security groups it did not create. It should treat a duplicate tag match as an error rather than picking the lowest id.
Variants to test
- Other controllers that resolve cloud resources by tags: check whether a duplicate tag match is rejected or silently resolved by ordering. A positive result is a second resource with the same tags being adopted, or the legitimate one being deleted.
- Other tag sets used by the same controller for other resource types: look for the same "first match wins" pattern. A positive result is a resource you created being attached to a victim's load balancer.
- Guessing the managed resource id when it cannot be read: the report's
sg-00800000000000000assumption is a concrete starting point. A positive result is a created resource with a lower id that the controller adopts.
Hunting notes
This class of bug hides wherever a controller or operator maps cloud resources to Kubernetes objects through tags or names, and where the cloud API can return multiple matches. During recon, look for ALBs and other cloud resources whose tags name a cluster, namespace and object, and check whether you can create resources in the same account or VPC with the same tags. The signal is a controller that reconciles by tag lookup without an ownership check. To show impact, demonstrate that the controller attaches your resource and removes the legitimate one, then show what the new rules allow or block; here that meant access to all ports of the ALB and the ability to deny service to legitimate clients.
Glossary
- ALB (Application Load Balancer): an AWS service that receives incoming web traffic and spreads it across the machines running an application.
- API: the interface a program uses to ask another program or service to do something, usually over the network.
- AWS: Amazon Web Services, Amazon's cloud platform.
- AWS SDK: a toolkit of code libraries that lets programs call AWS services without writing the network requests by hand.
- Brute-forcing: trying many possible values quickly, one after another, until one works.
- Cluster: a group of machines managed together by Kubernetes to run applications.
- Controller: software that watches for a desired state and keeps making the real world match it.
- CVSS: a standard scoring system that rates how serious a security flaw is.
- Denial of service: making a service unavailable to the people who should be able to use it.
- Deployment: a Kubernetes object that says which application containers to run and keeps them running.
- Hexadecimal: a way of writing numbers using 0 to 9 and A to F, often used in ids.
- Ingress: a Kubernetes object that publishes an application to the outside world and says where its traffic should go.
- Kubernetes: a system for running and managing software in containers across many machines.
- Managed security group: in this report, the security group the controller creates and considers its own for a given ALB.
- Namespace: a folder-like grouping inside Kubernetes that keeps related objects apart.
- Pod: the smallest unit Kubernetes runs, usually one or more containers sharing a network address.
- Port: a numbered channel on a machine or load balancer that a particular service listens on.
- Reconciliation: the controller's repeated check of desired state against real state, followed by corrections.
- Resource injection: a flaw where an attacker slips a resource they control into a place the system expects only its own resource.
- Security group (SG): a set of firewall rules in AWS that decides which ports are open and which addresses may connect.
- Service (Kubernetes): a stable internal address that other parts of the cluster use to reach an application.
- Tag: a label made of a key and a value attached to a cloud resource, used to identify or organise it.
- VPC (Virtual Private Cloud): an isolated private network inside AWS where resources such as load balancers and security groups live.