Summary
A broken access control issue in Leantime's JSON-RPC API allows authenticated users to call users.getUser with arbitrary user IDs and retrieve entire credential records.
This exposure includes password hashes, TOTP secrets, and session tokens, enabling offline password cracking, 2FA bypass, account takeover, and session hijacking when an attacker can access the API.
Affected context
The vulnerability occurs in Leantime deployments that expose the JSON-RPC API and use the Users::getUser method to retrieve user information.
It manifests when the method is callable by general authenticated users without per-object authorization checks to ensure they can only access their own account data.
The issue is most relevant in multi-user or multi-tenant environments where users should not see each other's credentials, but the application trusts a supplied user ID parameter without enforcing ownership or role constraints.
Exploit preconditions
- Attack surface: Application JSON-RPC API endpoint providing
users.getUser - Required access: Valid authenticated user account with ability to issue JSON-RPC calls
- Trigger point: Calling
users.getUserwith user IDs belonging to other accounts - Why exploitation is possible: The method relies on client-supplied identifiers and lacks server-side authorization checks that bind the request to the caller's identity and role, leading to an Insecure Direct Object Reference (IDOR) condition under CWE-639.
Why this happens
The root cause is missing object-level authorization for user records in the Users::getUser path.
The API trusts the userId parameter provided by the client and directly queries and returns the associated database row without verifying that the requester is allowed to view that specific record.
This design pattern matches CWE-639: Authorization Bypass Through User-Controlled Key, where resource access is controlled solely by a user-controlled identifier instead of being mediated by robust access control logic.
As a result, sensitive credential fields such as password hashes, TOTP secrets, and session tokens—intended to remain internal—are exposed to any authenticated caller who can iterate over user IDs.
Potential impact
- Attackers may retrieve password hashes for all users and perform offline password cracking.
- Attackers could obtain TOTP secrets and potentially bypass two-factor authentication protections.
- Attackers can collect active session tokens, enabling session hijacking and impersonation of other users.
- Attackers may fully compromise administrator or privileged accounts, leading to data exposure or modification across the application.
- Attackers could conduct large-scale account enumeration and profiling of the user base.
General mitigation guidance
Effective mitigation focuses on enforcing robust, server-side access control at the object level and minimizing exposure of credential material through APIs.
Recommended defensive patterns include:
- Implementing per-record authorization checks in all user-related endpoints, ensuring that callers can only access their own user record unless explicitly granted elevated privileges.
- Avoiding reliance on user-supplied identifiers alone; derive the effective user ID from the authenticated session or token whenever possible.
- Designing API schemas that never return sensitive credential fields (password hashes, TOTP seeds, session tokens) to any client, treating them as write-only or strictly internal.
- Centralizing access-control decisions in reusable middleware or service layers to ensure consistent enforcement across all API methods.
- Applying least-privilege principles to roles and permissions so that generic users cannot invoke administrative-level data retrieval operations.
How teams detect issues like this
Detection efforts can target both code patterns and runtime behavior.
Useful strategies include:
- Static analysis rules that flag controller or service methods where database queries are parameterized with user-controlled identifiers without a corresponding authorization check.
- Code review checklists that explicitly require verification of object-level access control for any endpoint that handles user IDs or other record keys.
- Logging and monitoring of JSON-RPC calls for unusual patterns, such as a single user ID requesting many different user records in a short timeframe.
- Security testing and automated API fuzzing that attempts to access other users' resources by modifying IDs, combined with policies that treat any cross-user data access as a failure condition.
- Use of API gateways or WAF rules that can add coarse-grained protections and highlight anomalous enumeration attempts, even if they cannot enforce fine-grained authorization alone.

