/

CVE-2026-42550

Severity:

HIGH RISK

(8.8)

SQL Injection in Flight SimplePdo Helpers

CVE-2026-42550

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Arbitrary SQL Execution / 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

Flight's SimplePdo helper methods insert(), update(), and delete() construct SQL statements by directly concatenating table names and array keys without quoting or validation.

When applications pass user-shaped data arrays into these helpers, attackers can craft malicious array keys to inject arbitrary SQL, leading to data compromise or remote impact under typical web application conditions.

Affected context

This vulnerability affects PHP applications using the Flight framework's SimplePdo::insert(), SimplePdo::update(), or SimplePdo::delete() helpers as a generic persistence layer.

It becomes relevant when:

  • The $table argument is derived from or influenced by external input, or
  • The $data array shape (keys) comes directly from user-controlled sources such as HTTP request bodies (for example, $db->insert('users', $request->data->getData())), and
  • The application assumes SimplePdo will safely handle column names and structures.

In such setups, SQL statements are assembled by concatenating untrusted identifiers into the query string without quoting or structural checks.

Exploit preconditions

  • Attack surface: Application endpoints that use SimplePdo::insert(), ::update(), or ::delete() with request-derived arrays or flexible data shapes.
  • Required access: Ability to send crafted HTTP requests or otherwise supply arbitrary key/value pairs that flow into the $data array used in these methods.
  • Trigger point: Execution of a SimplePdo helper that interpolates $table and the keys of $data directly into an SQL statement.
  • Why exploitation is possible: The code treats array keys as trusted SQL identifiers and concatenates them into the query without quoting, escaping, or validating allowed column names, enabling attacker-controlled fragments to alter the SQL structure.

Why this happens

The underlying bug is a classic SQL Injection issue (CWE-89) caused by string-building of SQL statements with untrusted input in identifier positions.

Instead of using a fixed, validated set of column names and proper identifier quoting, SimplePdo constructs parts of the SQL by concatenating:

  • The $table parameter, and
  • The keys of the $data array

directly into the query template.

This pattern conflates application data shape with database schema and assumes that keys represent safe column names.

Without enforcing a whitelist of allowed identifiers or applying safe quoting/escaping rules, an attacker can craft array keys that break out of the expected identifier context and inject arbitrary SQL segments.

Potential impact

  • Attackers could read sensitive data by injecting additional SELECT clauses or modifying WHERE conditions.
  • Attackers could modify or delete data in arbitrary tables, leading to data tampering or loss.
  • Attackers could create or drop tables, impacting schema integrity and application availability.
  • In environments where the database supports dangerous functions or extended capabilities, attackers may achieve further compromise, such as code execution through database-level primitives.

General mitigation guidance

Effective mitigation focuses on separating untrusted input from SQL structure and strictly controlling identifiers:

  • Constrain table and column names to known, hard-coded values or schema-derived whitelists rather than accepting arbitrary keys from user input.
  • Apply proper identifier quoting or escaping mechanisms offered by the underlying database driver, instead of concatenating raw identifier strings.
  • Use parameterized queries for all dynamic values; while this vulnerability is primarily about identifiers, consistently using prepared statements helps clarify the separation between structure and data.
  • Introduce application-level DTOs or validation layers that normalize and validate incoming request data before it is passed to persistence helpers, ensuring only recognized fields are persisted.
  • Run databases with least-privilege accounts so that, even in the presence of SQL injection, the range of operations (e.g., DDL, cross-database access) is minimized.

How teams detect issues like this

Detection can leverage both code-centric and behavior-centric approaches:

  • Static analysis: Configure rules to flag SQL construction patterns where variable table names or array keys are concatenated into query strings, especially around helper methods like insert(), update(), and delete().
  • Code review: Look for data access layers that accept arbitrary associative arrays from controllers or request objects and directly build SQL without mapping keys to known entity fields.
  • Logging and monitoring: Enable detailed database logging (e.g., query logs or audit logs) to spot anomalous SQL statements with unexpected identifiers or syntax fragments originating from user-controllable endpoints.
  • Security tests: Incorporate automated tests and DAST tools that inject malformed identifiers and unconventional keys into JSON bodies or form submissions to detect SQL behavior changes or errors at integration time.

Sources

SourceLink
github.comgithub.com/flightphp/core/security/advisories/GHSA-xwqr-rcqg-22mr

Frequently asked

questions

Yes, it is typically remotely exploitable wherever a web-facing endpoint forwards request-derived data arrays into SimplePdo::insert(), ::update(), or ::delete() without constraining or validating the keys.

An attacker needs the ability to supply arbitrary keys in data structures that reach these helper methods, such as JSON object fields, form parameters, or other request content that is converted into associative arrays.

The safest pattern is to decouple untrusted data from SQL structure: restrict table and column names to predefined sets, map external input to known fields explicitly, and ensure that all SQL is built from trusted identifiers combined with parameterized values rather than concatenated user-controlled keys.

Adopt a defensive data access design where:

  • All SQL is either generated by an ORM or uses prepared statements with strict identifier whitelisting.
  • Data transfer objects or schema validators define exactly which fields are accepted from clients.
  • Code review and static analysis enforce a policy of "no raw SQL string concatenation with user input," including in identifier positions.
Find out what's already
exploitable in your codebase.