Summary
FeMiner wms contains a SQL injection flaw in /src/chkuser.php where the Username parameter is incorporated into database queries without sufficient sanitization or parameterization.
A remote attacker can manipulate this input to alter SQL logic, which may lead to unauthorized data access, account compromise, or complete database takeover under certain conditions.
Affected context
The vulnerability occurs in FeMiner wms deployments that expose the /src/chkuser.php endpoint and rely on a backend database for user lookup or authentication.
It manifests when the Username parameter supplied by a client is passed into SQL statements without robust input handling or use of prepared statements.
Any environment where this script is reachable over a network and tied to a privileged database account is at elevated risk, especially if database accounts have broad read/write permissions.
Exploit preconditions
- Attack surface: Remote HTTP(S) access to the /src/chkuser.php functionality.
- Required access: Ability to send crafted requests containing a controlled Username parameter (no prior authentication necessarily required, depending on deployment).
- Trigger point: Application code that builds or executes SQL queries in chkuser.php using the Username value directly or via inadequate escaping.
- Why exploitation is possible: User-controlled data is concatenated into SQL query strings or passed to the database without parameter binding, allowing attackers to inject additional SQL syntax and modify the intended query behavior.
Why this happens
This issue stems from constructing SQL queries by directly embedding the Username parameter into query strings, instead of using parameterized statements or a safe query builder.
The pattern maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where special characters such as quotes and control operators are not correctly handled.
It is also related to CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component, because the application forwards untrusted input to the downstream database engine without adequate neutralization.
The abstract bug class is: trusting raw user-supplied data as part of executable SQL, effectively merging data and control channels.
Potential impact
- Bypassing authentication checks by manipulating credential- or user-lookup queries.
- Reading sensitive data from arbitrary tables, including user records or application configuration, depending on database permissions.
- Modifying or deleting records, leading to data loss, corruption, or business logic manipulation.
- Creating or escalating database-level accounts and roles, potentially achieving full database compromise.
- Using the database as a stepping stone for further attacks, such as writing web shells via SQL functions in misconfigured environments.
General mitigation guidance
Effective mitigation for this class of vulnerability typically focuses on separating data from control in all database interactions and minimizing trust in user input.
Recommended defensive patterns include:
- Using parameterized queries or prepared statements for all database operations that consume user input, ensuring the Username value is treated purely as data.
- Adopting an ORM or query builder that enforces parameter binding by default and discourages raw string concatenation.
- Implementing a centralized input-handling layer that treats identifiers like usernames as strictly constrained data (e.g., length-limited, character-whitelisted).
- Applying least-privilege to database accounts so that the credentials used by chkuser.php can only perform the minimal required operations (e.g., read-only on specific tables).
- Implementing defense-in-depth with application-level authorization checks that do not rely solely on database queries being well-formed.
- Avoiding dynamic SQL where possible; where dynamic behavior is needed, constructing it from fixed, code-defined fragments rather than user-controlled strings.
How teams detect issues like this
Organizations can detect and monitor for SQL injection risk in several ways:
- Static analysis: Configure SAST tools or custom rules to flag string concatenation or interpolation patterns in SQL query construction, especially in authentication-related code such as chkuser.php.
- Code review: During manual reviews, specifically inspect database access layers to ensure all user-influenced parameters are bound through prepared statements and not directly embedded into query strings.
- Runtime monitoring: Use database activity monitoring tools and application logs to detect anomalous queries, such as those containing unexpected SQL keywords or always-true conditions.
- Security testing: Regularly perform automated and manual penetration testing focused on input vectors like Username, incorporating fuzzing and injection payloads to verify that sanitization and parameterization controls are effective.
- Policy enforcement: Enforce secure coding guidelines and CI checks that block deployment of code paths where raw user input appears in SQL strings without parameter binding.

