/

CVE-2025-50455

Severity:

CRITICAL RISK

(9.1)

SQL Injection (CWE-89) in EasyAppointments search API

CVE-2025-50455

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Remote Code Execution and Data Exfiltration

Severity:

CRITICAL RISK

(9.1)

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 order_by parameter of the /customers/search endpoint in EasyAppointments allows attackers to inject arbitrary SQL into queries built by CodeIgniter's Query Builder.

When exposed to untrusted clients, this can enable time-based data extraction, schema enumeration, and, under some MySQL configurations, remote code execution via INTO OUTFILE to drop a PHP web shell.

A SQL injection flaw in the order_by parameter of the /customers/search endpoint in EasyAppointments allows attackers to inject arbitrary SQL into queries built by CodeIgniter's Query Builder.

When exposed to untrusted clients, this can enable time-based data extraction, schema enumeration, and, under some MySQL configurations, remote code execution via INTO OUTFILE to drop a PHP web shell.

Affected context

The vulnerability appears in EasyAppointments deployments that expose the /customers/search endpoint to users or integrated systems and rely on user-supplied order_by values to dynamically build SQL queries.

It is most relevant when:

  • The application runs on MySQL or MariaDB with file write capabilities from SQL (e.g., permissive secure_file_priv)
  • The database user has privileges to use INTO OUTFILE or similar features
  • Input validation or parameterization is not enforced on the order_by field before passing it to the Query Builder

The vulnerability appears in EasyAppointments deployments that expose the /customers/search endpoint to users or integrated systems and rely on user-supplied order_by values to dynamically build SQL queries.

It is most relevant when:

  • The application runs on MySQL or MariaDB with file write capabilities from SQL (e.g., permissive secure_file_priv)
  • The database user has privileges to use INTO OUTFILE or similar features
  • Input validation or parameterization is not enforced on the order_by field before passing it to the Query Builder

Exploit preconditions

  • Attack surface: HTTP interface via the /customers/search endpoint.
  • Required access: Ability to send crafted requests with a controlled order_by parameter (usually unauthenticated or low-privilege authenticated access).
  • Trigger point: Query construction inside the CodeIgniter Query Builder where order_by is directly concatenated into SQL.
  • Why exploitation is possible: The order_by parameter is treated as trusted SQL syntax instead of a constrained field list, allowing injection of arbitrary SQL fragments, including time-based conditions and file-writing primitives.
  • Attack surface: HTTP interface via the /customers/search endpoint.
  • Required access: Ability to send crafted requests with a controlled order_by parameter (usually unauthenticated or low-privilege authenticated access).
  • Trigger point: Query construction inside the CodeIgniter Query Builder where order_by is directly concatenated into SQL.
  • Why exploitation is possible: The order_by parameter is treated as trusted SQL syntax instead of a constrained field list, allowing injection of arbitrary SQL fragments, including time-based conditions and file-writing primitives.

Why this happens

This issue stems from a failure to treat user-controlled input as untrusted when constructing SQL queries.

The order_by parameter is passed directly into the CodeIgniter Query Builder's order_by method without whitelisting or parameterization, enabling attackers to escape the intended ordering clause and inject new SQL syntax.

Conceptually, this maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command (SQL Injection), where application code assembles SQL strings using unsanitized user input instead of using strict column whitelists or prepared statements.

This issue stems from a failure to treat user-controlled input as untrusted when constructing SQL queries.

The order_by parameter is passed directly into the CodeIgniter Query Builder's order_by method without whitelisting or parameterization, enabling attackers to escape the intended ordering clause and inject new SQL syntax.

Conceptually, this maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command (SQL Injection), where application code assembles SQL strings using unsanitized user input instead of using strict column whitelists or prepared statements.

Potential impact

  • Attackers may extract or enumerate customer records and related application data.
  • Attackers could perform time-based blind SQL injection to infer database contents without direct error messages.
  • Attackers may discover database schema, tables, and columns for further exploitation.
  • Under permissive MySQL configurations, attackers can write arbitrary PHP files (web shells) via INTO OUTFILE, potentially achieving remote code execution on the application server.
  • Compromise of application integrity and confidentiality, including possible lateral movement from the database to the underlying host.
  • Attackers may extract or enumerate customer records and related application data.
  • Attackers could perform time-based blind SQL injection to infer database contents without direct error messages.
  • Attackers may discover database schema, tables, and columns for further exploitation.
  • Under permissive MySQL configurations, attackers can write arbitrary PHP files (web shells) via INTO OUTFILE, potentially achieving remote code execution on the application server.
  • Compromise of application integrity and confidentiality, including possible lateral movement from the database to the underlying host.

General mitigation guidance

Effective mitigation focuses on eliminating the use of raw, user-controlled values in SQL construction and narrowing trust boundaries around query parameters.

Common defensive patterns include:

  • Restricting order_by to a predefined, server-side whitelist of sortable columns and directions, ignoring any unexpected values.
  • Using parameterized queries or ORM methods that separate SQL structure from data, even for ordering and filtering.
  • Implementing centralized validation routines for query-related parameters (sorting, filtering, pagination) that enforce strict syntax and allowed values.
  • Reducing database account privileges so that file-writing operations (e.g., INTO OUTFILE) and other dangerous commands are not available to application users.
  • Applying defense-in-depth controls, such as web application firewalls, to detect and block obvious SQL injection patterns while underlying code is being hardened.

Effective mitigation focuses on eliminating the use of raw, user-controlled values in SQL construction and narrowing trust boundaries around query parameters.

Common defensive patterns include:

  • Restricting order_by to a predefined, server-side whitelist of sortable columns and directions, ignoring any unexpected values.
  • Using parameterized queries or ORM methods that separate SQL structure from data, even for ordering and filtering.
  • Implementing centralized validation routines for query-related parameters (sorting, filtering, pagination) that enforce strict syntax and allowed values.
  • Reducing database account privileges so that file-writing operations (e.g., INTO OUTFILE) and other dangerous commands are not available to application users.
  • Applying defense-in-depth controls, such as web application firewalls, to detect and block obvious SQL injection patterns while underlying code is being hardened.

How teams detect issues like this

Organizations can look for this class of issue by combining automated analysis and targeted review of query-building logic.

Useful approaches include:

  • Static analysis rules that flag dynamic SQL construction where input variables are incorporated into ORDER BY, GROUP BY, or raw query fragments without whitelisting.
  • Code review checks focused on search and list endpoints, ensuring that sortable fields come from enumerated server-side lists instead of direct client parameters.
  • Logging and monitoring of database activity for anomalous queries, such as repeated time-based functions, schema introspection (information_schema), or use of INTO OUTFILE.
  • Security review policies that require validation and normalization of request parameters used in query builders, enforced via coding standards and CI checks.

Organizations can look for this class of issue by combining automated analysis and targeted review of query-building logic.

Useful approaches include:

  • Static analysis rules that flag dynamic SQL construction where input variables are incorporated into ORDER BY, GROUP BY, or raw query fragments without whitelisting.
  • Code review checks focused on search and list endpoints, ensuring that sortable fields come from enumerated server-side lists instead of direct client parameters.
  • Logging and monitoring of database activity for anomalous queries, such as repeated time-based functions, schema introspection (information_schema), or use of INTO OUTFILE.
  • Security review policies that require validation and normalization of request parameters used in query builders, enforced via coding standards and CI checks.

Sources

SourceLink
github.comgithub.com/threatlance-org/security-advisories/blob/main/CVE-2025-50455/advisory.md
github.comgithub.com/threatlance-org/security-advisories/blob/main/CVE-2025-50455/poc.py
linkedin.comlinkedin.com/posts/michael-chesang_cve-securityadvisory-appsec-activity-7360754900827365376-Z-IY

Frequently asked

questions

It can be exploited wherever the /customers/search endpoint is reachable and the order_by parameter is controllable by an attacker, which often includes external users or integrated systems in typical deployments.

Not necessarily. If the endpoint is accessible without strong authentication, low-privilege or unauthenticated users may be able to exploit it. The main requirement is the ability to influence the order_by parameter.

The most robust fix is to avoid passing raw client input into query structure. Instead, implement a strict whitelist of allowed sort fields and directions, and use parameterized queries or ORM abstractions that prevent arbitrary SQL fragments from being injected.

Consistently treat all user-supplied query parameters as untrusted, enforce centralized validation and whitelisting for sorting and filtering, adopt parameterized query patterns throughout the codebase, and include automated checks and security-focused code reviews for any dynamic query logic.

It can be exploited wherever the /customers/search endpoint is reachable and the order_by parameter is controllable by an attacker, which often includes external users or integrated systems in typical deployments.

Not necessarily. If the endpoint is accessible without strong authentication, low-privilege or unauthenticated users may be able to exploit it. The main requirement is the ability to influence the order_by parameter.

The most robust fix is to avoid passing raw client input into query structure. Instead, implement a strict whitelist of allowed sort fields and directions, and use parameterized queries or ORM abstractions that prevent arbitrary SQL fragments from being injected.

Consistently treat all user-supplied query parameters as untrusted, enforce centralized validation and whitelisting for sorting and filtering, adopt parameterized query patterns throughout the codebase, and include automated checks and security-focused code reviews for any dynamic query logic.

Find out what's already
exploitable in your codebase.