Summary
Casdoor through version 4.4.0 does not properly protect the instance-wide built-in certificate private key exposed through certificate retrieval endpoints. An organization administrator who obtains the key may be able to forge JWT tokens for users across organizations, including global administrators, creating a critical cross-tenant authorization risk.
Affected context
The issue occurs in Casdoor deployments that expose the built-in certificate through /api/get-certs or /api/get-cert and permit organization administrators to access those endpoints. Risk is higher where the returned private key is accepted for JWT signing and where tokens are trusted across organization or administrative boundaries.
Exploit preconditions
- Attack surface: Casdoor certificate retrieval API endpoints
- Required access: Valid organization administrator privileges, or another path to invoke the endpoints with equivalent authorization
- Trigger point: Retrieval of the instance-wide built-in certificate private key
- Why exploitation is possible: Insufficient authorization and masking controls allow a lower-scope administrator to obtain a signing key trusted for authentication across broader application contexts
Why this happens
The vulnerability results from failing to enforce authorization boundaries around a shared cryptographic private key. The certificate retrieval functionality exposes sensitive key material to organization administrators instead of limiting access to an appropriate instance-level security boundary or returning only non-sensitive certificate data. This maps to CWE-863: Incorrect Authorization, because a user with narrower administrative scope may access a resource whose permissions should be restricted to a more privileged context.
Potential impact
- Attackers may forge JWT tokens for arbitrary users
- Attackers could impersonate global administrators
- Unauthorized access across organizations may occur
- Tenant isolation and access-control policies could be bypassed
- Sensitive organizational data may be exposed or modified
- Audit records may attribute malicious activity to forged identities
General mitigation guidance
Mitigation generally focuses on protecting signing keys as high-sensitivity secrets and enforcing authorization at the correct administrative scope.
Common defensive patterns include:
- Never returning private key material through routine API responses
- Returning public certificate information separately from secret signing material
- Restricting key-management operations to tightly controlled instance-level principals
- Applying explicit organization and tenant boundary checks to certificate endpoints
- Rotating potentially exposed signing keys and invalidating tokens issued with compromised material
- Storing signing keys in protected secret-management systems with least-privilege access
- Using short-lived tokens and validating issuer, audience, organization, and signature claims
How teams detect issues like this
Organizations can assess for this class of issue through:
- Static analysis and code review of certificate, key, and token-management endpoints
- Checks for private-key fields included in API serializers or JSON responses
- Authorization tests using organization administrator and global administrator roles
- Integration tests confirming that tenant-scoped users cannot retrieve instance-wide secrets
- API gateway policies that block sensitive key-management operations from lower-trust roles
- Monitoring responses for PEM-encoded private keys, signing secrets, or unexpected credential material
Automated security review tools can help identify secret exposure and missing authorization checks, but role-boundary tests are still important.

