{"answers":{"affected":"It affects 1 product.","exploited":"There is no known exploitation of CVE-2023-31038 in the wild and no public exploit code.","fix":"Upgrade to a fixed version.","what":"CVE-2023-31038 is a high-severity SQL injection vulnerability in Apache Log4cxx, published on 8 May 2023. Any signed-in user can exploit it over the network, with no action from the victim."},"fix_prompt":"Check this codebase for CVE-2023-31038 and fix it if it is affected.\n\nWhat it is: CVE-2023-31038 is a high-severity SQL injection vulnerability in Apache Log4cxx, published on 8 May 2023. Any signed-in user can exploit it over the network, with no action from the victim.\nExploitation: There is no known exploitation of CVE-2023-31038 in the wild and no public exploit code.\n\nAffected product: Apache Log4cxx. No package-level version data is available, so check the vendor advisory linked from the reference page.\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/CVE-2023-31038/ (Markdown: https://insights.sbomify.com/CVE-2023-31038/index.md)","id":"CVE-2023-31038","markdown":"https://insights.sbomify.com/CVE-2023-31038/index.md","name":"CVE-2023-31038","record":{"aliases":["DEBIAN-CVE-2023-31038","GHSA-76cx-3v2m-9952","UBUNTU-CVE-2023-31038","openSUSE-SU-2024:13545-1"],"analysis":{"component_type":"library","fix_type":"upgrade","impacts":["data_read","data_modify"],"network_reachable":"yes","non_default_config":true,"product_category":"C++ logging library","requires_auth":"low_privilege","summary":"Attackers can inject SQL commands via log messages in Apache Log4cxx when using the ODBC appender, potentially compromising the database.","user_interaction":"not_required","vuln_class":"sql_injection"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"apache","cpe":[{"product":"log4cxx","vendor":"apache"}],"cvss":{"score":8.8,"severity":"high","source":"cisa-adp","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","version":"3.1"},"cwes":[{"id":"CWE-89","name":"Improper Neutralization of Special Elements used in an SQL Command"}],"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)\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.  As of version 1.1.0, this must be both explicitly enabled in order to be compiled in.\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\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.  An example is shown below, and more information may be found in the Log4cxx documentation on the ODBCAppender.\n\nExample of old configuration snippet:\n\n\u003cappender name=\"SqlODBCAppender\" class=\"ODBCAppender\"\u003e\n\n    \u003cparam name=\"sql\" value=\"INSERT INTO logs (message) VALUES ('%m')\" /\u003e\n\n    ... other params here ...\n\n\u003c/appender\u003e\n\nThe migrated configuration snippet with new ColumnMapping parameters:\n\n\u003cappender name=\"SqlODBCAppender\" class=\"ODBCAppender\"\u003e\n\n    \u003cparam name=\"sql\" value=\"INSERT INTO logs (message) VALUES (?)\" /\u003e\n\n    \u003cparam name=\"ColumnMapping\" value=\"message\"/\u003e\n    ... other params here ...\n\n\u003c/appender\u003e","ecosystems":["openSUSE:Tumbleweed"],"exploits":{"exploitdb":0,"first_seen":null,"github_poc":0,"max_poc_stars":null,"metasploit":0,"nuclei":0,"refs":[],"tier":"none_known"},"has_fix":true,"headline":"Apache Log4cxx: SQL injection when using ODBC appender","id":"CVE-2023-31038","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":null,"product":null,"products":[],"type":"sql_injection","year":"2023"},"n_packages":1,"n_references":1,"next":{"headline":"Apache bRPC: ServerOptions.pid_file may cause arbitrary code execution","id":"CVE-2023-31039"},"packages":[{"ecosystem":"openSUSE:Tumbleweed","fixed":["1.1.0-1.1"],"introduced":["0"],"last_affected":[],"package":"log4cxx","purl":"pkg:rpm/opensuse/log4cxx\u0026distro=openSUSE%20Tumbleweed","source":"openSUSE-SU-2024:13545-1"}],"prev":{"headline":"Code injection in Bluefield 2 DPU BMC, BlueField 3 DPU BMC","id":"CVE-2023-31037"},"products":["Apache Log4cxx"],"published":"2023-05-08","related":[{"cvss_score":6.3,"headline":"Other in Apache Log4cxx","id":"CVE-2026-40023","kev_date_added":null,"published":"2026-04-10"},{"cvss_score":6.3,"headline":"Apache Log4cxx: Improper escaping with JSONLayout","id":"CVE-2025-54813","kev_date_added":null,"published":"2025-08-22"},{"cvss_score":2.1,"headline":"Apache Log4cxx: Improper HTML escaping in HTMLLayout","id":"CVE-2025-54812","kev_date_added":null,"published":"2025-08-22"}],"sources":[{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"},{"class":"attribution","licence":"CC BY 4.0","name":"SUSE","prefix":"openSUSE"},{"class":"attribution","licence":"US public information, NVD API terms","name":"NVD"},{"class":"attribution","licence":"CWE Terms of Use","name":"CWE (MITRE)"},{"class":"attribution","licence":"FIRST CVSS licence","name":"CVSS (FIRST)"}],"ssvc":{"automatable":"no","exploitation":"none","technical_impact":"total"},"state":"PUBLISHED","updated":"2024-10-15","vendors":["Apache Software Foundation"]},"summary":"Attackers can inject SQL commands via log messages in Apache Log4cxx when using the ODBC appender, potentially compromising the database.","url":"https://insights.sbomify.com/CVE-2023-31038/"}