Skip to content

CVE-2023-31038 Apache Log4cxx: SQL injection when using ODBC appender

HighCVSS 8.8 EPSS 1.6%
Published
Updated
Exploit status
No public exploit known
CISA SSVC
No known exploitation · automatable: no · technical impact: total
Technology
UbuntuDebian

Description

SQL injection in Log4cxx when using the ODBC appender to send log messages to a database.  No fields sent to the database were properly escaped for SQL injection.  This has been the case since at least version 0.9.0(released 2003-08-06)

Note that Log4cxx is a C++ framework, so only C++ applications are affected.

Before version 1.1.0, the ODBC appender was automatically part of Log4cxx if the library was found when compiling the library.  As of version 1.1.0, this must be both explicitly enabled in order to be compiled in.

Three preconditions must be met for this vulnerability to be possible:

  1. Log4cxx compiled with ODBC support(before version 1.1.0, this was auto-detected at compile time)

  2. ODBCAppender enabled for logging messages to, generally done via a config file

  3. User input is logged at some point. If your application does not have user input, it is unlikely to be affected.

Users are recommended to upgrade to version 1.1.0 which properly binds the parameters to the SQL statement, or migrate to the new DBAppender class which supports an ODBC connection in addition to other databases.
Note that this fix does require a configuration file update, as the old configuration files will not configure properly.  An example is shown below, and more information may be found in the Log4cxx documentation on the ODBCAppender.

Example of old configuration snippet:

<appender name="SqlODBCAppender" class="ODBCAppender">

    <param name="sql" value="INSERT INTO logs (message) VALUES ('%m')" />

    ... other params here ...

</appender>

The migrated configuration snippet with new ColumnMapping parameters:

<appender name="SqlODBCAppender" class="ODBCAppender">

    <param name="sql" value="INSERT INTO logs (message) VALUES (?)" />

    <param name="ColumnMapping" value="message"/>
    ... other params here ...

</appender>

Upgrade path

14 packages: 4 fixed, 10 with no fix yet.

PackageAffectedFixed inStatus
debian/log4cxx(Debian 12) = 1.0.0-1; = 1.0.0-1+deb12u1; = 1.1.0-1; = 1.1.0-1~exp1 +7 more No fix listed No fix yet
ubuntu/log4cxx(Ubuntu 14.04) = 0.10.0-1.2ubuntu3; All versions No fix listed No fix yet
ubuntu/log4cxx(Ubuntu 16.04) = 0.10.0-9ubuntu1; = 0.10.0-9ubuntu2; = 0.10.0-10ubuntu1; All versions No fix listed No fix yet
ubuntu/log4cxx(Ubuntu 18.04) = 0.10.0-12ubuntu1; = 0.10.0-13ubuntu1; = 0.10.0-13ubuntu2; All versions No fix listed No fix yet
ubuntu/log4cxx(Ubuntu 20.04) = 0.10.0-15ubuntu1; = 0.10.0-15ubuntu2; All versions No fix listed No fix yet
ubuntu/log4cxx(Ubuntu 22.04) = 0.11.0-2ubuntu1; = 0.11.0-3ubuntu2; = 0.12.1-4; All versions No fix listed No fix yet
ubuntu/log4cxx(Ubuntu 24.04) = 1.1.0-1; = 1.1.0-1build1; = 1.1.0-1build2; = 1.1.0-1build3 +1 more No fix listed No fix yet
ubuntu/log4cxx(Ubuntu 25.10) = 1.3.1-1; = 1.4.0-1; All versions No fix listed No fix yet
ubuntu/log4cxx(Ubuntu 26.04) = 1.4.0-1; = 1.5.0-1; All versions No fix listed No fix yet
ubuntu/log4cxx(Ubuntu 26.10) = 1.5.0-1; All versions No fix listed No fix yet
Apache Log4cxx >= 0.9.0, < 1.1.0 1.1.0 Fixed
apache log4cxx >= 0.9.0, < 1.1.0 1.1.0 Fixed
debian/log4cxx(Debian 13) < 1.1.0-1 1.1.0-1 Fixed
debian/log4cxx(Debian 14) < 1.1.0-1 1.1.0-1 Fixed

Affected products

ProductAffected versionsFixed in
debian/log4cxx(Debian:12) All versions No fix listed
debian/log4cxx(Debian:12) = 1.0.0-1 No fix listed
debian/log4cxx(Debian:12) = 1.0.0-1+deb12u1 No fix listed
debian/log4cxx(Debian:12) = 1.1.0-1 No fix listed
debian/log4cxx(Debian:12) = 1.1.0-1~exp1 No fix listed
debian/log4cxx(Debian:12) = 1.2.0-1 No fix listed
debian/log4cxx(Debian:12) = 1.3.0-1 No fix listed
debian/log4cxx(Debian:12) = 1.3.1-1 No fix listed
debian/log4cxx(Debian:12) = 1.4.0-1 No fix listed
debian/log4cxx(Debian:12) = 1.4.0-1.1 No fix listed
debian/log4cxx(Debian:12) = 1.5.0-1 No fix listed
debian/log4cxx(Debian:13) < 1.1.0-1 1.1.0-1
debian/log4cxx(Debian:14) < 1.1.0-1 1.1.0-1
Apache Log4cxx >= 0.9.0, < 1.1.0 1.1.0
apache log4cxx >= 0.9.0, < 1.1.0 1.1.0
ubuntu/log4cxx(Ubuntu:22.04) All versions No fix listed
ubuntu/log4cxx(Ubuntu:24.04) All versions No fix listed
ubuntu/log4cxx(Ubuntu:26.04) All versions No fix listed
ubuntu/log4cxx(Ubuntu:26.10) All versions No fix listed
ubuntu/log4cxx(Ubuntu:14.04) All versions No fix listed
ubuntu/log4cxx(Ubuntu:14.04) = 0.10.0-1.2ubuntu3 No fix listed
ubuntu/log4cxx(Ubuntu:16.04) All versions No fix listed
ubuntu/log4cxx(Ubuntu:16.04) = 0.10.0-9ubuntu1 No fix listed
ubuntu/log4cxx(Ubuntu:16.04) = 0.10.0-9ubuntu2 No fix listed
ubuntu/log4cxx(Ubuntu:16.04) = 0.10.0-10ubuntu1 No fix listed
Show 20 more
ProductAffected versionsFixed in
ubuntu/log4cxx(Ubuntu:18.04) All versions No fix listed
ubuntu/log4cxx(Ubuntu:18.04) = 0.10.0-12ubuntu1 No fix listed
ubuntu/log4cxx(Ubuntu:18.04) = 0.10.0-13ubuntu1 No fix listed
ubuntu/log4cxx(Ubuntu:18.04) = 0.10.0-13ubuntu2 No fix listed
ubuntu/log4cxx(Ubuntu:20.04) All versions No fix listed
ubuntu/log4cxx(Ubuntu:20.04) = 0.10.0-15ubuntu1 No fix listed
ubuntu/log4cxx(Ubuntu:20.04) = 0.10.0-15ubuntu2 No fix listed
ubuntu/log4cxx(Ubuntu:22.04) = 0.11.0-2ubuntu1 No fix listed
ubuntu/log4cxx(Ubuntu:22.04) = 0.11.0-3ubuntu2 No fix listed
ubuntu/log4cxx(Ubuntu:22.04) = 0.12.1-4 No fix listed
ubuntu/log4cxx(Ubuntu:24.04) = 1.1.0-1 No fix listed
ubuntu/log4cxx(Ubuntu:24.04) = 1.1.0-1build1 No fix listed
ubuntu/log4cxx(Ubuntu:24.04) = 1.1.0-1build2 No fix listed
ubuntu/log4cxx(Ubuntu:24.04) = 1.1.0-1build3 No fix listed
ubuntu/log4cxx(Ubuntu:25.10) All versions No fix listed
ubuntu/log4cxx(Ubuntu:25.10) = 1.3.1-1 No fix listed
ubuntu/log4cxx(Ubuntu:25.10) = 1.4.0-1 No fix listed
ubuntu/log4cxx(Ubuntu:26.10) = 1.5.0-1 No fix listed
ubuntu/log4cxx(Ubuntu:26.04) = 1.4.0-1 No fix listed
ubuntu/log4cxx(Ubuntu:26.04) = 1.5.0-1 No fix listed

References