/

CVE-2025-66944

Severity:

CRITICAL RISK

(9.8)

SQL Injection in vran-dev databaseir Search API Endpoint

CVE-2025-66944

Analyzed

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Database Compromise and Potential Remote Code Execution

Severity:

CRITICAL RISK

(9.8)

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

A SQL injection flaw in the vran-dev databaseir search API allows untrusted input in the query parameter to be incorporated directly into SQL statements.

A remote attacker can craft malicious search requests that manipulate database queries and potentially execute arbitrary code on the underlying system when certain database features or integrations are present.

Affected context

This vulnerability affects applications using vran-dev databaseir version 1.0.7 and earlier where the search API endpoint:

  • Accepts a query parameter from remote clients
  • Constructs SQL statements dynamically using this parameter
  • Executes those SQL statements against a backend database without strict parameterization

It becomes most risky in environments where the database account has broad privileges, stored procedures, or extensions that can be abused for code execution.

Exploit preconditions

  • Attack surface: Public or internal HTTP(S) interface exposing the search API endpoint.
  • Required access: Network access to the API; no special privileges are inherently required if the endpoint is anonymously accessible.
  • Trigger point: Supplying crafted input in the query parameter of the search endpoint that is concatenated into SQL.
  • Why exploitation is possible: User-controlled data is embedded directly into SQL statements without parameter binding or rigorous sanitization, enabling attackers to alter query structure rather than just data values.

Why this happens

The core issue maps to CWE-89: SQL Injection, where the application constructs SQL commands by concatenating user input into query strings.

Instead of using prepared statements or parameterized queries, the search endpoint appears to interpolate the query parameter directly into the SQL, allowing the input to introduce additional clauses, operators, or statements.

This insecure pattern treats user data as part of the SQL language, breaking the intended separation between code and data and giving attackers control over the database interpreter.

Potential impact

  • Unauthorized reading of database records, including sensitive or confidential data
  • Modification or deletion of data, causing integrity loss or application downtime
  • Creation or escalation of application accounts or roles stored in the database
  • Extraction of system metadata, schema information, and configuration details
  • Potential execution of arbitrary code on the database host when exploitable database features, functions, or integrations are available
  • Use of the compromised database as a pivot point to attack other internal systems

General mitigation guidance

Effective mitigation focuses on preventing user input from influencing SQL structure and minimizing the blast radius if a flaw occurs:

  • Prefer parameterized queries or prepared statements for all database interactions, especially search functionality.
  • Avoid building SQL via string concatenation or interpolation with user-supplied values, including column names, operators, or sort expressions.
  • Apply strict input validation and whitelisting for search parameters, limiting allowed characters, operators, and query patterns to business needs.
  • Use least-privilege database accounts so that the application cannot perform administrative actions or access unrelated schemas.
  • Implement layered defenses such as web application firewalls or API gateways with rules tuned to detect and block SQL injection patterns.
  • Centralize database access through vetted helper libraries or ORM layers configured to enforce safe query construction by default.

How teams detect issues like this

Detection typically combines code-centric and runtime approaches:

  • Static analysis: Configure SAST rules to detect dynamic SQL construction patterns (string concatenation, format functions) that incorporate HTTP parameters or request bodies.
  • Code review: Flag endpoints that accept search-like input and manually verify that they rely on parameter binding and strict whitelisting rather than raw query assembly.
  • Database monitoring: Enable logging of SQL statements and watch for anomalous patterns (tautologies, UNION SELECT chains, stacked queries, or calls to sensitive functions).
  • Runtime protections: Use WAF, RASP, or API security tools to detect common injection payloads and block suspicious requests targeting the search endpoint.
  • Security tests: Incorporate automated DAST or security regression tests that probe search functionality with injection probes to catch regressions early.

Sources

SourceLink
github.comgithub.com/vran-dev/databasir/issues/283
zeroday.endlessparadox.comzeroday.endlessparadox.com/posts/cve-2025-66944/

Frequently asked

questions

Yes. As described, a remote attacker with network access to the search API endpoint can attempt to exploit the SQL injection by sending crafted query parameters.

That depends on deployment. If the search endpoint is publicly accessible without login, no authentication is required. If it is behind an authentication layer, an attacker would first need valid credentials or to compromise an account.

Refactor the search endpoint to use parameterized queries or prepared statements exclusively, eliminating string concatenation of user input into SQL. Combine this with strict input validation and least-privilege database accounts.

Adopt a development standard that forbids dynamic SQL string building with user input, enforce this via code review and static analysis, centralize database access through safe abstractions, and include regular security testing of query-building endpoints in your CI/CD pipeline.

Find out what's already
exploitable in your codebase.