Summary
A critical authentication bypass in openssl_encrypt allows the API to accept any non-empty Bearer token without verifying its validity. An attacker who can reach the affected API may upload arbitrary public keys, enumerate keys, and revoke keys belonging to other users.
Affected context
The issue occurs in deployments using openssl_encrypt before 1.4.0 when API requests are authenticated through the vulnerable verify_api_token function. It becomes risky where the affected key-management endpoints are network-accessible and rely on Bearer-token validation to protect key creation, listing, or revocation operations.
Exploit preconditions
- Attack surface: API endpoints that manage public keys
- Required access: Network access to the affected API; a valid account may not be required if the endpoint accepts any non-empty Bearer token
- Trigger point: Processing the
Authorizationheader during token verification - Why exploitation is possible: The authentication check confirms only that a Bearer token is present and non-empty, rather than validating its authenticity, ownership, scope, or expiration
Why this happens
The vulnerability results from an authentication function that treats the presence of a non-empty credential as proof of identity. This insecure validation pattern maps to CWE-287: Improper Authentication, because the application does not reliably establish that the requester is an authorized principal before allowing protected operations. As a result, authorization decisions can be made for an attacker-controlled or impersonated identity.
Potential impact
- Attackers may bypass authentication for protected API operations
- Arbitrary public keys could be uploaded
- Keys belonging to users may be enumerated
- An attacker could revoke keys owned by other users
- Account access or service integrations may be disrupted
- Key-management integrity and trust relationships could be compromised
General mitigation guidance
Mitigation focuses on making authentication cryptographically and operationally verifiable rather than presence-based.
Common defensive patterns include:
- Validate Bearer tokens against a trusted issuer, signature, audience, subject, and expiration
- Reject malformed, empty, expired, revoked, or incorrectly scoped credentials
- Enforce authorization checks that bind every key operation to the authenticated owner or an explicitly permitted role
- Apply least privilege to key-management identities and API capabilities
- Use secure-by-default authentication middleware instead of endpoint-specific token checks
- Rate-limit sensitive operations and require additional controls for bulk enumeration or revocation
- Avoid exposing key-management endpoints publicly unless required by the deployment model
How teams detect issues like this
Organizations can detect this class of issue through:
- Static analysis and code review searches for checks that test only token presence or string length
- Review of authentication middleware and all protected endpoint authorization paths
- Tests using invalid, expired, revoked, cross-tenant, and incorrectly scoped tokens
- API gateway policies that require validated identity, issuer, audience, and scope claims
- Audit monitoring for key enumeration, unexpected uploads, and bulk revocation activity
- Automated security testing that verifies unauthorized requests cannot perform protected key operations

