Summary
Parse Server contains an authorization flaw where the readOnlyMasterKey can invoke the POST /loginAs endpoint to obtain a valid session token for any user.
When this occurs, a credential that is intended to be read-only can impersonate arbitrary users and gains full read and write access to their data, undermining separation of privileges in affected deployments.
Affected context
This vulnerability affects Parse Server deployments that:
- Are running versions prior to 8.6.6 or 9.5.0-alpha.4
- Have the
readOnlyMasterKeyconfigured and in active use - Expose the
/loginAsendpoint as part of their API surface
In these environments, the readOnlyMasterKey is treated as sufficiently privileged to call POST /loginAs, even though it is intended to be constrained to read-only operations.
Exploit preconditions
- Attack surface: Application API, specifically the
POST /loginAsendpoint. - Required access: Knowledge and use of the
readOnlyMasterKeyvalue (e.g., from misconfigured backend, logs, client-side exposure, or insider access). - Trigger point: Sending a crafted
POST /loginAsrequest authenticated with thereadOnlyMasterKeytargeting a chosen user. - Why exploitation is possible: The authorization layer does not properly distinguish between full master key privileges and read-only privileges for the
/loginAsoperation, allowing a read-only credential to perform a state-changing impersonation action.
Why this happens
The core issue is an authorization design flaw in how Parse Server evaluates credentials against sensitive operations.
The readOnlyMasterKey is intended to enforce a strictly read-only permission set, but the /loginAs endpoint treats it as sufficiently privileged to create session tokens for arbitrary users.
This maps to CWE-863: Incorrect Authorization, where authorization checks do not correctly enforce the separation between different privilege levels, resulting in a lower-privileged key being able to perform higher-privileged actions.
Abstractly, this pattern appears whenever a supposedly constrained API credential (e.g., "read-only", "analytics-only") is able to access functionality that mutates state or escalates privileges because role/permission checks are incomplete or inconsistent.
Potential impact
- An attacker with access to the
readOnlyMasterKeycould impersonate any user via/loginAs. - Full read and write access to the data of impersonated users, including personal information or application secrets stored in user data.
- Bypass of normal access controls and ACLs enforced at the user level.
- Undermining of audit trails and accountability, since actions appear to originate from victim user accounts.
- Potential chaining with other vulnerabilities or misconfigurations to further escalate access within the environment.
General mitigation guidance
Mitigation generally focuses on hardening authorization boundaries around privileged API keys and sensitive endpoints:
- Ensure that "read-only" or restricted keys are consistently enforced as such across all endpoints, especially those that can alter authentication state or create sessions.
- Apply explicit, fine-grained permission checks per endpoint, avoiding implicit assumptions that any master-level key can perform all operations.
- Separate duties for keys and roles: introduce distinct capabilities for administrative operations (like user impersonation) that require explicit use of a high-privilege credential or out-of-band administrative channel.
- Reduce exposure of master keys by confining them to trusted backend services and avoiding client-side or loosely controlled environments.
- Regularly rotate master and read-only keys and limit their scope using configuration, network segmentation, and access control policies.
How teams detect issues like this
Detection efforts can focus on both code-level review and runtime telemetry:
- Code review and design analysis:
- Examine authorization logic for privileged endpoints (e.g., login-as, admin operations) to ensure they explicitly differentiate between master and read-only or scoped keys.
- Look for patterns where multiple keys/roles are funneled through shared authorization code paths without explicit permission branching.
- Flag any endpoints that can create session tokens, modify ACLs, or impersonate users for heightened scrutiny.
- Static analysis and automated checks:
- Use policy-based code scanning or linting rules that require explicit permission checks for sensitive routes and disallow broad "any master key" conditions.
- Integrate automated tests that assert read-only credentials cannot perform write or impersonation actions.
- Runtime monitoring and logging:
- Log all
/loginAscalls with information about the type of credential used and the target user ID. - Set alerts for anomalous patterns, such as a read-only context invoking impersonation endpoints or sudden spikes in impersonation activity.

