Summary
A flaw in PraisonAI's MCP security policy evaluation allows Basic and OAuth policies to treat any non-empty Authorization header as valid without checking the configured credential validator. An attacker who can reach protected MCP endpoints may therefore use invalid credentials to access tools and resources that should require authentication.
Affected context
The issue occurs in PraisonAI deployments using the TypeScript MCP security component with Basic or OAuth authentication policies. It becomes risky when protected MCP tools or resources are exposed to callers who can submit requests and the policy relies on credential validation rather than an independent authorization layer.
Exploit preconditions
- Attack surface: MCP endpoints protected by PraisonAI security policies
- Required access: Network reachability to the relevant MCP tools or resources
- Trigger point: Authentication evaluation for a request using a Basic or OAuth policy
- Why exploitation is possible: The policy accepts a non-empty Authorization header and returns an authenticated result without invoking the configured credential validator
Why this happens
The authentication policy implementation conditionally invokes credential validation only for API-key and bearer methods. Basic and OAuth paths instead use the presence of an Authorization header as sufficient evidence of authentication, creating an authentication bypass.
This behavior maps primarily to CWE-287: Improper Authentication, with related implications for CWE-288: Authentication Bypass Using an Alternate Path and CWE-863: Incorrect Authorization. The underlying insecure pattern is treating credential presence or format as proof of credential validity.
Potential impact
- Unauthorized callers may access protected MCP tools
- Attackers could read or manipulate protected MCP resources
- Sensitive data may be disclosed through tool or resource responses
- Invalid identities could perform actions attributed to authenticated users
- Downstream systems may trust unauthorized MCP operations
General mitigation guidance
Mitigation generally focuses on making every supported authentication method perform actual credential verification before producing an authenticated result.
Common defensive patterns include:
- Require the configured validator to approve credentials for Basic and OAuth policies
- Treat missing, malformed, or unvalidated credentials as unauthenticated
- Separate authentication success from authorization decisions and enforce both
- Use secure-by-default policies that deny access unless identity and permissions are verified
- Minimize permissions granted to MCP identities and service accounts
- Add negative tests covering invalid, empty, expired, and differently formatted credentials
How teams detect issues like this
Organizations can identify this class of issue through:
- Static analysis and code review checks for authentication branches that return success based only on header presence
- Tests asserting that every authentication method invokes credential verification
- Integration tests using invalid Basic and OAuth credentials against protected tools and resources
- Runtime monitoring for authenticated requests lacking corresponding validator or identity-provider events
- Policy enforcement requiring explicit authentication and authorization checks before MCP operations
- Automated code review tools that flag alternate authentication paths and unconditional authenticated results

