Summary
A missing-authentication flaw in PraisonAI can allow requests to reach the Recipe server even when API-key or JWT authentication is configured but its required secret is absent. When the server is externally reachable, an attacker may submit unauthenticated recipe execution requests.
Affected context
The issue occurs in PraisonAI deployments using the Recipe server with authentication enabled through API-key or JWT middleware. Risk is elevated when the corresponding PRAISONAI_API_KEY or PRAISONAI_JWT_SECRET environment variable is missing and the server is bound to an externally accessible interface.
Exploit preconditions
- Attack surface: HTTP access to the externally bound Recipe server
- Required access: No valid credentials may be required when the configured authentication secret is absent
- Trigger point: A request to
POST /v1/recipes/run - Why exploitation is possible: Authentication middleware permits the request when required credential material is not configured, creating an unauthenticated execution path
Why this happens
The underlying bug is a failure to fail closed when authentication configuration is incomplete. The middleware treats a missing API key or JWT secret as a condition under which requests can proceed rather than rejecting startup or denying access, mapping primarily to CWE-306: Missing Authentication and secondarily to CWE-287: Improper Authentication.
Potential impact
- Unauthorized users may execute recipes
- Sensitive data or connected services could be accessed through permitted recipe behavior
- Workloads may be altered or triggered without authorization
- The server could be abused for resource consumption or operational disruption
- Downstream systems may be affected depending on configured integrations and privileges
General mitigation guidance
Mitigation generally focuses on fail-closed authentication configuration and reducing exposure of execution endpoints.
Common defensive patterns include:
- Rejecting startup or denying requests when required authentication secrets are absent
- Validating authentication configuration before accepting network traffic
- Requiring explicit, valid credentials for every protected endpoint
- Binding administrative or execution services only to trusted interfaces where possible
- Applying network controls, rate limits, and least-privilege identities to recipe execution
- Avoiding reliance on optional environment variables for security-critical controls
How teams detect issues like this
Organizations can identify this class of issue through:
- Static analysis and code review checks for authentication branches that allow requests when secrets are null, empty, or undefined
- Tests that exercise protected endpoints with missing, malformed, and invalid credentials
- Configuration policy checks requiring authentication secrets for externally exposed services
- Runtime monitoring for successful requests to protected endpoints without corresponding authentication evidence
- API gateway or service-mesh policies that enforce authentication independently of application configuration

