Apache Commons Text: Improper Control of Generation of Code
CVE-2022-42889 is a critical-severity improper control of generation of code vulnerability in Apache Commons Text from Apache, with a CVSS 3.1 base score of 9.8 out of 10. It can be exploited remotely over the network by an unauthenticated attacker, without any action from a user. The record lists version Apache Commons Text* as the first without the flaw, so updating Apache Commons Text to that release or later removes the exposure. There is no confirmed exploitation so far. EPSS estimates a 99.9% chance of exploitation within 30 days, which is in the top 0.03% of all scored CVEs.
Exploitation in the next 30 days is more likely than not, according to EPSS.
What to do
- Update Apache Commons Text to Apache Commons Text* or a later version.
- Update Commons Text to 1.10.0 or a later version.
- Update Security Threat Response Manager to 7.5.0 or a later version.
- Read the advisory on lists.apache.org for workarounds and exact fixed builds.
- Until you can update, restrict network access to the affected service so it is not reachable from untrusted networks.
Affected products and versions
| Vendor | Product | Affected versions | Fixed in |
|---|---|---|---|
| Apache | Apache Commons Text | 1.9 and earlier; 1.5 up to, but not including, Apache Commons Text* | Apache Commons Text* |
| Apache | Commons Text | 1.5 up to, but not including, 1.10.0 | 1.10.0 |
| NetApp | Bluexp | Not specified in the record | Not stated |
| Juniper Networks | Security Threat Response Manager | before 7.5.0; 7.5.0 | 7.5.0 |
Version data comes from the organisation that assigned the CVE. Confirm against the vendor advisory before deciding you are unaffected.
How the severity score breaks down
- Attack vector
- NetworkCan be exploited remotely over a network, including the internet.
- Attack complexity
- LowNo special conditions are needed; the attack works reliably.
- Privileges required
- NoneNo account or login is needed.
- User interaction
- NoneNo action by a victim is required.
- Scope
- UnchangedImpact stays within the vulnerable component.
- Confidentiality
- HighAll data handled by the component can be read.
- Integrity
- HighData or code can be modified at will.
- Availability
- HighThe component can be taken down completely.
Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H. Scored by NVD.
Official description
Apache Commons Text performs variable interpolation, allowing properties to be dynamically evaluated and expanded. The standard format for interpolation is "${prefix:name}", where "prefix" is used to locate an instance of org.apache.commons.text.lookup.StringLookup that performs the interpolation. Starting with version 1.5 and continuing through 1.9, the set of default Lookup instances included interpolators that could result in arbitrary code execution or contact with remote servers. These lookups are: - "script" - execute expressions using the JVM script execution engine (javax.script) - "dns" - resolve dns records - "url" - load values from urls, including from remote servers Applications using the interpolation defaults in the affected versions may be vulnerable to remote code execution or unintentional contact with remote servers if untrusted configuration values are used. Users are recommended to upgrade to Apache Commons Text 1.10.0, which disables the problematic interpolators by default.
Source: the CVE record as published by its numbering authority, via NVD and CVE.org.
The underlying weakness: Improper Control of Generation of Code
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
How developers prevent this class of flaw
- Refactor your program so that you do not have to dynamically generate code.
- Run your code in a jail or similar sandbox environment that enforces strict boundaries between the process and the operating system. This may effectively restrict which code can be executed by your product. Examples include the Unix chroot jail and AppArmor. In general, managed code may provide some protection. This may not be a feasible solution, and it only limits the impact to the operating system; the rest of your application may still be subject to compromise. Be careful to avoid CWE-243 and other weaknesses related to jails.
- Use dynamic tools and techniques that interact with the product using large test suites with many diverse inputs, such as fuzz testing (fuzzing), robustness testing, and fault injection. The product's operation may slow down, but it should not become unstable, crash, or generate incorrect results.
More Improper Control of Generation of Code vulnerabilities (CWE-94)
Timeline
- CVE record published.
- CISA published its SSVC assessment (exploitation: none, automatable: yes, technical impact: total).
- Record last changed materially (score, affected products, status or references).
References
Advisories
- lists.apache.org/thread/n2bd4vdsgkqh2tm14l1wyc3jyol7s1omMailing List
- psirt.global.sonicwall.com/vuln-detail/SNWLID-2022-0022Third Party Advisory
Third-party and government advisories
- packetstormsecurity.com/files/171003/OX-App-Suite-Cross-Site-Scripting-Server-Side-Request-Forgery.htmlThird Party Advisory, VDB Entry
- seclists.org/fulldisclosure/2023/Feb/3Mailing List, Third Party Advisory
- openwall.com/lists/oss-security/2022/10/13/4Mailing List, Third Party Advisory
- openwall.com/lists/oss-security/2022/10/18/1Mailing List, Third Party Advisory
- security.gentoo.org/glsa/202301-05Third Party Advisory
- security.netapp.com/advisory/ntap-20221020-0004/Third Party Advisory
Other references
Recent Improper Control of Generation of Code vulnerabilities
- 7.2 High severity
- 8.8 High severity
- 9.8 Critical severity
- 7.8 High severity
- 8.8 High severity
- 8.8 High severity
Spotted an error? Tell us.