Summary
A flaw in pac4j-core causes CheckProfileTypeAuthorizer to apply profile type validation in reverse, allowing weaker authenticated profiles to satisfy checks intended for stronger profile types. Under affected authorization configurations, an attacker may access protected resources without meeting the required authentication assurance level.
Affected context
The vulnerability occurs in applications using pac4j-core's CheckProfileTypeAuthorizer to enforce profile type or authentication-level requirements. Risk depends on an authorization policy that distinguishes between weaker and stronger client profiles and on the application relying on the affected validation behavior to protect resources.
Exploit preconditions
- Attack surface: Application authorization checks that use CheckProfileTypeAuthorizer
- Required access: Ability to authenticate through a client or profile type accepted by the application
- Trigger point: Authorization of a resource requiring a stronger profile type
- Why exploitation is possible: Reversed validation logic can treat a generic or weaker profile as satisfying a stronger profile requirement
Why this happens
The underlying bug is an authorization logic error in profile type validation. Instead of correctly confirming that the authenticated profile meets the required type or assurance level, the check reverses the relationship between the presented and required profiles. This maps to CWE-863: Incorrect Authorization, where access-control decisions incorrectly grant permissions to an authenticated subject.
Potential impact
- Attackers may access resources intended for stronger-authenticated users
- Applications could expose sensitive data or privileged operations
- Administrative or high-assurance workflows may be reachable through weaker clients
- Organizations may experience unauthorized changes, data disclosure, or compliance impact
General mitigation guidance
Mitigation typically focuses on making authorization decisions explicit, monotonic, and independent of ambiguous profile comparisons.
Common defensive patterns include:
- Use corrected authorization logic that verifies the presented profile meets or exceeds the required profile type
- Prefer secure-by-default policies that deny access when profile classification is missing, ambiguous, or unexpected
- Reduce trust in client-supplied profile attributes by deriving assurance from server-controlled authentication state
- Apply least privilege and separate high-assurance resources from general authentication paths
- Add tests covering weaker, equal, stronger, unknown, and absent profile types
- Review authorization behavior at integration boundaries rather than relying solely on generic profile checks
How teams detect issues like this
Organizations can detect this class of issue through:
- Static analysis and code review for inverted comparisons, reversed subtype checks, and default-allow authorization branches
- Policy tests that verify weaker authentication profiles cannot access stronger-profile resources
- Integration tests covering every supported client and profile combination
- Runtime monitoring for lower-assurance clients accessing privileged endpoints
- Automated dependency and security review tools that flag vulnerable authorization components
- Enforcement of centralized authorization policies with explicit deny behavior for unrecognized profile types

