Summary
An improper privilege management flaw in the LalanaChami Pharmacy Management System allows unauthenticated users to grant themselves administrative roles during account registration.
Because the /api/user/signup endpoint accepts a client-supplied role without validation or enforcement of server-side rules, attackers can create accounts with full administrative privileges remotely.
Affected context
The vulnerability occurs in the user registration workflow of the LalanaChami Pharmacy Management System (commit 5c3d028), specifically in the /api/user/signup HTTP endpoint.
It affects deployments where public or semi-public registration is enabled and the backend trusts role information provided in the request body without cross-checking it against server-side authorization policies.
Exploit preconditions
- Attack surface: Public web API endpoint
/api/user/signup - Required access: Network reachability to the application; no prior authentication needed
- Trigger point: Submission of a crafted signup request containing a privileged
rolevalue (e.g., an administrator role) in the JSON or form body - Why exploitation is possible: The server does not enforce server-side role assignment rules and fails to validate or override the user-supplied
rolefield, allowing arbitrary privilege selection at registration time
Why this happens
The root cause is a broken authorization design where the application delegates trust for privilege decisions to client-controlled input.
Instead of deriving a new user's role from trusted server-side logic (e.g., defaulting to a basic user role or requiring an existing admin to approve elevated roles), the /api/user/signup endpoint reads a role parameter from the request body and applies it directly.
This pattern maps to CWE-269: Improper Privilege Management, where the system fails to enforce correct separation of privileges and allows untrusted actors to influence their own authorization level.
Potential impact
- Creation of arbitrary administrator accounts by unauthenticated remote users
- Full administrative control over pharmacy management data and configuration (patients, prescriptions, inventory, billing records), depending on deployment
- Modification or deletion of sensitive medical, inventory, or financial records
- Creation of backdoor accounts and long-term persistence within the application
- Potential exposure or exfiltration of protected health or customer data handled by the system
- Use of the compromised admin access to pivot to underlying infrastructure components or integrated systems
General mitigation guidance
Effective mitigation focuses on server-side control of roles and privileges and removal of trust in client-supplied authorization data:
- Assign roles exclusively on the server, ignoring or completely removing any
roleor privilege fields from client registration payloads. - Default all self-registered users to the lowest-privilege role and require an authenticated, authorized administrator to perform any role elevation through a separate, protected workflow.
- Centralize authorization logic so that privilege decisions are derived from trusted sources (e.g., database records, configuration) rather than request parameters.
- Enforce principle of least privilege when defining application roles and associated permissions.
- Introduce server-side validation that rejects any attempts to set privileged roles via unauthenticated or low-privilege endpoints.
- Design APIs so that administrative actions are logically and physically separated from public endpoints (e.g., distinct admin routes protected by strong authentication and authorization checks).
How teams detect issues like this
Organizations can use a combination of code-level and operational techniques to detect this class of issue:
- Static analysis: Look for controllers or handlers where roles, permissions, or access levels are taken directly from request parameters (e.g.,
role,isAdmin,privilege) and written to user records without authorization checks. - Code review patterns: Flag account creation or update flows where:
- A user's role is set from client input.
- There is no explicit check that the caller is already authorized to assign the requested role.
- Registration endpoints reference administrative roles or elevated permission flags.
- Policy enforcement: Implement secure coding guidelines and linting rules that forbid trusting client-side role indicators and require server-side derivation of privileges.
- Runtime monitoring: Log and alert on events where new accounts are created with privileged roles, especially from anonymous sessions or unusual IP ranges, to quickly identify abuse.

