Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2026-39879

CVE-2026-39879: syslog-ng SQL Injection Vulnerability

CVE-2026-39879 is a SQL injection vulnerability in syslog-ng caused by missing sanitization in afsql_dd_run_query. This article covers the technical details, affected versions, security impact, and mitigation.

Published:

CVE-2026-39879 Overview

CVE-2026-39879 is a SQL injection vulnerability in syslog-ng affecting versions before 4.12. The flaw resides in the afsql_dd_run_query function within the afsql module, where a missing sanitization call allows untrusted input to influence SQL statements sent to the configured database backend. The vulnerability is categorized under [CWE-150] (Improper Neutralization of Escape, Meta, or Control Sequences). Exploitation requires the SQL destination driver to be manually configured, as it is not enabled in the default configuration. Fixes are available in syslog-ng 4.12, syslog-ng Premium Edition 8.2, and syslog-ng Store Box 7.8.

Critical Impact

An attacker with adjacent network access who can send crafted log messages to a syslog-ng instance configured with the SQL driver can inject SQL statements, potentially altering data integrity or causing database availability loss.

Affected Products

  • syslog-ng open source edition prior to version 4.12
  • syslog-ng Premium Edition prior to version 8.2
  • syslog-ng Store Box prior to version 7.8

Discovery Timeline

  • 2026-07-20 - CVE-2026-39879 published to NVD
  • 2026-07-23 - Last updated in NVD database

Technical Details for CVE-2026-39879

Vulnerability Analysis

syslog-ng is a widely deployed log management daemon that forwards log messages to various destinations, including SQL databases via the afsql destination driver. The vulnerability arises inside afsql_dd_run_query in modules/afsql/afsql.c, which constructs and executes SQL queries against the configured backend. Because the function fails to invoke the required sanitization routine on values derived from log message content, adversary-controlled fields propagate directly into the query string. Any deployment that forwards logs from untrusted or semi-trusted sources into an SQL destination is exposed. The impact aligns with an integrity and availability outcome rather than confidentiality, reflecting that injected statements can modify or destroy stored log data and disrupt the database service.

Root Cause

The root cause is missing input neutralization inside afsql_dd_run_query. Log message tokens are interpolated into SQL statements without escaping database meta-characters such as single quotes, semicolons, and comment sequences. As a result, the SQL parser treats attacker-controlled payloads as query syntax rather than data literals.

Attack Vector

Exploitation requires the SQL destination driver to be explicitly configured by an administrator, so vulnerable deployments are a subset of syslog-ng installations. An attacker on an adjacent network segment that can deliver syslog messages to the collector supplies crafted payloads containing SQL metacharacters. When syslog-ng ingests the message and issues the INSERT query, the injected fragments execute against the destination database. No authentication or user interaction is required against the syslog-ng service itself.

No verified public proof-of-concept exploit code is available. Refer to the GitHub Security Advisory GHSA-qwf9-6222-m24m for technical details.

Detection Methods for CVE-2026-39879

Indicators of Compromise

  • Unexpected INSERT, UPDATE, DELETE, or DROP statements in database audit logs originating from the syslog-ng service account.
  • Log records containing unescaped single quotes, semicolons, or SQL comment sequences (--, /*) in message body fields destined for the afsql driver.
  • Database errors or connection resets in syslog-ng internal logs correlated with malformed inbound messages.

Detection Strategies

  • Enable query logging on the destination database and alert on syntactically anomalous statements issued by the syslog-ng account.
  • Inspect the syslog-ng configuration for any destination block using the sql() driver and audit the source pipelines feeding it.
  • Deploy content inspection at the syslog ingestion boundary to flag messages containing SQL control characters when SQL destinations are in use.

Monitoring Recommendations

  • Baseline the volume and shape of queries the syslog-ng process issues to the database, and alert on deviations.
  • Forward database audit trails and syslog-ng internal diagnostic logs to a centralized analytics platform for correlation.
  • Monitor version banners of syslog-ng instances across the fleet to identify hosts still running releases prior to 4.12.

How to Mitigate CVE-2026-39879

Immediate Actions Required

  • Upgrade syslog-ng to 4.12 or later, syslog-ng Premium Edition to 8.2 or later, or syslog-ng Store Box to 7.8 or later.
  • Inventory all syslog-ng configurations and identify any destination block using the sql() driver.
  • Restrict which network sources are permitted to send log data to collectors with SQL destinations enabled.

Patch Information

The vendor has released fixes in syslog-ng 4.12, syslog-ng Premium Edition 8.2, and syslog-ng Store Box 7.8. Details are available in the syslog-ng GitHub Security Advisory GHSA-qwf9-6222-m24m. Administrators should validate the running version after upgrade with syslog-ng --version.

Workarounds

  • Temporarily disable the afsql SQL destination driver and route logs to a file or intermediary that sanitizes content before database insertion.
  • Enforce network segmentation and firewall rules so only trusted collectors and hosts can deliver messages to syslog-ng instances with SQL destinations configured.
  • Apply message filters within syslog-ng to drop or rewrite log records containing SQL metacharacters before they reach the sql() destination.
bash
# Verify installed syslog-ng version and locate SQL destinations
syslog-ng --version
grep -RnE 'destination\s+\w+\s*\{[^}]*sql\(' /etc/syslog-ng/

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.