Skip to content
Access control Disclosed report Intermediate

Existence of completed pods allows for bypass of Kubernetes NetworkPolicy

The Amazon VPC CNI controller fails to remove firewall rules for Completed pods, so a new pod receiving the same IP address inherits that pod's network access, bypassing NetworkPolicy.

savannabungee Follow

Originally disclosed on HackerOne

Medium 4.3 View original
  • Triaged in 5 days
  • Fixed in 2 months
  • Disclosed after 2 months

Description

The Amazon VPC CNI controller, when configured to manage NetworkPolicy rules, will incorrectly apply firewall rules for Completed pods as if the pods are still running, causing these rules to be applied to other unrelated pods that happen to receive the same IP address as a Completed pod.

For example, if you have a pod A with IP address X. Pod A is allowed some access via NetworkPolicy, which the VPC CNI controller effects by adding firewall rules on nodes for IP address X. When Pod A finished (for example if it's a Job) these firewall rules are not removed. As the pod is finished other pods are free to receive the same IP address. If pod B which is not granted any access by NetworkPolicy is assigned the same IP address X, then pod B will inherit the network access pod A had, until the Completed pod A is deleted.

The correct behavior would be to check for pod completion and treat pod completion the same as pod deletion, removing firewall rules when a pod is finished.

Affected versions

I tested this on EKS version 1.33:

  • With auto mode with the network policy controller enabled
  • Without auto mode, with VPC CNI add-on v1.19.5-eksbuild.1
  • Without auto mode, with VPC CNI add-on v1.20.1-eksbuild.3

Strict mode does not have any effect.

POC

On an EKS cluster with auto mode enabled, or the VPC CNI controller with enableNetworkPolicy set to true, apply the following preparatory Kubernetes resources:

---
apiVersion: v1
kind: Namespace
metadata:
  name: networkpolicy-test
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: whoami
  namespace: networkpolicy-test
spec:
  replicas: 1
  selector:
    matchLabels:
      app: whoami
  template:
    metadata:
      labels:
        app: whoami
    spec:
      containers:
        - name: whoami
          image: traefik/whoami:latest
          ports:
            - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: whoami
spec:
  ports:
    - port: 80
      targetPort: 80
      protocol: TCP
  selector:
    app: whoami
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: ingress
  namespace: networkpolicy-test
spec:
  podSelector: {}
  policyTypes:
  - Ingress
  ingress:
  - from:
    - podSelector:
        matchLabels:
          test: allowed
    ports:
    - protocol: TCP
      port: 80

This NetworkPolicy configuration will allow the following Job to connect to the Deployment

---
apiVersion: batch/v1
kind: Job
metadata:
  name: allowed
  namespace: networkpolicy-test
spec:
  template:
    metadata:
      name: curl
      labels:
        test: allowed
    spec:
      containers:
        - name: curl
          image: "alpine/curl:latest"
          command: ["curl", "-v", "whoami.networkpolicy-test.svc.cluster.local:80"]
      restartPolicy: Never

but the following Job will be blocked and time out:

---
apiVersion: batch/v1
kind: Job
metadata:
  name: blocked
  namespace: networkpolicy-test
spec:
  template:
    metadata:
      name: curl
      labels:
        test: blocked
    spec:
      containers:
        - name: curl
          image: "alpine/curl:latest"
          command: ["curl", "-v", "whoami.networkpolicy-test.svc.cluster.local:80"]
      restartPolicy: Never

However if there is an allowed job in Completed state, the blocked pod has a chance of receiving the same IP address as the completed allowed pod, when that happens the blocked pod will, in violation of the NetworkPolicy, be able to access the Deployment.

To make it easy to reproduce I would suggest applying the attached █████████ file to create 20 allowed Jobs. Wait for all 20 Jobs to finish, then apply the attached ██████████to create 20 blocked Jobs. Almost certainly some of the blocked pods will be given IP addresses matching those of completed allowed pods, and will therefore be able to connect to the Deployment and exit successfully. Some of the blocked pods will be given different IP addresses and as a result will correctly not be able to connect to the Deployment, hang and then error.

Impact

Summary: On an EKS cluster relying on Kubernetes NetworkPolicy rules to restrict network access, having Completed pods that were allowed some access will result in other pods being given the same access.

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

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 6 min read.

Bypassing Kubernetes NetworkPolicy with Completed Pods

Context

The target is the Amazon VPC CNI controller, which can manage Kubernetes NetworkPolicy rules. When it is configured to manage Kubernetes NetworkPolicy rules, it enforces those policies by installing firewall rules on the nodes for the IP addresses of the pods the policy applies to.

The behaviour under examination is what happens to those firewall rules when a pod finishes. The report shows that the controller keeps the rules in place for Completed pods as if they were still running, and that this leaks the pod's granted access to any later pod that receives the same IP address.

The affected asset is the open source repository https://github.com/aws/amazon-vpc-cni-k8s. The issue was reported through the AWS VDP on HackerOne by savannabungee, rated medium severity with a CVSS score of 4.3, classified as Improper Access Control (Generic), and disclosed on 19 November 2025. No bounty is recorded.

Setup

The researcher tested on EKS version 1.33 in three configurations:

  1. Auto mode with the network policy controller enabled.
  2. Without auto mode, with the VPC CNI add-on v1.19.5-eksbuild.1.
  3. Without auto mode, with the VPC CNI add-on v1.20.1-eksbuild.3.

Strict mode does not have any effect on the issue.

To reproduce, you need an EKS cluster with auto mode enabled, or the VPC CNI controller with enableNetworkPolicy set to true. The proof of concept uses a namespace called networkpolicy-test, a traefik/whoami:latest Deployment, and two kinds of Job built on alpine/curl:latest.

Finding it

The reasoning starts from a simple observation about pod lifecycles. A pod that has finished, for example a Job that has run to completion, is no longer running, but its IP address is released and can be handed to another pod. The VPC CNI controller, however, does not treat pod completion the same way as pod deletion: the firewall rules it installed for the Completed pod's IP address are not removed.

That mismatch looked wrong because the firewall rules are keyed on IP address, not on pod identity. If pod A with IP address X was allowed some access by a NetworkPolicy, the controller adds firewall rules on the nodes for IP address X. When pod A finishes, those rules stay. If pod B, which is not granted any access by the NetworkPolicy, is later assigned the same IP address X, pod B inherits the network access that pod A had, and keeps it until the Completed pod A is deleted.

The correct behaviour, as the report puts it, would be to check for pod completion and treat it the same as pod deletion, removing firewall rules when a pod is finished.

Exploitation

Step 1: Create the namespace, workload, Service and NetworkPolicy

Apply the following preparatory Kubernetes resources:

YAML
---
apiVersion: v1
kind: Namespace
metadata:
  name: networkpolicy-test
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: whoami
  namespace: networkpolicy-test
spec:
  replicas: 1
  selector:
    matchLabels:
      app: whoami
  template:
    metadata:
      labels:
        app: whoami
    spec:
      containers:
        - name: whoami
          image: traefik/whoami:latest
          ports:
            - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: whoami
spec:
  ports:
    - port: 80
      targetPort: 80
      protocol: TCP
  selector:
    app: whoami
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: ingress
  namespace: networkpolicy-test
spec:
  podSelector: {}
  policyTypes:
  - Ingress
  ingress:
  - from:
    - podSelector:
        matchLabels:
          test: allowed
    ports:
    - protocol: TCP
      port: 80

This creates the namespace, a single-replica whoami Deployment listening on port 80, a Service in front of it, and an ingress NetworkPolicy. The policy selects all pods in the namespace (podSelector: {}) and allows ingress on TCP port 80 only from pods labelled test: allowed. Any other pod in the namespace is denied access to the Deployment.

Step 2: Confirm that an allowed Job can connect

The following Job is permitted by the NetworkPolicy:

YAML
---
apiVersion: batch/v1
kind: Job
metadata:
  name: allowed
  namespace: networkpolicy-test
spec:
  template:
    metadata:
      name: curl
      labels:
        test: allowed
    spec:
      containers:
        - name: curl
          image: "alpine/curl:latest"
          command: ["curl", "-v", "whoami.networkpolicy-test.svc.[redacted]:80"]
      restartPolicy: Never

The pod template carries the label test: allowed, so the NetworkPolicy admits it. It runs curl -v against the Service DNS name on port 80 and, as expected, connects.

Step 3: Confirm that a blocked Job cannot connect

The following Job is not permitted by the NetworkPolicy:

YAML
---
apiVersion: batch/v1
kind: Job
metadata:
  name: blocked
  namespace: networkpolicy-test
spec:
  template:
    metadata:
      name: curl
      labels:
        test: blocked
    spec:
      containers:
        - name: curl
          image: "alpine/curl:latest"
          command: ["curl", "-v", "whoami.networkpolicy-test.svc.[redacted]:80"]
      restartPolicy: Never

This pod template carries the label test: blocked, which the policy does not match. The connection is blocked and the request times out, as it should.

Step 4: Reuse the IP address of a Completed allowed pod

The bypass depends on a blocked pod being assigned the same IP address as a Completed allowed pod. If an allowed Job is in Completed state, a blocked pod has a chance of receiving the same IP address as the completed allowed pod. When that happens, the blocked pod can reach the Deployment in violation of the NetworkPolicy.

To make reproduction reliable, the researcher suggests applying an attached file to create 20 allowed Jobs, waiting for all 20 to finish, then applying a second attached file to create 20 blocked Jobs. Almost certainly some of the blocked pods will be given IP addresses matching those of completed allowed pods, and will therefore connect to the Deployment and exit successfully. The remaining blocked pods receive different IP addresses, correctly fail to connect, hang and then error.

Root cause

The controller enforces NetworkPolicy by installing firewall rules on nodes keyed to pod IP addresses. The report says pod completion should be treated the same as pod deletion. When a pod completes, the controller does not perform the same cleanup, so the rules for the Completed pod's IP address remain in place.

Because IP addresses are recycled, the stale rules then apply to whatever pod is assigned that address next. The report frames the fix as treating pod completion the same as pod deletion.

Impact

On an EKS cluster that relies on Kubernetes NetworkPolicy rules to restrict network access, having Completed pods that were allowed some access results in other pods being given the same access. A pod that the policy intends to block can reach a workload it should not reach, for as long as the Completed pod holding the matching IP address exists. The exposure applies to pods that happen to be assigned the recycled address.

Fix

The report states the correct behaviour: check for pod completion and treat it the same as pod deletion, removing firewall rules when a pod is finished. It does not describe a patch that was applied.

Variants to test

  1. Other CNIs that enforce policy by IP. Check whether a CNI removes its per-IP rules on pod completion as well as on deletion. A positive result is a blocked pod that reaches a protected workload after being assigned the IP of a Completed allowed pod.
  2. Other recycled identifiers. Look for any enforcement layer that keys access on an identifier that outlives the object, such as an IP, a node port or a NAT address. A positive result is a new object inheriting the old object's permissions.
  3. Long-lived Completed pods. Where Jobs or other workloads are retained after completion, test whether the stale rules persist for the whole retention period. A positive result is the bypass still working long after the workload finished.
  4. Scale the race. Create many allowed Jobs, wait for completion, then create many blocked Jobs, as in the report. A positive result is a subset of blocked pods succeeding where the policy says they should fail.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 10 min read.

What happened, in plain words

Imagine an office building where each visitor is given a temporary desk number. The security guard keeps a list that says "desk 12 is allowed into the server room". When the visitor at desk 12 leaves, the guard forgets to cross that line off the list. The next person who happens to be given desk 12 walks straight into the server room, even though they were never approved.

That is essentially the bug described here, but for cloud computers. Amazon EKS is a service for running containers (small packaged programs) on Amazon's servers. Each container, called a pod, gets its own private network address, an IP address. A component called the VPC CNI controller can enforce the rules that say which pods may talk to which other pods. Those rules are called NetworkPolicy.

The researcher found that when a pod finishes its work (for example a one-off task that runs and exits), the controller does not clean up the firewall rules it created for that pod's IP address. The address is then free to be given to a different pod, which inherits the finished pod's permissions. The report was filed through the AWS Vulnerability Disclosure Program on HackerOne by savannabungee, rated medium severity with a CVSS score of 4.3, classified as Improper Access Control (Generic), and disclosed on 19 November 2025. No bounty is recorded.

The pieces involved

Before the steps make sense, here are the main building blocks, explained from scratch.

  • Kubernetes is software for running and managing many containers across many machines. You describe what you want in text files, and Kubernetes makes it happen.
  • A pod is the smallest unit Kubernetes runs: one or more containers sharing a network address. Think of it as a single temporary worker with its own desk number.
  • A namespace is a labelled section inside a cluster, like a folder, so different teams or tests do not collide.
  • A Deployment keeps a chosen number of identical pods running. If one dies, the Deployment starts a replacement.
  • A Service gives a stable name and address in front of a set of pods, so other pods can reach them without knowing individual IP addresses.
  • A Job is a pod that runs once and then stops, for example a script that makes one web request. When it finishes, it is in Completed state.
  • A NetworkPolicy is a rule that says which pods may connect to which. It is enforced by the network plugin, here the VPC CNI controller.
  • A firewall rule is a low-level allow or block instruction on a machine, usually matched against IP addresses.
  • A label is a key-value tag attached to a pod, such as test: allowed, used to select pods in rules.
  • A YAML file is a plain-text format for describing Kubernetes resources. You apply it with a command, and Kubernetes creates what it describes.
  • curl is a command-line tool that fetches a web page or URL. Here it is used to test whether a connection succeeds.
  • A race condition is when the outcome depends on timing, for example which pod happens to get a particular IP address first.

The target and the affected versions

The affected asset is the open source repository https://github.com/aws/amazon-vpc-cni-k8s. The researcher tested on EKS version 1.33 in three configurations:

  1. Auto mode with the network policy controller enabled.
  2. Without auto mode, with the VPC CNI add-on v1.19.5-eksbuild.1.
  3. Without auto mode, with the VPC CNI add-on v1.20.1-eksbuild.3.

Strict mode does not have any effect on the issue. To reproduce, you need an EKS cluster with auto mode enabled, or the VPC CNI controller with enableNetworkPolicy set to true.

Finding it

The reasoning starts from how pods come and go. A pod that has finished, such as a Job that ran to completion, is no longer running, but its IP address is released and can be handed to another pod. The VPC CNI controller, however, does not treat pod completion the same way as pod deletion: the firewall rules it installed for the Completed pod's IP address are not removed.

That mismatch looked wrong because the firewall rules are keyed on IP address, not on pod identity. If pod A with IP address X was allowed some access by a NetworkPolicy, the controller adds firewall rules on the nodes for IP address X. When pod A finishes, those rules stay. If pod B, which is not granted any access by the NetworkPolicy, is later assigned the same IP address X, pod B inherits the network access that pod A had, and keeps it until the Completed pod A is deleted.

The correct behaviour, as the report puts it, would be to check for pod completion and treat it the same as pod deletion, removing firewall rules when a pod is finished.

Reproducing it, step by step

Step 1: Create the namespace, workload, Service and NetworkPolicy

First you set up a small test area: a namespace, a web server pod, a Service in front of it, and a rule that only lets certain pods reach it. Apply the following preparatory Kubernetes resources:

YAML
---
apiVersion: v1
kind: Namespace
metadata:
  name: networkpolicy-test
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: whoami
  namespace: networkpolicy-test
spec:
  replicas: 1
  selector:
    matchLabels:
      app: whoami
  template:
    metadata:
      labels:
        app: whoami
    spec:
      containers:
        - name: whoami
          image: traefik/whoami:latest
          ports:
            - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: whoami
spec:
  ports:
    - port: 80
      targetPort: 80
      protocol: TCP
  selector:
    app: whoami
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: ingress
  namespace: networkpolicy-test
spec:
  podSelector: {}
  policyTypes:
  - Ingress
  ingress:
  - from:
    - podSelector:
        matchLabels:
          test: allowed
    ports:
    - protocol: TCP
      port: 80

Line by line, in plain words:

  • The first block creates a Namespace called networkpolicy-test, a separate folder for the test.
  • The second block creates a Deployment named whoami with one replica. It runs the container image traefik/whoami:latest, a tiny web server that answers on port 80. The pods it creates carry the label app: whoami.
  • The third block creates a Service named whoami. It listens on port 80 and forwards to port 80 on any pod labelled app: whoami. This gives the test a stable name to call.
  • The fourth block creates a NetworkPolicy named ingress. podSelector: {} means it applies to every pod in the namespace. policyTypes: - Ingress means it controls incoming connections. The ingress section allows TCP port 80 only from pods labelled test: allowed. Any other pod in the namespace is denied access to the Deployment.

Why this step: you need a protected target and a rule that clearly separates allowed pods from blocked ones, so the bypass is visible.

Step 2: Confirm that an allowed Job can connect

The following Job is permitted by the NetworkPolicy:

YAML
---
apiVersion: batch/v1
kind: Job
metadata:
  name: allowed
  namespace: networkpolicy-test
spec:
  template:
    metadata:
      name: curl
      labels:
        test: allowed
    spec:
      containers:
        - name: curl
          image: "alpine/curl:latest"
          command: ["curl", "-v", "whoami.networkpolicy-test.svc.[redacted]:80"]
      restartPolicy: Never

Line by line:

  • This creates a Job named allowed in the test namespace.
  • The pod template carries the label test: allowed, which is exactly what the NetworkPolicy looks for.
  • The container uses the image alpine/curl:latest and runs curl -v against whoami.networkpolicy-test.svc.[redacted]:80, the Service's internal DNS name. The -v flag makes curl print details about the connection.
  • restartPolicy: Never means the pod does not restart after it finishes; it simply completes.

Why this step: it proves the rule works as intended for a pod that should be allowed. The connection succeeds.

Step 3: Confirm that a blocked Job cannot connect

The following Job is not permitted by the NetworkPolicy:

YAML
---
apiVersion: batch/v1
kind: Job
metadata:
  name: blocked
  namespace: networkpolicy-test
spec:
  template:
    metadata:
      name: curl
      labels:
        test: blocked
    spec:
      containers:
        - name: curl
          image: "alpine/curl:latest"
          command: ["curl", "-v", "whoami.networkpolicy-test.svc.[redacted]:80"]
      restartPolicy: Never

Line by line:

  • This creates a Job named blocked.
  • Its pod template carries the label test: blocked, which the NetworkPolicy does not match.
  • It runs the same curl -v command against the same Service name.
  • restartPolicy: Never again means it runs once and stops.

Why this step: it proves the rule also works for a pod that should be denied. The connection is blocked and the request times out, as it should.

Step 4: Reuse the IP address of a Completed allowed pod

The bypass depends on a blocked pod being assigned the same IP address as a Completed allowed pod. If an allowed Job is in Completed state, a blocked pod has a chance of receiving the same IP address as the completed allowed pod. When that happens, the blocked pod can reach the Deployment in violation of the NetworkPolicy.

To make reproduction reliable, the researcher suggests applying an attached file to create 20 allowed Jobs, waiting for all 20 to finish, then applying a second attached file to create 20 blocked Jobs. Almost certainly some of the blocked pods will be given IP addresses matching those of completed allowed pods, and will therefore connect to the Deployment and exit successfully. The remaining blocked pods receive different IP addresses, correctly fail to connect, hang and then error.

Why this step: one blocked pod might not happen to get a recycled address, so creating many on each side makes the collision very likely and the result easy to see.

Root cause

The controller enforces NetworkPolicy by installing firewall rules on nodes keyed to pod IP addresses. The report says pod completion should be treated the same as pod deletion. When a pod completes, the controller does not perform the same cleanup, so the rules for the Completed pod's IP address remain in place.

Because IP addresses are recycled, the stale rules then apply to whatever pod is assigned that address next. The report frames the fix as treating pod completion the same as pod deletion.

Impact

On an EKS cluster that relies on Kubernetes NetworkPolicy rules to restrict network access, having Completed pods that were allowed some access results in other pods being given the same access. A pod that the policy intends to block can reach a workload it should not reach, for as long as the Completed pod holding the matching IP address exists. The exposure applies to pods that happen to be assigned the recycled address.

Fix

The report states the correct behaviour: check for pod completion and treat it the same as pod deletion, removing firewall rules when a pod is finished. It does not describe a patch that was applied.

Variants to test

  1. Other CNIs that enforce policy by IP. A CNI is the network plugin that wires pods together. Check whether a CNI removes its per-IP rules on pod completion as well as on deletion. A positive result is a blocked pod that reaches a protected workload after being assigned the IP of a Completed allowed pod.
  2. Other recycled identifiers. Look for any enforcement layer that keys access on an identifier that outlives the object, such as an IP, a node port or a NAT address. A positive result is a new object inheriting the old object's permissions.
  3. Long-lived Completed pods. Where Jobs or other workloads are retained after completion, test whether the stale rules persist for the whole retention period. A positive result is the bypass still working long after the workload finished.
  4. Scale the race. Create many allowed Jobs, wait for completion, then create many blocked Jobs, as in the report. A positive result is a subset of blocked pods succeeding where the policy says they should fail.

Glossary

  • Pod: the smallest unit Kubernetes runs, one or more containers sharing a network address.
  • Kubernetes: software for running and managing containers across many machines from text descriptions.
  • Amazon EKS: Amazon's managed Kubernetes service.
  • VPC CNI controller: the component that gives pods their VPC IP addresses and can enforce NetworkPolicy.
  • IP address: a numeric address that identifies a device or pod on a network.
  • NetworkPolicy: a Kubernetes rule that says which pods may connect to which.
  • Firewall rule: a low-level allow or block instruction, usually matched on IP address.
  • Namespace: a labelled section inside a cluster, like a folder.
  • Deployment: a Kubernetes object that keeps a chosen number of identical pods running.
  • Service: a stable name and address in front of a set of pods.
  • Job: a pod that runs once and then stops, ending in Completed state.
  • Completed state: the status of a pod that has finished its work and is no longer running.
  • Label: a key-value tag on a pod, used to select pods in rules.
  • YAML: a plain-text format for describing Kubernetes resources.
  • curl: a command-line tool that fetches a URL, used here to test connections.
  • DNS name: a human-readable name that resolves to a network address.
  • Race condition: when the outcome depends on timing, such as which pod gets a particular IP address first.
  • CNI: the network plugin that connects pods and can enforce network rules.
  • CVSS: a standard score for how severe a vulnerability is.
  • Improper Access Control: a class of bug where something is allowed to do what it should not be allowed to do.
  • Vulnerability Disclosure Program (VDP): a programme for reporting security issues to an organisation.
  • HackerOne: a platform where security reports are submitted and tracked.
  • Bounty: a reward paid for a valid security report.

More from AWS VDP

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.