LLM-written tests find 33 new flaws in Keycloak and other login brokers

A University of Toronto tool pairs GPT-5.2 with fixed, rule-based checks to probe seven open-source identity brokers. Maintainers have confirmed 29 of the flaws so far, and 19 have received CVE numbers.

7 min readIIIOpen sourcePreprint, not peer reviewed
Save
This still-life photograph shows cream tickets entering a tiny wooden gatehouse’s brass clip, while one deep blue ticket slips underneath, bypassing check entirely.AI illustration
Illustration: AI generated

What the study shows

An identity broker sits between a company's login provider and the apps behind it. It checks the incoming proof of login, reads who the user is and what they may do, then issues a fresh pass for the downstream app. Keycloak, Vault, Dex and Authentik are common examples. The authors argue that brokers are risky because they play two roles at once: they receive logins like an ordinary app, and they hand out logins like a provider. The login standards were written for software that plays only one of those roles.

The researchers first wrote down five rules a broker must always keep. For example, it must only trust what it actually checked, must reject expired or reused proofs, and must never let two different people end up as the same account. They drew these from 40 'must' clauses in eight login standards, including SAML, OpenID Connect, OAuth and JWT. They then checked them against 60 past security flaws (CVEs, the public catalogue of known vulnerabilities) in 10 broker products. Every one of the 60 broke at least one rule.

Their tool, PORTA, uses a large language model (GPT-5.2) in two places. It reads each broker's API documentation and maps it to a common set of operations. It then writes pairs of tests: a normal login, and an attack aimed at one of the five rules, along with a precise true-or-false check for each test. The tests run against a live broker in an isolated container. Fixed code, not the language model, decides whether a rule was broken.

On known flaws, the tool re-found 10 of 11 selected past CVEs across three runs. On current versions of seven brokers, three runs of under three hours each cost about $70 in API fees. They produced 252 candidate problems after automatic merging. Manual review confirmed 226, a precision of about 88%, and traced them to 33 distinct, previously unreported flaws.

The authors report that maintainers have confirmed 29 of the 33, patched 14 and assigned 19 CVE numbers. At least 10 are rated critical. Examples include Zitadel accepting tokens meant for a different service, Casdoor letting users skip multi-factor login by signing in through a partner provider, and Logto linking accounts on an unverified email address. That last flaw allows an attacker to take over an existing account.

The design choices matter, according to tests that switched parts off. With only a generic 'find security bugs' prompt, the tool found no real flaws. When the language model itself judged the results instead of the fixed checks, precision fell from about 88% to about 8%. Most of its false alarms described attacks that did not exist. The paper appears in the proceedings of ACM CCS 2026 and is also posted on arXiv. Its code and saved tests are public.

Our reading

In our reading, the most useful lesson here is not about identity brokers alone. It is about where to put a language model in a testing pipeline. The model is good at the tedious part: reading unfamiliar API documentation and drafting many plausible attack sequences. It is poor at deciding whether an attack worked. When asked to judge, it invented findings. Handing the verdict to plain, pre-written checks is what made the output trustworthy enough to send to maintainers.

The second lesson is about standards. Of the 33 flaws, 18 were unsafe behaviour that no standard clearly forbids. A typical case: a broker skips a check whenever an optional field is missing, so an attacker simply deletes the field. That habit is harmless for an app that trusts a single, known provider. It becomes dangerous in a broker that may accept logins from providers an attacker controls. The authors found the same patterns in brokers written in four languages by separate teams, which points to a gap in the specifications rather than one careless developer.

For a concrete picture: a company runs one broker in front of its payroll, HR and finance tools. If that broker accepts a token minted for the HR tool as valid for finance, every app is exposed, and none of them can tell. That is the kind of failure this tool was built to catch.

Free membership

Read the rest of this story

Membership is free. You get every article in full, and can save stories and follow topics.

We send a sign-in link, no password needed. Already a member? Sign in

Readiness assessment

III
Open source
LevelStatusEvidence
I  Lab onlyMetWorking tool, tested against seven live open-source brokers in isolated Docker containers.
II  BenchmarkedMetEvaluated against a set of public CVEs (10 of 11 re-found across three runs). Reports precision of about 88% on 252 candidates, plus ablations. The CVE set is public but chosen by the authors, not a standard community benchmark.
III  Open sourceMetThe paper states that source code and evaluation artefacts are released at https://github.com/dlgroupuoft/PORTA, including saved test sequences for replay without LLM access.
IV  In productionNot yetThe vendors patched flaws PORTA found, but the paper documents no named organisation using PORTA itself in production or in its own security testing.

What would move it up
Documented use of PORTA by a named broker vendor or security team, for example in Keycloak's or Zitadel's own continuous testing, would meet level IV.

The study

Zixu Zhou, Xiangyu Guo, Ilya Grishchenko et al.. PORTA: Systematic Discovery of Vulnerabilities in Identity Brokers. arXiv, 24 November 2026. doi:10.1145/3830454.3846557

Preprint, not peer reviewed · Licence CC BY NC ND 4.0 · University of Toronto, Toronto

Notes

  1. Zhou, Guo, Grishchenko and Lie, 'PORTA: Systematic Discovery of Vulnerabilities in Identity Brokers', arXiv preprint 2611.33015, University of Toronto. Source
  2. PORTA source code, evaluation artefacts and saved test sequences for replay without LLM access. Source
  3. Recall on known flaws: 10 of 11 selected CVEs across three runs (90.9%); single runs found 10, 7 and 8; 10 of 18 (55.6%) counting all OIDC and SAML CVEs for the tested platforms. Recall experiment API cost $53.53.
  4. Discovery campaign: 926 raw violations, 252 after deduplication, 226 confirmed and 26 rejected, precision 88.5% ± 6.1%. Mean 500.7 sequences per run, execution rate 72.6%. Total API cost $69.5 for three runs.
  5. Ablations: Blind prompt 0 of 33 findings; no examples 26 of 33 at 75.6% precision; LLM judge 12 of 33 at 8.4% precision (38.2% at its best confidence setting), with 63% of its findings fabricated.
  6. Platforms and versions tested: Keycloak 26.5.6, Casdoor 2.362.0, Dex 2.45.1, Authentik 2026.2.1, Vault 1.21.4 (OIDC only), Zitadel 4.13.0, Logto 1.37.1. Model: gpt-5_2-2025-12-1 as written in the paper.
  7. Readiness: level III, open source available. Code and artefacts are released; no documented use of the tool by a named organisation.

Edited and signed by

Stefan PerdalFounder. Twenty-five years of building digital products.173 stories edited

Stefan read the study, set the readiness level and approved this story. An AI system found the paper and wrote the first draft.

How this was made

An AI model read the study and wrote this article in the structure Science Underway uses. An editor reviewed it and approved it for publication. Check the original study before you rely on the details.

More on Safety & evaluation