CVEfocus › CVE database › CVE-2023-31038

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

CVSS 8.8 HighEPSS 1.5% (higher than 74% of CVEs)Published 2023-05-08Updated 2024-10-15Assigner: apache

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>

CWE-89

What to do

Fixed builds are available from Debian: see the table below for the fixed version per release.

Ubuntu has not shipped a fix for every release yet.

Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.

curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \
  -H "Content-Type: text/plain" --data-binary @inventory.txt

Vendor status at a glance

2Fixed
1Fix pending
3Under investigation
6Will not fix
2Not affected

Status by vendor and release

From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.

ReleasePackageStatusFixed versionAdvisory
Ubuntu 26.10log4cxxFix pendingUBUNTU-CVE-2023-31038
Ubuntu 26.04log4cxxUnder investigationUBUNTU-CVE-2023-31038
Ubuntu 25.10log4cxxWill not fix
Ubuntu decided not to fix this in this release
UBUNTU-CVE-2023-31038
Ubuntu 24.04log4cxxUnder investigationUBUNTU-CVE-2023-31038
Ubuntu 22.04log4cxxUnder investigationUBUNTU-CVE-2023-31038
Ubuntu 20.04log4cxxWill not fix
Ubuntu decided not to fix this in this release
UBUNTU-CVE-2023-31038
Ubuntu 18.04log4cxxWill not fix
Ubuntu decided not to fix this in this release
UBUNTU-CVE-2023-31038
Ubuntu 16.04log4cxxWill not fix
Ubuntu decided not to fix this in this release
UBUNTU-CVE-2023-31038
Ubuntu 14.04log4cxxWill not fix
Ubuntu decided not to fix this in this release
UBUNTU-CVE-2023-31038
Debian 14log4cxxFixed1.1.0-1DEBIAN-CVE-2023-31038
Debian 13log4cxxFixed1.1.0-1DEBIAN-CVE-2023-31038
Debian 12log4cxxWill not fix
Debian rates this unimportant for its packages (a minor issue, or one that doesn't affect Debian's build), so no security update is planned.
DEBIAN-CVE-2023-31038
Red Hat Enterprise Linux 7log4cxxNot affected
Red Hat Enterprise Linux 7log4cxx-develNot affected

What the vendor says

As published in the CVE record by apache, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.

Vendor advisories:

References

About this page

Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.