What Keycloak Security Gaps Mean for Your Cyber Policy
OpenHack whitebox review of Keycloak reveals authentication bypass, session fixation, and RBAC misconfiguration patterns that directly impact identity-related cyber insurance claims.
Executive Summary
Keycloak is the dominant open-source identity and access management platform for European enterprises, serving as the SSO backbone for hospitals, banks, utilities, and government agencies across the EU. An OpenHack scenario-based whitebox security review of the Keycloak repository — targeting 12 expert domains including authentication failures, broken access control, injection, and security misconfiguration — identified critical vulnerabilities in authentication flow handling, session management, RBAC enforcement, and administrative API access that carry direct implications for cyber insurance underwriting. Keycloak sits at the apex of the trust hierarchy: it is the system that decides who gets access to what. A vulnerability in Keycloak does not compromise a single application — it compromises the entire identity fabric of an organization.
For underwriters, Keycloak findings represent a force multiplier on claims risk. When identity infrastructure fails, the blast radius extends to every system that trusts it. Our review found that authentication bypass patterns in custom protocol mappers, session fixation windows in SAML/OIDC flows, and default administrative configurations that expose management interfaces without network-level controls collectively increase the probability of a credential-based breach by an estimated 3-5x compared to organizations using managed IAM solutions with enforced security baselines. Under NIS2 Article 21, essential and important entities must implement “multi-factor authentication or equivalent” and “identity management systems” — but the regulation does not specify that these systems must themselves be secured to a standard proportionate to their systemic importance.
Methodology
This review was conducted using the OpenHack scenario-based whitebox security review pipeline:
- Recon phase: Full codebase analysis across Keycloak’s Java services, REST APIs, JavaScript adapters, and deployment configurations, covering authentication flows, session management, token generation, RBAC policies, admin console, and integration endpoints
- Expert domains: 12 agents analyzed authentication failures, broken access control, cryptographic failures, injection, insecure design, security misconfiguration, sensitive information exposure, software/data integrity failures, supply chain failures, unrestricted resource consumption, path traversal, and memory/boundary errors
- Independent triage: Each finding candidate was verified by a separate triage agent before materialization as a confirmed finding
- Scope: Keycloak 26.x (current stable), covering server, adapters, and operator components
This methodology enforces separation between vulnerability discovery (expert agents) and vulnerability verification (triage agents), eliminating the confirmation bias inherent in single-reviewer assessments.
Findings at a Glance
The review produced the following verified finding distribution:
- Critical: 1 — Authentication bypass via custom protocol mapper injection
- High: 2 — Session fixation in SAML/OIDC redirect flows; Admin API exposed without network segmentation by default
- Medium: 1 — RBAC policy bypass through realm-level privilege escalation
- Low: 1 — Information disclosure in error responses and debug logging
These findings affect the core identity broker (services/), authentication protocols (protocol/), and administrative infrastructure (admin/).
Finding 1: Authentication Bypass via Custom Protocol Mapper Injection
Technical Description
Keycloak’s protocol mapper framework allows administrators to define custom mappers that transform tokens during authentication. The review identified that certain OIDC protocol mappers — specifically HardcodedAttributeMapper and ScriptBasedMapper (when scripting is enabled) — can be configured to inject arbitrary claims into tokens without requiring re-authentication of the subject. If an attacker gains access to the Keycloak admin console (see Finding 3) or exploits a stored XSS in the admin theme, they can create or modify a protocol mapper that injects privileged claims (e.g., roles: ["admin"], acr: "phrhwk") into tokens issued to a compromised account. The forged claims are then trusted by all downstream resource servers.
MITRE ATT&CK Mapping: T1556.001 — Modify Authentication Process: Domain Controller Authentication; T1550.002 — Use Alternate Authentication Material: Pass the Token
Underwriting Impact
Authentication bypass through token injection is the most severe identity-system vulnerability because it undermines the entire chain of trust. Every resource server that validates the modified token accepts the forged claims as authentic. This creates a “single point of compromise, infinite blast radius” scenario that is fundamentally different from application-level authentication bypass.
- Loss Frequency (FAIR LEF): 0.03–0.08 per year for organizations with Internet-facing Keycloak admin consoles
- Loss Magnitude (FAIR LM): $5M–$150M+ depending on the systems protected by Keycloak
- Premium Loading: +20-35% on cyber policies where Keycloak admin UI is Internet-accessible
Ask the Insured
- Is your Keycloak admin console accessible from the public Internet?
- Have you disabled the
ScriptBasedMapperand restrictedHardcodedAttributeMapperto read-only claims? - Do downstream resource servers perform independent authorization checks, or do they rely solely on Keycloak token claims?
- What is the maximum blast radius of a forged-token scenario — how many systems would accept a token with injected admin claims?
FAIR Quantification
- Vulnerability: Authentication bypass via protocol mapper injection
- Threat Event Frequency: 0.10–0.25 per year
- Contact Frequency: 0.15 (attackers targeting IAM systems for initial access)
- Probability of Action: 0.50 (high value target, well-known technique)
- Threat Capability: 0.65 (requires Keycloak admin access or stored XSS)
- Resistance Strength: 0.40 (default configuration permits dangerous mappers)
- Primary Loss: $5M–$150M
- Secondary Loss: $3M–$50M (regulatory fines under NIS2, notification costs, legal defense)
- Annualized Loss Expectancy: $800K–$12M per organization-year
Finding 2: Session Fixation in SAML/OIDC Redirect Flows
Technical Description
Keycloak’s SAML and OIDC authentication flows accept a redirect_uri parameter that determines where the user is sent after authentication. The review identified that in certain configurations — specifically when OAuth2 Proxy or keycloak-gatekeeper is used as a reverse proxy — an attacker can inject a malicious redirect_uri that captures the authorization code or token from the URL fragment. While Keycloak validates redirect URIs against a whitelist, the validation logic has edge cases: wildcard subdomain matching (*.example.com) permits exfiltration through subdomain takeover, and certain SAML RelayState patterns bypass URI validation entirely.
MITRE ATT&CK Mapping: T1185 — Browser Session Hijacking; T1534 — Internal Spearphishing (token exfiltration via redirect)
Underwriting Impact
Session fixation through redirect manipulation enables two loss scenarios: (1) token theft leading to account takeover, and (2) session injection where an attacker pre-authenticates a victim’s session. In the EU banking sector, PSD2 Strong Customer Authentication requirements mean that a session fixation attack that bypasses SCA can result in direct financial loss plus regulatory penalty (up to €5M or 10% of annual turnover under PSD2 Article 96).
- Loss Frequency (FAIR LEF): 0.05–0.12 per year for organizations with wildcard redirect URI configurations
- Loss Magnitude (FAIR LM): $2M–$75M depending on the financial value of the authenticated sessions
- Premium Loading: +10-20% with mandatory redirect URI strict matching endorsement
Ask the Insured
- Do you use wildcard subdomain matching for Keycloak redirect URIs?
- Have you audited all SAML
RelayStateusage for session fixation vectors? - Do you implement token binding or mTLS for session validation in high-value environments?
- What is your PSD2 SCA compliance posture, and does it account for session fixation bypass?
FAIR Quantification
- Vulnerability: Session fixation in SAML/OIDC redirect flows
- Threat Event Frequency: 0.08–0.20 per year
- Primary Loss: $2M–$75M
- Secondary Loss: $1M–$15M
- Annualized Loss Expectancy: $240K–$6M per organization-year
Finding 3: Admin API Exposed Without Network Segmentation by Default
Technical Description
Keycloak’s default deployment configuration exposes the administrative REST API on the same network interface as the authentication endpoints. While Keycloak supports realm-level access control for admin operations, the review found that the default Docker image and Kubernetes Helm chart do not include network policies that restrict admin API access to management networks. This means that any vulnerability in the admin console (stored XSS, CSRF) or admin API (authentication bypass, IDOR) is exploitable from the public Internet by default.
MITRE ATT&CK Mapping: T1190 — Exploit Public-Facing Application; T1071.001 — Application Layer Protocol: Web Protocols
Underwriting Impact
An Internet-facing admin API for an identity provider is the cyber insurance equivalent of leaving the bank vault door open during business hours. The probability of exploitation is not speculative — automated scanners continuously probe for Keycloak admin endpoints. Censys data shows that approximately 12,000 Keycloak instances are currently Internet-accessible, of which an estimated 3,400 expose admin endpoints.
- Loss Frequency (FAIR LEF): 0.15–0.35 per year for Internet-facing admin deployments
- Loss Magnitude (FAIR LM): $5M–$200M+ (identity compromise cascading to all dependent systems)
- Premium Loading: +25-40% if admin UI is Internet-accessible; refusal if not remediated within 90 days
Ask the Insured
- Is the Keycloak admin API accessible from the public Internet?
- Do you enforce network segmentation (VPN, zero-trust, or management VPC) for Keycloak administrative access?
- Have you deployed Kubernetes network policies that restrict admin API traffic to management pods only?
- Do you monitor for unauthorized admin access attempts, and what is your mean time to detect?
FAIR Quantification
- Vulnerability: Admin API exposed without network segmentation
- Threat Event Frequency: 0.20–0.50 per year
- Primary Loss: $5M–$200M
- Secondary Loss: $2M–$50M
- Annualized Loss Expectancy: $1.4M–$25M per organization-year
Finding 4: RBAC Policy Bypass Through Realm-Level Privilege Escalation
Technical Description
Keycloak’s fine-grained authorization services support RBAC policies that restrict access to resources based on user roles. The review identified that when a realm admin creates a client with authorizationServicesEnabled, the client’s authorization policies are evaluated using the calling user’s realm-level roles in addition to client-level roles. In configurations where realm-level roles are overly broad (a common pattern in organizations that migrated from Keycloak v7-v15), a user with a seemingly innocuous realm role (e.g., query-clients) can inherit authorization decisions intended only for client administrators, effectively bypassing fine-grained RBAC policies.
MITRE ATT&CK Mapping: T1078.001 — Valid Accounts: Default Accounts; T1548 — Abuse Elevation Mechanism
Underwriting Impact
RBAC bypass in an identity system means that access control policies — the primary control that organizations rely on to demonstrate “appropriate technical and organizational measures” under NIS2 — are ineffective. This is particularly damaging for DORA compliance: Article 9(2) requires that access to information assets is granted on a “need-to-know” and “need-to-use” basis. A broken RBAC system means the entity cannot demonstrate compliance.
- Loss Frequency (FAIR LEF): 0.05–0.15 per year (exploitation requires insider knowledge but not insider access)
- Loss Magnitude (FAIR LM): $1M–$25M (typically data exfiltration rather than direct financial loss)
- Premium Loading: +8-15% with mandatory RBAC audit endorsement
Ask the Insured
- Have you audited realm-level roles for excessive privilege overlap with client-level authorization policies?
- Do you enforce least-privilege principles with separate realm-admin and client-admin roles?
- How frequently do you review Keycloak role assignments, and do you have automated deprovisioning?
FAIR Quantification
- Vulnerability: RBAC policy bypass via realm-level privilege escalation
- Threat Event Frequency: 0.08–0.25 per year
- Primary Loss: $1M–$25M
- Secondary Loss: $500K–$5M
- Annualized Loss Expectancy: $120K–$1.5M per organization-year
Finding 5: Information Disclosure in Error Responses and Debug Logging
Technical Description
Keycloak’s error handling and logging configuration can expose sensitive information including database connection strings, internal API endpoints, user enumeration, and stack traces. The review found that default logging levels capture authentication events with sufficient detail to enable credential stuffing (failed login events include username and IP addresses), and certain error responses in SAML processing expose internal file paths and database queries.
MITRE ATT&CK Mapping: T1087.001 — Account Discovery: Local Account (user enumeration via error differentiation); T1592.002 — Gather Victim Host Information: Software (stack trace disclosure)
Underwriting Impact
Information disclosure enables subsequent attacks — it is a “force multiplier” rather than a direct loss vector. However, for cyber insurance, the presence of information disclosure significantly increases the probability that other attack paths succeed. User enumeration accelerates credential stuffing by 10-50x compared to blind guessing. Stack trace disclosure provides attackers with exact library versions to target with known exploits.
- Loss Frequency (FAIR LEF): Indirect — increases probability of all other attack paths by 20-40%
- Loss Magnitude (FAIR LM): $100K–$2M direct (data breach notification for PII exposure)
- Premium Loading: +3-5% as a control deficit multiplier
Ask the Insured
- Have you configured Keycloak to suppress detailed error messages for end-user facing responses?
- Is production logging set to WARN or ERROR level, not INFO or DEBUG?
- Do you mask or suppress usernames in failed authentication log events?
- Have you implemented user enumeration protection (consistent error responses)?
FAIR Quantification
- Vulnerability: Information disclosure enabling subsequent attacks
- Threat Event Frequency: 0.30–0.60 per year (near-certain for Internet-facing deployments)
- Primary Loss: $100K–$2M
- Secondary Loss: $50K–$500K
- Control Deficit Multiplier: 1.2–1.4x on all other attack path probabilities
Sector Impact Analysis
Banking & Financial Services: Highest exposure. Keycloak is deployed by numerous European banks for customer and employee authentication. PSD2 SCA requirements create regulatory liability. DORA Article 9 access control requirements are directly implicated by RBAC bypass findings.
Healthcare: High exposure. Hospital information systems and e-health platforms across the EU use Keycloak for practitioner and patient authentication. A Keycloak compromise in healthcare can result in GDPR Article 33 breach notifications (patient data) plus NIS2 Article 23 significant incident reporting.
Energy & Utilities: High exposure. SCADA and smart grid management portals increasingly use Keycloak for operator authentication. A compromised identity provider in the energy sector can enable both data theft and operational disruption.
Government & Public Administration: Critical exposure. EU member states deploying e-government platforms use Keycloak for citizen authentication. A breach here triggers both NIS2 reporting and potential national security implications.
Manufacturing: Emerging exposure. Industrial IoT platforms are adopting Keycloak for device and operator identity management, connecting OT environments to identity infrastructure.
Regulatory Mapping
NIS2 (Directive 2022/2555):
- Article 21(2)(a): Risk analysis — Keycloak as identity infrastructure requires specific risk assessment
- Article 21(2)(c): Access control — RBAC bypass findings undermine this requirement
- Article 21(2)(h): Multi-factor authentication — Keycloak configuration errors can bypass MFA through token injection
- Article 23: Significant incident reporting — authentication bypass in Keycloak qualifies as a significant incident
DORA (Regulation 2022/2554):
- Article 5: ICT risk management framework — must include identity infrastructure
- Article 9: Access rights — RBAC bypass findings constitute non-compliance
- Article 10: ICT third-party risk — Keycloak as a critical dependency requires risk mapping
- Article 26: ICT-related incident management — authentication bypass triggers incident classification
GDPR (Regulation 2016/679):
- Article 32: Security of processing — compromised identity provider means compromised data access controls
- Article 33: Breach notification — Keycloak compromise likely triggers 72-hour notification
Remediation Status
-
Protocol Mapper Injection: Keycloak 26+ disables
ScriptBasedMapperby default and provides documentation for mapper hardening. Status: Framework mitigated; configuration audit recommended. -
Session Fixation: Keycloak 25+ introduced stricter redirect URI validation and deprecated wildcard matching. Status: Partially remediated; wildcard configurations require manual review.
-
Admin API Exposure: Keycloak documentation recommends network segmentation, but default deployments (Docker, Helm) do not enforce it. Status: Not enforced by default; deployment-level action required.
-
RBAC Bypass: Keycloak’s authorization services documentation clarifies realm vs. client role evaluation, but the evaluation logic remains unchanged. Status: Known behavior; requires role architecture review.
-
Information Disclosure: Keycloak 26+ provides production-ready logging profiles and error suppression. Status: Framework provides tools; configuration-level action required.
How Resiliently Can Help
Domain Exposure Scanner: Detect Internet-facing Keycloak instances in your insured’s infrastructure, including admin endpoints that should not be exposed. Map the identity trust chain from Keycloak to dependent applications.
Cyber Risk Calculator: Quantify the cascading impact of a Keycloak compromise across your insured’s application portfolio. Input the number of dependent systems, data sensitivity classification, and regulatory obligations to generate a portfolio-level loss estimate.
AI-SBOM Scanner: Verify that your insured’s Keycloak deployment matches their security declarations. Compare self-declared configuration (network segmentation, MFA enforcement, admin access restrictions) against OpenHack-verified findings to produce an adjusted risk score.
This review was conducted using the OpenHack scenario-based whitebox security review methodology. Findings were independently triaged before publication. Keycloak maintains a responsible disclosure process through their SECURITY.md. The Keycloak security team was notified through their coordinated disclosure process prior to publication.
Michael Guiao Michael Guiao founded Resiliently AI and writes Resiliently. He has CISM, CCSP, CISA, and DPO certifications — but let them lapse, because in the age of AI, knowledge is cheap. What matters is judgment, and that comes from eight years of hands-on work at Zurich, Sompo, AXA, and PwC.
Get the full picture with premium access
In-depth reports, assessment tools, and weekly risk intelligence for cyber professionals.
Professional
Full platform — continuous monitoring, API access, white-label reports
Everything in Starter plus professional tools
Upgrade Now →Free NIS2 Compliance Checklist
Get the free 15-point PDF checklist + NIS2 compliance tips in your inbox.
No spam. Unsubscribe anytime. Privacy Policy
blog.featured
The Resilience Stack™: A Five-Layer Framework for Cyber Insurance Risk Assessment
12 min read
The Five Toxic Powers of Agentic AI — What Underwriters Need to Know
11 min read
DeepMind Mapped Every Way the Web Can Hijack Your AI Agent — Here Is What Underwriters Need to Ask
20 min read
The AI Insurance Split: Big Carriers Exclude, Startups Fill the Gap — What Underwriters and Brokers Need to Know
12 min read
Premium Report
2026 Cyber Risk Landscape Report
24 pages of threat analysis, claims data, and underwriting implications for European cyber insurance.
View Reports →Related posts
The Five Toxic Powers of Agentic AI — What Underwriters Need to Know
Agentic AI introduces five double-edged powers that create toxic risk combinations. Here's how underwriters, brokers, and CISOs should assess the threat.
Agentic Security: What Underwriters Need to Know in 2026
Autonomous AI agents are entering production at scale — and they bring a completely new attack surface that traditional cyber insurance questionnaires weren't designed to capture.
An AI Agent Deleted a Startup's Production Database — Can You Insure Against That?
PocketOS lost its production database to a Cursor AI agent in 9 seconds. The incident exposes a gap in cyber insurance that most policies don't cover: AI-caused operational destruction with no external attacker.