# Istio: Ambient mode mTLS bypass via PeerAuthentication bug

Operator-precedence bug in Istio ambient convertPeerAuthentication drops per-port STRICT mTLS when mesh-wide policy is STRICT, letting plaintext reach port 8443.

- Payout: Research
- Severity: high
- Program: Istio
- Found by: ravikanthreddy89
- Disclosed: 2026-12-04
- CVE: CVE-2026-145364
- Write-up quality: 7/10
- Original: https://github.com/advisories/GHSA-rr2c-p22p-6r9r
- Library page: https://bugbountylibrary.com/r/ghsa%3AGHSA-rr2c-p22p-6r9r
- Tags: area:cloud domain:cloud domain:infra impact:internal-access kind:research platform:ghsa sev:high tech:kubernetes technique:source-review vuln:auth-bypass vuln:misconfiguration

**Target:** Istio ambient mode ztunnel authorization policy generation (pilot convertPeerAuthentication)
**Root cause:** Boolean precedence error in convertPeerAuthentication(): `A || (B && C) || D` should be `A || (B && (C || D))`; the mesh-level STRICT check (D) is evaluated without the 'workload-level policy unset' guard (B), so a portLevelMtls STRICT port is wrongly treated as already covered.
**Steps:**
1. Configure ambient mode with mesh-wide PeerAuthentication STRICT in istio-system and no namespace PeerAuthentication.
2. Create workload PeerAuthentication with `mtls.mode: PERMISSIVE` and `portLevelMtls: 8443: mode: STRICT`.
3. Observe ztunnel has no `converted_peer_authentication_workload-port-strict` policy though the workload references it by name.
4. Send plaintext from a non-mesh client: `curl -sv --max-time 5 http://workload:8443/` returns HTTP 200 instead of connection reset.
**How found:** Code review of convertPeerAuthentication() in pilot/pkg/serviceregistry/ambient/authorization.go; noticed the mesh-level check lacked the workload-level-unset guard applied to the namespace-level check, then validated with a differential test (mesh-wide STRICT vs namespace-wide STRICT parent).
**Exploitation:** Any non-mesh/plaintext client reaching the workload port 8443 is accepted by ztunnel despite operator-configured STRICT mTLS, enabling unauthenticated plaintext access to a service intended to be mTLS-only.
**Insight:** When auditing policy-conversion code, compare each parent-scope branch for symmetric guards; a differential test swapping mesh-wide vs namespace-wide parent policy exposes asymmetric short-circuit logic that silently skips policy generation.

## Proof of concept (copied exactly from the original report)

**PeerAuthentication manifest with per-port STRICT**

```
apiVersion: security.istio.io/v1
kind: PeerAuthentication
metadata:
  name: workload-port-strict
spec:
  selector:
    matchLabels:
      app: workload
  mtls:
    mode: PERMISSIVE
  portLevelMtls:
    8443:
      mode: STRICT
```

**Plaintext curl to port 8443**

```
curl -sv --max-time 5 http://workload:8443/
```

