|src/main/java/com/seanwrightsec/poc||Loading last commit info...|
195 + 324. If vulnerable the output should be:
PoC Output: 519
In order to run this you will need:
- JDK 11 or above
The issue stems from the fact that the following keys should not be interpolated by default (as per the documentation https://commons.apache.org/proper/commons-text/apidocs/org/apache/commons/text/lookup/StringLookupFactory.html):
However due to a flaw in the logic, these 3 keys are interpolated by default, when they should not (since they could represent a security risk).
An attacker with control over the string passed into an affected
StringSubstitutor replace could allow the attacker to:
- Connect to other servers from the affected system
- Potentially gain access to other remove resources from the affected system
In order for your code to be vulnerable you need to:
- Be running a version of Apache
1.5.0up to (and not including)
- Using Interpolation for your StringSubstituion (see https://commons.apache.org/proper/commons-text/apidocs/org/apache/commons/text/StringSubstitutor.html)
scriptkey, however it will still be vulnerable to the
The fix for this is to update your instances of
commons-text to versions
1.10.0 or later.
The other default lookups could still potentially represent a security risk (such as the ability to read content of files, read system properies, etc). Use this feature with caution and make sure that all user input appropriately sanitised (for example passing through an allow list).