Summary
LogicalDOC Enterprise up to and including version 9.1.1 contains a blind SQL injection flaw in the ComparisonServlet component, where user-supplied data is incorporated into SQL queries without adequate sanitization.
An authenticated attacker who can reach this servlet may manipulate database queries through crafted input, potentially leading to data exposure, modification, or application-level compromise under typical deployment conditions.
Affected context
This vulnerability occurs in LogicalDOC Enterprise deployments that expose the ComparisonServlet to authenticated users and build SQL statements using request parameters.
It is most relevant when the application connects to a relational database with broad privileges and when the servlet's inputs are not strictly validated or parameterized.
Multi-tenant or internet-facing installations with shared database instances are particularly sensitive, as successful injection may affect multiple document repositories.
Exploit preconditions
- Attack surface: HTTP(S) requests reaching the ComparisonServlet in LogicalDOC Enterprise.
- Required access: Valid authenticated user session with permission to invoke the comparison functionality.
- Trigger point: Submission of specially crafted parameters that the servlet uses in dynamically constructed SQL queries.
- Why exploitation is possible: User-controlled input is concatenated into SQL statements or bound in an unsafe way, without strict parameterization or normalization, enabling the attacker to alter query logic in a blind (response-based or time-based) manner.
Why this happens
The underlying bug falls under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
The ComparisonServlet likely constructs SQL queries using string concatenation or weak interpolation, directly embedding request parameters into the query.
Because these inputs are not consistently validated, escaped, or bound as typed parameters, the database interprets attacker-supplied tokens (such as operators or subqueries) as part of the SQL syntax rather than data.
This insecure pattern allows the attacker to influence the query's WHERE conditions, join logic, or returned columns, even though the injection is "blind" and results must be inferred indirectly from application behavior.
Potential impact
- Authenticated attackers may retrieve additional rows or metadata they should not normally see.
- Attackers could modify or delete records, including document metadata and access control information.
- The compromised queries can manipulate application logic that depends on database responses.
- Under permissive database privileges, attackers might pivot to broader schema enumeration or data exfiltration.
- Data integrity could be undermined, affecting audit trails, search indexes, or document relationships.
General mitigation guidance
Effective mitigation focuses on eliminating dynamic query construction paths and enforcing strict separation between data and SQL syntax.
Common defensive patterns include:
- Refactoring the ComparisonServlet to rely exclusively on parameterized queries or ORM query builders that encode parameters safely.
- Using typed bind variables instead of concatenating strings from HTTP parameters into SQL commands.
- Applying rigorous input validation and canonicalization to all comparison-related parameters, constraining them to expected formats (e.g., fixed enums, numeric IDs).
- Limiting database accounts used by the application to least-privilege roles, reducing the blast radius if a query is abused.
- Centralizing data access patterns so that SQL construction is audited and consistent across servlets and controllers.
How teams detect issues like this
Detection usually combines code-level inspection with behavioral testing of the application.
Representative approaches include:
- Static analysis rules that flag string concatenation or dynamic SQL building driven by HTTP parameters in Java servlets and service layers.
- Targeted code reviews of the ComparisonServlet and related DAO classes, looking for manual query assembly and missing parameter binding.
- Runtime security testing (DAST) that sends crafted comparison parameters and monitors for response variations, timing differences, or database errors indicative of blind injection.
- Implementing internal security policies that prohibit ad-hoc SQL construction in web controllers and require the use of vetted data-access libraries.
- Using automated tooling in CI pipelines to enforce query-building patterns and catch newly introduced injection risks.

