Summary
Several API endpoints in the LalanaChami Pharmacy Management System are exposed without authentication controls, allowing anyone on the network to call them directly.
An unauthenticated remote attacker can retrieve all user records (including bcrypt password hashes), modify drug inventory, and access sensitive medical prescription data by invoking these APIs.
Affected context
This vulnerability occurs in deployments of the LalanaChami Pharmacy Management System at commit 5c3d028 where API routes are reachable over the network without being protected by authentication middleware.
It is most relevant when the application is exposed beyond a tightly controlled internal network, for example via the internet, VPN, or flat intranet segments.
The affected context includes endpoints handling user records, drug inventory, and doctor orders that are invoked directly with HTTP requests and do not verify the caller's identity.
Exploit preconditions
- Attack surface: Network-accessible HTTP API (e.g., web server or reverse proxy exposing
/api/*endpoints). - Required access: None; no valid user account or session is required if an attacker can send requests to the API host and port.
- Trigger point: Direct requests to unauthenticated endpoints such as:
GET /api/user/getUserData- Operations under
/api/doctorOderand other inventory-related routes. - Why exploitation is possible: The affected routes are not wrapped by authentication/authorization middleware, so the backend performs sensitive operations based solely on the request path and parameters, not on a verified user identity or role.
Why this happens
The underlying issue maps to CWE-306: Missing Authentication for Critical Function.
Sensitive API operations are implemented without enforcing an authentication step, typically via shared middleware or explicit checks.
As a result, endpoints that return user records, alter pharmacy inventory, or expose prescription data treat all incoming requests as implicitly trusted.
This is an architectural and access control design flaw, where the security boundary is assumed but not enforced in code, rather than a flaw in cryptography or session handling.
Potential impact
- Unauthenticated retrieval of all user records, including email addresses and bcrypt password hashes, which may facilitate account takeover on other sites through credential reuse.
- Exposure of sensitive medical prescription data, potentially violating patient privacy and regulatory obligations.
- Unauthorized modification of drug inventory, including creating, updating, or deleting stock records, which could disrupt operations or mask fraudulent activity.
- Use of exposed user data for phishing, social engineering, or secondary attacks on staff, patients, or integrated systems.
- Reputational damage and possible non-compliance with healthcare data protection regulations.
General mitigation guidance
Addressing this vulnerability generally requires introducing consistent, centralized authentication and access control on all sensitive API routes.
Useful defensive patterns include:
- Applying authentication middleware by default to API route groups that handle user, inventory, or medical data, using explicit allowlists for public endpoints only.
- Enforcing role-based or attribute-based access control at the controller or service layer so that only appropriate roles (e.g., pharmacist, doctor, admin) can perform specific operations.
- Designing APIs with secure-by-default principles: assume endpoints are private unless explicitly designated as public, and require a verified identity for read and write operations involving protected data.
- Minimizing the data returned from each endpoint (data minimization) and avoiding bulk-dump endpoints where fine-grained queries would suffice.
- Reviewing deployment configurations (reverse proxies, API gateways) to ensure they do not accidentally bypass or duplicate critical authentication logic.
How teams detect issues like this
Organizations can identify similar issues by combining code-level and behavioral analysis:
- Static analysis: Search for route definitions that bypass authentication middleware or for controllers that access sensitive models (users, prescriptions, inventory) without checking authentication/authorization.
- Code review: Establish checklists requiring reviewers to verify that every newly added endpoint declares its authentication and authorization requirements explicitly, and that default route groups are protected.
- Automated tests: Implement integration tests that attempt to access sensitive endpoints without credentials and verify they are rejected with appropriate error codes.
- Runtime monitoring: Use API gateways, WAFs, or service meshes to log unauthenticated access attempts to sensitive paths (e.g.,
/api/user/*,/api/doctor*,/api/inventory*) and alert when responses are successful. - Policy enforcement: Adopt security linters or CI policies that fail builds when critical routes are registered without explicit access control annotations.

