Summary
The code100x Mobile API contains an authorization bypass issue that lets attackers impersonate any user by crafting a JSON payload in a special HTTP header.
Because the middleware trusts a spoofed identity header whenever an Auth-Key header is present without validating its value, unauthenticated attackers can gain access to course data belonging to arbitrary users and administrators.
Affected context
This vulnerability affects the mobile API path where requests pass through middleware.ts and then into the mobile courses endpoint.
It is relevant in deployments where:
- The Mobile API accepts HTTP requests with custom headers such as
Auth-Keyandg - The middleware is responsible for generating and attaching identity headers
- Downstream route handlers trust the identity header for access control decisions
Exploit preconditions
- Attack surface: Public-facing Mobile API endpoints exposed over HTTP(S)
- Required access: Network access to the API; no valid credentials needed
- Trigger point: Sending a request with:
- A crafted
gHTTP header containing a JSON payload that encodes a victim user identity - An
Auth-Keyheader (with any value) that causes the middleware to skip identity header generation - Why exploitation is possible: The middleware logic treats the presence of
Auth-Keyas sufficient for bypassing identity construction yet does not validate theAuth-Keyvalue.
Consequently, downstream handlers treat the attacker-supplied identity header as trustworthy and use it for authorization decisions.
Why this happens
The underlying issue is an authorization design flaw mapped to CWE-639: Authorization Bypass Through User-Controlled Key.
Instead of deriving user identity from an authenticated context, the system:
- Suppresses normal identity header generation whenever an
Auth-Keyheader exists, regardless of its validity, and - Relies on a caller-controlled header (
gwith JSON) to provide identity information that downstream logic treats as authoritative.
This pattern allows untrusted input to control the identifier used in authorization checks, effectively turning a user identifier into an attacker-controlled key for access control.
Potential impact
- Unauthorized access to course data for any enrolled user
- Impersonation of administrator accounts within the Mobile API context
- Exposure of sensitive user information such as enrollment status or course progress
- Potential pivot into administrative actions if the impersonated identity has elevated privileges
- Loss of audit trail integrity, as activity appears to originate from impersonated users
General mitigation guidance
Effective mitigation focuses on centralizing and hardening identity derivation and removing attacker influence from authorization keys:
- Ensure that user identity is derived only from validated authentication artifacts (e.g., session tokens, signed tokens, or securely validated API keys).
- Treat all client-supplied identity- or role-related headers as untrusted; generate identity headers exclusively on the server side.
- Validate any
Auth-Keyor API key against a secure backend store and reject requests with missing, malformed, or invalid values instead of skipping checks. - Enforce authorization decisions based on internal user IDs or subject claims that cannot be directly manipulated by clients.
- Apply least-privilege design so that even if identity handling fails, exposed data sets are minimized.
- Normalize and document header usage so that security-relevant headers are not overloaded with multiple meanings or ambiguous behavior.
How teams detect issues like this
Detection approaches can focus on both code-level and runtime signals:
- Static analysis / code review:
- Look for middleware that branches on the presence of headers like
Auth-Keywithout verifying their contents or provenance. - Flag patterns where user identity or role is derived directly from request headers or request body fields without cryptographic verification.
- Identify routes where authorization decisions are tied to IDs or identity attributes that originate from client-controlled values.
- Policy enforcement:
- Define internal guidelines that prohibit trusting client-provided identity headers and require server-side identity generation.
- Use automated review tools to enforce rules around header-based authentication and authorization logic.
- Runtime monitoring:
- Log and alert on anomalous use of
Auth-Keyand identity headers, especially repeated access to multiple accounts from a single source. - Monitor for patterns where a single client accesses many distinct user or admin identities in a short timeframe.

