/

CVE-2026-52758

Severity:

HIGH RISK

(8.8)

SQL Injection (CWE-89) in Ghidra BSim Filter Queries

CVE-2026-52758

Analyzed

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Arbitrary SQL Execution and Data Compromise

Severity:

HIGH RISK

(8.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

Ghidra's BSim component performs unsafe string concatenation of user-controlled filter values into SQL queries without proper parameterization.

An attacker who can send crafted BSim network queries may inject arbitrary SQL, potentially reading, modifying, or deleting data in the backing PostgreSQL database.

Affected context

The vulnerability occurs in Ghidra deployments that use BSim with a PostgreSQL backend and accept BSim network queries from external clients.

It is most relevant where BSim servers are reachable over a network and process user-supplied filter criteria that are directly incorporated into SQL.

Environments that expose BSim services beyond tightly controlled internal networks are more likely to be at risk.

Exploit preconditions

  • Attack surface: BSim network query protocol endpoint backed by PostgreSQL
  • Required access: Ability to connect to the BSim service and submit filter values (e.g., as an authenticated or unauthenticated BSim client, depending on configuration)
  • Trigger point: Execution of SQL statements that embed user-supplied filter types or values via string concatenation
  • Why exploitation is possible: The query construction logic does not use parameterized statements or robust escaping, allowing user input to alter the SQL structure instead of being treated as data

Why this happens

The bug is rooted in constructing SQL queries by concatenating raw user input into query strings instead of using prepared statements with bound parameters.

This pattern maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where meta-characters such as quotes and delimiters are not neutralized before being sent to the database.

As a result, the database interprets attacker-controlled fragments as part of the executable query, enabling arbitrary SQL operations within the privileges of the BSim database account.

Potential impact

  • Read sensitive data stored in the BSim PostgreSQL database
  • Modify or delete existing records, including analysis metadata and similarity indexes
  • Insert crafted data that can skew similarity results or mislead analysts
  • Potentially escalate impact by abusing database-level features accessible to the BSim account

General mitigation guidance

Effective mitigation focuses on eliminating direct string concatenation in SQL construction and tightening trust boundaries around BSim inputs.

Common defensive patterns include:

  • Refactoring query builders to use parameterized queries or prepared statements for all user-controlled fields
  • Applying strict whitelisting and validation to filter types and values, constraining them to known-safe sets or formats
  • Limiting the database privileges of the BSim service account to the minimum required for normal operation
  • Restricting network exposure of BSim services, placing them behind authenticated, internal-only access where possible

How teams detect issues like this

Detection typically combines code-level and runtime observations:

  • Static analysis rules that flag SQL string concatenation patterns involving BSim filter inputs
  • Manual code review focused on query-building utilities, ensuring that all dynamic fields are bound parameters
  • Database logging and monitoring for anomalous or syntactically unusual queries originating from the BSim service
  • Integration of automated secure-coding checks into CI pipelines to prevent reintroduction of direct SQL concatenation

Sources

SourceLink
github.comgithub.com/NationalSecurityAgency/ghidra/security/advisories/GHSA-8r4f-65cr-fwxm
vulncheck.comvulncheck.com/advisories/ghidra-sql-injection-via-unescaped-filter-values-in-bsim-search

Frequently asked

questions

Yes, if the BSim service is network-accessible to the attacker, they can send crafted BSim queries to exploit the SQL injection without local access to the host.

The attacker must be able to reach the BSim network endpoint and submit filter parameters. Whether this requires authentication depends on how the service is deployed and configured.

Replace all query construction that uses concatenated strings with parameterized queries, and enforce strict validation or whitelisting on any values used in WHERE clauses or filters.

Adopt a coding standard that mandates prepared statements for all database access, use automated checks to block unsafe query patterns in code review and CI, and regularly audit database-facing components for direct string-based query building.

Find out what's already
exploitable in your codebase.