/

CVE-2026-44331

Severity:

HIGH RISK

(8.1)

SQL Injection in ProFTPD mod_wrap2_sql

CVE-2026-44331

Awaiting Analysis

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

SQL Injection leading to data exposure, modification, or privilege manipulation in the ProFTPD backing database

Severity:

HIGH RISK

(8.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 ProFTPD's mod_wrap2_sql module allows attacker-controlled hostnames from reverse DNS lookups to be interpolated directly into SQL queries without proper escaping.

When UseReverseDNS is enabled, a remote attacker who controls or influences reverse DNS records can inject SQL fragments via crafted domain names, potentially impacting authentication, access control, or logging data depending on the database schema.

Affected context

This vulnerability occurs in ProFTPD deployments using the contrib mod_wrap2_sql module together with UseReverseDNS on.

In this configuration, ProFTPD performs reverse DNS lookups on connecting client IPs and passes the resulting hostname into SQL-based access control or logging queries.

The issue manifests when the attacker can control or influence the reverse DNS entry for their IP address, causing their crafted domain name to be used as part of dynamically constructed SQL statements.

DNS character rules constrain which characters can appear in hostnames, which may limit which SQL dialect features or payload shapes are feasible but does not eliminate the risk.

Exploit preconditions

  • Attack surface: Network-exposed ProFTPD service using mod_wrap2_sql with SQL backends.
  • Required access: Ability to establish a connection to the FTP server from an IP address for which the attacker controls or can influence reverse DNS records (e.g., own IP space, VPS, or misconfigured DNS).
  • Configuration prerequisites:
  • UseReverseDNS on enabled so the server performs reverse DNS lookups.
  • mod_wrap2_sql enabled and configured to use the resolved hostname in SQL queries (for client lookups, rules, or logging).
  • Trigger point: A client connection triggers a reverse DNS lookup; the returned hostname is injected unescaped into an SQL statement within sqltab_fetch_clients_cb() in mod_wrap2_sql.
  • Why exploitation is possible: The code trusts the DNS-derived hostname as benign and interpolates it directly into SQL query strings without parameterization or sanitization, aligning with CWE-89.

Why this happens

The underlying bug is the direct concatenation of attacker-influenced input (the reverse-resolved hostname) into SQL strings in sqltab_fetch_clients_cb() within mod_wrap2_sql.

Instead of using parameterized queries or escaping routines, the hostname is inserted verbatim into the SQL, which allows crafted values to alter the structure or logic of the query.

Reverse DNS data is implicitly treated as trusted configuration or identification data rather than untrusted input, leading to a classic CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').

The design also conflates identity (hostname) with code (SQL expression), violating the principle of strict separation between data and query logic.

Potential impact

  • Extraction of data from tables referenced by mod_wrap2_sql queries, which may include access-control rules or user-related metadata.
  • Manipulation of SQL query outcomes, potentially bypassing or weakening host-based access controls enforced by mod_wrap2_sql.
  • Insertion, modification, or deletion of rows in the associated database, depending on the underlying query and database permissions.
  • Indirect privilege escalation within the FTP environment if database-driven authorization logic is subverted.
  • Denial of service against the ProFTPD instance via crafted inputs that cause SQL errors or resource-intensive queries.

General mitigation guidance

Effective mitigation focuses on treating reverse DNS hostnames as untrusted input and ensuring strict separation between data and SQL logic.

Common defensive patterns include:

  • Using prepared statements with bound parameters for all SQL queries, including those that incorporate hostnames or other network-derived values.
  • Implementing robust server-side input validation and canonicalization for DNS-derived hostnames, restricting them to safe character sets and expected formats before passing them to the database.
  • Designing SQL schemas and queries so that user-controlled strings are only ever used as data values, not as identifiers, operators, or query fragments.
  • Applying the principle of least privilege to the database account used by mod_wrap2_sql, limiting it to only the minimal SELECT/INSERT/UPDATE operations needed.
  • Considering whether reverse DNS is truly needed: where possible, avoiding optional dependencies on DNS-based identity in access-control decisions reduces the attack surface.
  • Centralizing SQL construction in well-reviewed helper routines rather than building queries inline within callback functions that consume network data.

How teams detect issues like this

Detection typically relies on a combination of code-level analysis and runtime monitoring:

  • Static analysis: Configure static analysis rules or linters to flag string-concatenated SQL, especially where arguments originate from network inputs, DNS lookups, or environment variables.
  • Code review: During review of modules like mod_wrap2_sql, treat any use of hostnames, IP addresses, or other connection metadata in SQL queries as high-risk and ensure parameterization is applied consistently.
  • Configuration audits: Periodically audit ProFTPD configurations to identify where UseReverseDNS and SQL-based access control modules are in use; cross-check that their data flows adhere to secure coding practices.
  • Database monitoring: Use database-level logging or monitoring to detect anomalous query patterns, unexpected errors, or unusual use of literals that could indicate attempted SQL injection.
  • Automated tooling: Integrate SAST or configuration scanners in CI pipelines to automatically flag dangerous SQL-building patterns and risky feature combinations (e.g., reverse DNS + SQL modules).

Sources

SourceLink
github.comgithub.com/proftpd/proftpd/commit/766622456440fbca33abd7927c523673a11d1ed1
github.comgithub.com/proftpd/proftpd/issues/2057

Frequently asked

questions

Yes. Any remote client that can connect to a vulnerable ProFTPD instance and control or influence the reverse DNS entry for its source IP can attempt to exploit this issue.

Not necessarily. The vulnerable code path is triggered during the handling of a connection when reverse DNS lookup occurs and the result is used in SQL queries. This can happen before authentication, depending on the configuration of mod_wrap2_sql.

The safest pattern is to refactor all queries that include hostnames or other network-derived values to use parameterized SQL APIs, treating these values strictly as bound parameters, and to apply strict validation on DNS-derived data before it ever reaches the database.

Adopt a policy that any data originating from the network (including DNS, headers, and connection metadata) is untrusted and must be validated and parameterized when used in SQL; enforce this via coding standards, automated static analysis, and focused security review for modules that combine network identity with database access.

Find out what's already
exploitable in your codebase.