/

CVE-2026-82527

Severity:

HIGH RISK

(7.5)

SQL Injection (CWE-89) in R2R Retrieval Search API

CVE-2026-82527

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Unauthorized database access and data exfiltration

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

R2R through version 3.6.6 contains a SQL injection vulnerability in the retrieval search endpoint. An unauthenticated attacker may manipulate the filter key parameter to inject SQL predicates, potentially enabling boolean-based or time-based extraction of database information.

Affected context

The vulnerability occurs in R2R retrieval searches when the endpoint accepts attacker-controlled filter keys and incorporates them into the chunks search query. Deployments are at risk where the endpoint is reachable by unauthenticated users and the application directly interpolates filter keys into a SQL WHERE clause without parameterization, escaping, or an equivalent allowlist.

Exploit preconditions

  • Attack surface: The retrieval search endpoint that queries chunks
  • Required access: Network access to the endpoint; authentication is not required according to the vulnerability description
  • Trigger point: Processing the filter key parameter during construction of the search query
  • Why exploitation is possible: User-controlled filter keys are inserted into SQL syntax without safe parameter binding or strict identifier validation

Why this happens

The underlying bug is SQL injection caused by treating a request-controlled filter key as trusted SQL syntax. Directly interpolating dynamic identifiers or predicates into a WHERE clause allows input to alter query logic rather than remain a data value. This behavior maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command, because application input is not adequately separated from executable database syntax.

Potential impact

  • An attacker may infer database values through boolean-based responses
  • An attacker could extract information using timing behavior
  • Sensitive application or retrieval data may be exposed
  • Database integrity or availability could be affected, depending on query privileges
  • Compromised data may support follow-on attacks against connected services

General mitigation guidance

Mitigation generally focuses on separating user input from SQL syntax and reducing the trust placed in dynamic query components.

Common defensive patterns include:

  • Using parameterized queries for all user-controlled values
  • Restricting dynamic filter keys to a documented, fixed allowlist of valid fields
  • Mapping external field names to server-defined database expressions rather than inserting them directly
  • Applying strict input validation and rejecting unexpected operators or structural content
  • Limiting the database account to the minimum read and write privileges required
  • Avoiding detailed query errors and timing differences that disclose database behavior

How teams detect issues like this

Organizations can look for SQL injection risks through:

  • Static analysis rules identifying string interpolation or concatenation in SQL construction
  • Code review checks for request parameters used as column names, predicates, or clauses
  • Dynamic testing that evaluates unexpected filter keys and response or timing differentials
  • Web application firewall or API policy rules restricting unapproved query syntax
  • Database monitoring for anomalous query patterns, repeated conditional probes, and unusual metadata access

Automated security review tools may help identify unsafe query-building patterns, but findings should be validated against the application's query abstraction and authorization model.

Sources

SourceLink
github.comgithub.com/SciPhi-AI/R2R/issues/2308
vulncheck.comvulncheck.com/advisories/r2r-sql-injection-via-retrieval-search-filter-key

Frequently asked

questions

Yes. The described attack surface is an exposed retrieval search endpoint, and exploitation may be possible over the network without an authenticated account.

The attacker needs network access to the affected endpoint and the ability to submit or influence the filter key parameter. The vulnerability description indicates that authentication is not required.

Use parameterized queries for values and server-side allowlists or fixed mappings for dynamic field names and predicates. Do not directly interpolate request-controlled SQL fragments.

Combine secure query APIs, strict schema validation, least-privilege database accounts, code review rules, and automated testing for injection behavior across all search and filtering endpoints.

Find out what's already
exploitable in your codebase.