Summary
A SQL injection vulnerability in the MRI feedback popup window of the LORIS imaging browser allows crafted input to be incorporated directly into database queries.
If an attacker can submit malicious data through the affected MRI feedback functionality, they may be able to access, modify, or corrupt research data stored on the LORIS server.
Affected context
This vulnerability occurs within the MRI feedback popup window in the LORIS imaging browser, where user-supplied values are used to construct SQL queries.
It becomes relevant in deployments where:
- The LORIS web interface is exposed to internal or external users,
- The MRI feedback feature is accessible, and
- Input from that feature flows into database operations without sufficient parameterization or sanitization.
The database backing LORIS typically contains sensitive neuroimaging and research-related metadata, increasing the potential impact of injection flaws.
Exploit preconditions
- Attack surface: Web-based HTTP(S) endpoints associated with the MRI feedback popup in the LORIS imaging browser.
- Required access: Ability to interact with the affected web interface (e.g., valid LORIS user account or any role permitted to access MRI feedback features, depending on site configuration).
- Trigger point: Submission of crafted form fields, query parameters, or other inputs that are incorporated into SQL statements for MRI feedback handling.
- Why exploitation is possible: The application constructs SQL queries using untrusted input without consistently using parameterized statements or robust input validation, allowing attackers to inject or manipulate SQL fragments executed by the database.
Why this happens
The underlying bug aligns with CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
In affected LORIS code paths, user-controlled data from the MRI feedback popup is merged into SQL queries in a way that does not reliably neutralize special characters such as quotes, delimiters, or operators.
Instead of using prepared statements or a query builder that separates code from data, the logic appears to rely on string concatenation or insufficient sanitization.
This insecure pattern allows attackers to alter the intended structure of SQL commands, enabling unanticipated operations like bypassing filters, accessing unauthorized rows, or modifying stored data.
Potential impact
- Attackers may read sensitive research or imaging-related data beyond their authorized scope.
- Malicious users could modify or delete MRI feedback records or other related database entries.
- Data integrity of neuroimaging studies and associated metadata can be compromised or corrupted.
- Application behavior might be altered, including potential escalation of logical permissions via manipulated queries.
- In certain configurations, attackers could potentially pivot to other tables within the same database instance.
General mitigation guidance
Effective mitigation focuses on eliminating direct injection opportunities and reducing the trust placed in user input:
- Adopt parameterized queries (prepared statements) or ORM-level abstractions for all database access, especially in the MRI feedback and imaging browser code paths.
- Avoid dynamic SQL string concatenation; where dynamic behavior is required, restrict it to whitelisted, server-controlled values.
- Apply strict validation on all inputs reaching database operations, enforcing expected types, ranges, and formats instead of filtering known-bad characters.
- Implement least-privilege database accounts so the web application only has the minimal permissions required for normal operation, limiting blast radius if injection occurs.
- Centralize query construction patterns and coding guidelines so new features default to safe database access methods.
How teams detect issues like this
Organizations can look for this and similar issues using a combination of automated and manual techniques:
- Static analysis: Configure SAST rules that flag SQL query construction using string concatenation or interpolation with user-controlled variables in PHP or other languages used by LORIS.
- Code review: During peer review, examine MRI feedback and imaging browser modules for direct SQL strings, inline query fragments, or conditional SQL building without prepared statements.
- Dynamic testing: Use parameter fuzzing and automated web scanners configured to test form fields and query parameters for SQL injection behavior, focusing on the MRI feedback popup workflow.
- Runtime monitoring: Enable database and application logging to capture anomalous query patterns, such as unexpected UNIONs, comment markers, or syntax errors indicative of injection attempts.
- Policy enforcement: Establish coding standards that require prepared statements and vet any exception via security review, optionally enforced via CI hooks or linters.

