/

CVE-2026-31071

Severity:

CRITICAL RISK

(9.1)

Missing Authentication in LalanaChami Pharmacy Management

CVE-2026-31071

Deferred

Vulnerability type

Category:

Missing Authentication

CWE:

CWE-306

Impact:

Unauthorized Data Access and Modification

Severity:

CRITICAL RISK

(9.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

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/doctorOder and 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.

Sources

SourceLink
gist.github.comgist.github.com/nedlir/bc8ad4693c53256819280e8f5de49286
github.comgithub.com/LalanaChami/Pharmacy-Mangment-System/tree/5c3d02888631166649856f71d542387114b3010b/backend/routes

Frequently asked

questions

Yes. If the API is accessible over the network (for example, on the public internet or a reachable internal segment), an attacker can exploit it remotely without interacting with the user interface.

No. The core problem is the absence of authentication on specific endpoints, so any party able to send HTTP requests to the affected API can access or modify data without logging in.

Introduce mandatory authentication and authorization for all endpoints that handle user data, inventory, or prescriptions.

Implement centralized middleware or filters that apply to these routes by default, and restrict data access based on verified user identity and role.

Define a clear API security model where all endpoints are considered private unless explicitly marked as public, enforce this via shared middleware, and incorporate security-focused code review and automated tests to ensure that no new sensitive route is exposed without proper protection.

Find out what's already
exploitable in your codebase.