Summary
QueryWeaver contains an authentication bypass where an attacker can obtain valid session tokens for existing accounts simply by submitting a signup request using a victim's email address.
Because the signup route creates and binds a new token to the existing identity before verifying account existence, the server returns an authenticated session token without any credentials or user interaction from the victim.
Affected context
This vulnerability manifests in QueryWeaver's user signup flow, specifically in how new identities and session tokens are created and associated in the backing Neo4j/Cypher data store.
It is relevant where:
- Email addresses are used as primary identifiers for accounts
- The signup route performs identity and token creation via Cypher MERGE operations
- Session tokens are linked to identities before enforcing checks on whether the email is already registered
Deployments that expose this signup endpoint over the network, without additional verification or gating, are particularly susceptible.
Exploit preconditions
- Attack surface: Publicly exposed signup endpoint of the QueryWeaver application
- Required access: Network access to the service and knowledge or guessability of a victim's email address
- Trigger point: Submission of a crafted signup request containing the victim's email to the signup route
- Why exploitation is possible: The Cypher MERGE logic unconditionally creates and associates a new session token with the identity tied to the email before verifying whether that email is already in use, effectively bypassing normal authentication checks.
Why this happens
The underlying issue is an authorization logic flaw where identity and session-token creation are not correctly ordered or scoped relative to existing accounts.
By using a Cypher MERGE operation that binds a new token to an identity based solely on the email, the system treats a signup request as sufficient proof of ownership of that identifier.
This maps to CWE-863: Incorrect Authorization, because the system grants authenticated status and token issuance without establishing that the requester has legitimate control over the existing identity or performing credential checks.
Potential impact
- Attackers may gain authenticated session tokens for arbitrary existing accounts.
- Account takeover of victim identities without passwords or prior authentication.
- Unauthorized access to sensitive user data and application functionality.
- Potential escalation to broader system compromise if privileged accounts are targeted.
- Erosion of user trust due to silent, credential-less compromise.
General mitigation guidance
Effective mitigation focuses on enforcing strict separation between identity creation and authentication and ensuring that token issuance always follows successful verification of ownership.
Common patterns include:
- Performing explicit existence checks before creating identities or tokens, and returning errors if an email is already registered.
- Ensuring that session tokens are only generated after a successful, credential-based authentication or a verified signup (e.g., through email confirmation).
- Designing signup and login flows so that identifiers (like email addresses) cannot be claimed without proof of control.
- Applying least-privilege principles to session tokens, avoiding default issuance of highly privileged tokens, even for new accounts.
- Centralizing authorization decisions and avoiding ad hoc logic in database queries that blur identity creation and authentication.
How teams detect issues like this
Detection typically involves both preventive checks in development and ongoing monitoring in production:
- Static and manual review of authentication flows to identify logic where tokens are created or identities are bound before authorization or ownership checks.
- Code review patterns that flag database MERGE/UPSERT operations used in security-critical contexts (signup, login, password reset) without explicit preconditions.
- Security-focused unit and integration tests that simulate signup requests with existing emails and assert that no authenticated token is issued.
- Runtime monitoring for abnormal patterns, such as frequent signup attempts using emails that already exist or unusual token issuance rates tied to known accounts.
- Optional use of automated application security testing tools that can fuzz authentication endpoints and detect credential-less account access.

