Summary
FeMiner WMS up to version 1.0 contains a SQL injection flaw in the Basic Organizational Structure Module, specifically in depart_add_bg.php, where the Name parameter is used unsafely in database queries.
A remote attacker can manipulate this parameter to inject crafted SQL, potentially accessing, modifying, or deleting backend data.
Affected context
The vulnerability appears in the FeMiner WMS web interface within the Basic Organizational Structure Module, handled by /wms-master/src/basic/depart/depart_add_bg.php.
It affects deployments where user-supplied input in the Name argument is passed to the underlying database layer without robust input handling, parameterization, or output encoding.
The issue is most relevant when the application is exposed over a network and linked to a database account with broad privileges on application data.
Exploit preconditions
- Attack surface: HTTP endpoint exposed by the FeMiner WMS application, specifically requests that reach
depart_add_bg.php. - Required access: Ability to send crafted requests to the application (typically unauthenticated or low-privileged web access, depending on how the module is protected).
- Trigger point: Server-side processing of the
Nameparameter when constructing SQL statements for department or organizational structure operations. - Why exploitation is possible: The value of
Nameis incorporated into SQL queries without proper parameterization or rigorous sanitization, allowing attacker-controlled SQL fragments to alter the intended query structure.
Why this happens
This issue stems from dynamically constructing SQL statements by concatenating or interpolating the Name parameter directly into query strings.
When user input is treated as part of the query logic rather than as a data parameter, the database engine interprets attacker-controlled content as SQL syntax.
This behavior aligns with CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), and is closely related to CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component, because the web layer fails to neutralize special characters before passing data to the database.
The lack of prepared statements, binding, or centralized input validation routines allows the bug pattern to persist across the application's data access paths.
Potential impact
- Access to sensitive data stored in the WMS database (such as user records, organizational information, or operational data).
- Modification or deletion of organizational structure records and related business data.
- Bypassing of application-level authentication or authorization checks by manipulating backend queries.
- Disruption of application functionality through forced errors or destructive queries, potentially impacting availability.
- Establishment of a foothold for further attacks, such as extracting configuration data or chaining with other vulnerabilities.
General mitigation guidance
Effective mitigation focuses on eliminating direct string-based query construction and enforcing strong separation between data and SQL logic:
- Adopt parameterized queries or prepared statements across all data access layers so that user input is always treated as data, not executable SQL.
- Introduce a centralized input validation layer for fields like
Name, constraining allowed characters and length to what is strictly necessary for business use. - Apply strict least-privilege principles to database accounts used by the application, granting only required operations on a minimal set of tables.
- Use a database abstraction or ORM layer configured to default to safe query-building patterns and discourage raw, concatenated SQL.
- Incorporate contextual output encoding or escaping when data must be embedded into downstream components that interpret structured input (e.g., SQL, XML, JSON).
How teams detect issues like this
Several complementary approaches can help detect this vulnerability class:
- Static analysis: Configure rules to flag any SQL construction that concatenates user-controlled variables (such as
$_GET,$_POST, or request handlers) into query strings, especially in files likedepart_add_bg.php. - Code review: During manual review, trace the flow of the
Nameparameter from HTTP handlers to the database layer and look for missing parameter binding, validation, or encoding. - Dynamic testing: Use automated or manual testing tools that send injection patterns (e.g., quote characters, boolean conditions, or time-based probes) to the
Nameparameter and monitor for anomalous responses, errors, or timing differences. - Security policy enforcement: Integrate pre-commit or CI checks that disallow raw SQL concatenation in critical modules and require the use of approved database access APIs or query builders.

