A remote code execution vulnerability has been found in the Apache Commons Text library, an open-source Java library used by developers. The vulnerability tracked as CVE-2022-42889 has been given a CVSS base score of 9.8, and a critical severity rating. A GitHub threat analyst discovered this flaw back in March and reported it to Apache. A fix has finally been released this month, so users can now update to version 1.10.0 to mitigate this flaw.
The Apache Commons Text library uses an interpolation system for string lookups which convert the strings to a decoded value. This is used to aid developers in the modification, generation, decoding, and escaping of Java strings. This vulnerability, found in versions of Apache Commons Text library from as far back as version 1.5 from 2018 to recent version 1.9, occurs within the StringSubstitutor when used with default interpolators. The library will attempt to conduct a string lookup which instead can result in a malicious actor remotely executing arbitrary code. Three lookup expressions have been found to be manipulated by this vulnerability, the first of which is the ‘script’ expression, which is executed via the javax.script execution engine. The other expressions are ‘dns’, which resolves dns records, and ‘url’, which loads values from urls and remote servers. This third vulnerable expression can also cause the user to have unintentional contact with remote servers.
This vulnerability has also been referred to as ‘Text4Shell’, with some developers worried that this flaw could become as widespread and damaging as Log4Shell, however most cybersecurity researchers appear confident that this will likely not be the case. Using the latest version of Apache Commons Text library means that the interpolators for which this vulnerability exists are disabled by default in order to protect users from this remote code attack.
“We were very impressed with the service, I will say, the vulnerability found was one our previous organisation had not picked up, which does make you wonder if anything else was missed.”
Aim Ltd Chief Technology Officer (CTO)