GHSA-76CX-3V2M-9952
Vulnerability from github – Published: 2023-07-06 21:14 – Updated: 2024-04-04 05:39SQL 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:
-
Log4cxx compiled with ODBC support(before version 1.1.0, this was auto-detected at compile time)
-
ODBCAppender enabled for logging messages to, generally done via a config file
-
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:
... other params here ...
The migrated configuration snippet with new ColumnMapping parameters:
... other params here ...
{
"affected": [],
"aliases": [
"CVE-2023-31038"
],
"database_specific": {
"cwe_ids": [
"CWE-89"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2023-05-08T09:15:09Z",
"severity": "HIGH"
},
"details": "SQL injection in Log4cxx when using the ODBC appender to send log messages to a database.\u00a0 No fields sent to the database were properly escaped for SQL injection.\u00a0 This has been the case since at least version 0.9.0(released 2003-08-06)\n\n\n\n\nNote that Log4cxx is a C++ framework, so only C++ applications are affected.\n\nBefore version 1.1.0, the ODBC appender was automatically part of Log4cxx if the library was found when compiling the library.\u00a0 As of version 1.1.0, this must be both explicitly enabled in order to be compiled in.\n\n\n\n\nThree preconditions must be met for this vulnerability to be possible:\n\n1. Log4cxx compiled with ODBC support(before version 1.1.0, this was auto-detected at compile time)\n\n2. ODBCAppender enabled for logging messages to, generally done via a config file\n\n3. User input is logged at some point. If your application does not have user input, it is unlikely to be affected.\n\n\n\n\n\nUsers 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. \nNote that this fix does require a configuration file update, as the old configuration files will not configure properly.\u00a0 An example is shown below, and more information may be found in the Log4cxx documentation on the ODBCAppender.\n\n\n\n\n\nExample of old configuration snippet:\n\n\u003cappender name=\"SqlODBCAppender\" class=\"ODBCAppender\"\u003e\n\n\u00a0\u00a0\u00a0 \u003cparam name=\"sql\" value=\"INSERT INTO logs (message) VALUES (\u0027%m\u0027)\" /\u003e\n\n\u00a0\u00a0\u00a0 ... other params here ...\n\n\u003c/appender\u003e\n\n\n\n\nThe migrated configuration snippet with new ColumnMapping parameters:\n\n\n\u003cappender name=\"SqlODBCAppender\" class=\"ODBCAppender\"\u003e\n\n\n\n\n\u00a0 \u00a0 \u003cparam name=\"sql\" value=\"INSERT INTO logs (message) VALUES (?)\" /\u003e\n\n\u00a0\u00a0\u00a0 \u003cparam name=\"ColumnMapping\" value=\"message\"/\u003e\n\u00a0\u00a0\u00a0 ... other params here ...\n\n\n\u003c/appender\u003e\n\n\n\n\n\n",
"id": "GHSA-76cx-3v2m-9952",
"modified": "2024-04-04T05:39:48Z",
"published": "2023-07-06T21:14:54Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2023-31038"
},
{
"type": "WEB",
"url": "https://lists.apache.org/thread/vgjlpdf353vv91gryspwxrzj6p0fbjd9"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
Sightings
| Author | Source | Type | Date |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.