Summary
Oinone Pamirs up to 7.2.0 contains a SQL injection vulnerability in the RSQLToSQLNodeConnector.makeVariable function used by the queryListByWrapper interface.
Remote attackers who can influence query wrapper input may inject crafted values that alter the resulting SQL, potentially leading to data access, modification, or corruption.
Affected context
This vulnerability occurs in Oinone Pamirs deployments that expose the queryListByWrapper interface and pass user-controllable data into the RSQLToSQLNodeConnector.makeVariable function.
It becomes risky when request parameters, filter expressions, or other external inputs are translated into SQL fragments without strict validation, escaping, or parameterization.
The issue is more severe in environments where the application's database account has broad read/write privileges or access to sensitive business data.
Exploit preconditions
- Attack surface: Remote, via the
queryListByWrapperinterface or any API/endpoint that internally usesRSQLToSQLNodeConnector.makeVariable. - Required access: Ability to send requests that influence query wrapper parameters (e.g., filters, search criteria, or dynamic query conditions).
- Trigger point: Construction of SQL statements where the function interpolates or concatenates untrusted values into query text.
- Why exploitation is possible: The implementation does not consistently use parameterized queries or robust escaping, allowing attacker-controlled values to break out of intended query structure and inject arbitrary SQL fragments.
Why this happens
The root cause aligns with CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') and CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component.
The RSQLToSQLNodeConnector.makeVariable function appears to transform RSQL or wrapper-based filter expressions into raw SQL segments by concatenating or formatting untrusted input directly into SQL strings.
Because this layer is responsible for bridging a query DSL/wrapper to concrete SQL, any lack of strict parameterization or sanitization turns expressive filter input into a vehicle for injecting control characters, operators, or additional clauses.
Conceptually, this is an anti-pattern where the query-building layer treats input as trusted structure rather than untrusted data, allowing user-provided content to influence both the data and control flow of the SQL statement.
Potential impact
- Read access to database tables that the application's DB user can query.
- Modification or deletion of records, leading to data loss or integrity violations.
- Creation or alteration of application accounts and authorization data.
- Bypassing of application-level authorization checks via manipulated WHERE clauses.
- Potential execution of database-specific administrative operations, depending on configured privileges.
- Escalation to broader system compromise if chained with database-native features (e.g., xp_cmdshell-like extensions, external procedures, or file read/write capabilities).
General mitigation guidance
For this class of vulnerability, mitigations are most effective when they focus on systematically separating data from query structure and limiting trust in any dynamic query inputs:
- Prefer parameterized queries (prepared statements, bound parameters) at every layer where SQL commands are constructed.
- Use a safe query builder or ORM abstraction that encodes parameters separately from SQL syntax and avoids concatenating raw text.
- Treat the RSQL / wrapper layer as untrusted input: enforce a strict schema or whitelist of allowed fields, operators, and value formats before translating to SQL.
- Normalize and validate inputs against expected types (e.g., integers, enums, bounded lengths) and reject or constrain anything outside defined patterns.
- Limit the database account used by the application to least-privilege capabilities: only the tables and operations necessary for normal behavior.
- Centralize query-generation utilities to make it easier to apply consistent safeguards and conduct targeted security reviews of SQL construction logic.
How teams detect issues like this
Detection typically combines code-focused and behavior-focused approaches:
- Static analysis: Configure rules to flag direct string concatenation or formatting that combines SQL keywords or operators with externally derived values; highlight the
RSQLToSQLNodeConnector.makeVariableand similar translation functions as high-risk hotspots. - Code review: Examine query-wrapper and DSL-to-SQL conversion layers for instances where input is treated as a fragment of SQL rather than as a bound parameter; look for custom parsing logic that bypasses ORM or prepared statement mechanisms.
- Dynamic testing: Use automated or manual penetration testing tools to send crafted RSQL or filter expressions and observe whether error messages, timing, or response content indicate SQL injection behavior.
- Database monitoring: Enable logging of executed queries and alert on unusual patterns such as concatenated literals, stacked statements (where supported), tautological conditions, or unexpected schema references.
- Policy enforcement: Integrate secure coding guidelines and automated checks into CI/CD pipelines to prevent new query-building code from using ad-hoc string concatenation.

