Summary
Capgo contains an SSO account takeover flaw in its provision-user endpoint that allows attacker-controlled IdPs to merge accounts purely on email matches without validating the SSO provider domain.
An attacker with enterprise org admin rights and a malicious identity provider can forge SAML assertions containing victim email addresses, causing automatic account merges and gaining full access to victim users, organizations, and their data.
Affected context
This vulnerability appears in Capgo deployments that:
- Use SSO/SAML-based authentication and account provisioning for enterprise organizations
- Allow org admins to configure or control identity providers
- Implement automatic account linking or merging based primarily on email address matches
It becomes risky when SSO assertions are accepted from IdPs without strict domain ownership checks or binding between the IdP and specific user accounts.
Exploit preconditions
- Attack surface: Capgo provision-user endpoint used for SSO/SAML account provisioning and linking
- Required access: Enterprise organization admin privileges plus control over, or ability to configure, a malicious or compromised identity provider
- Trigger point: Submission of SAML assertions or SSO payloads that include email addresses matching existing Capgo user accounts
- Why exploitation is possible: The system merges accounts solely on email match without validating that the IdP is authorized for the victim's domain or enforcing a trusted binding between IdP, organization, and user identity
Why this happens
The underlying issue is an authentication and identity validation flaw where SSO assertions are treated as trustworthy purely on the basis of email identity, rather than verifying that the identity provider is properly authorized for that user's domain and organization.
This maps to CWE-287: Improper Authentication, because the application performs incomplete checks when establishing authenticated identity and linking accounts. The provision-user endpoint embodies an insecure pattern: automatic account merging based on unverified email claims from external IdPs, without enforcing strong issuer constraints, audience restrictions, or domain-scoped ownership validation.
Potential impact
- Attacker may take over arbitrary victim accounts whose email addresses are known
- Attacker could gain full access to victim organizations, projects, and internal data
- Attacker can impersonate privileged users and perform administrative actions
- Attacker may pivot across tenants if cross-org account linking is supported
- Compromise of audit integrity through actions executed under victim identities
General mitigation guidance
Mitigation generally focuses on strengthening identity binding and authentication checks around SSO flows and account linking.
Common defensive patterns include:
- Enforcing a strict trust relationship between identity providers, organizations, and email domains (e.g., whitelisting IdPs per tenant and domain)
- Validating SAML/OIDC assertions for issuer, audience, and domain ownership before provisioning or merging accounts
- Avoiding silent auto-merge; requiring explicit, verified user consent or out-of-band confirmation for account linking
- Using immutable internal identifiers instead of email alone for account correlation
- Applying least-privilege principles for administrative operations related to SSO configuration and user provisioning
How teams detect issues like this
Detection often relies on a mix of design review, code analysis, and runtime monitoring:
- Static and manual code review focused on authentication flows, particularly endpoints that handle SSO assertions and account provisioning
- Verification that SAML/OIDC handlers enforce issuer and audience checks, and do not rely solely on email for identity correlation
- Policy-based checks in CI/CD that flag changes introducing automatic account merging or trust expansion for identity providers
- Runtime logging and anomaly detection for unusual patterns of account merges, especially across different domains or organizations
- Periodic security architecture reviews of SSO onboarding and tenant/IdP configuration logic

