Knowledge Base · general

Text4Shell (CVE-2022-42889)

generaltechnique notetechniquetext4shell

RCE in Apache Commons Text ≤ 1.9 via the StringSubstitutor script:/url:/dns: interpolators.

How it works

  • A parameter interpolated by StringSubstitutor can invoke script:javascript:... or url: loaders.
  • In the challenge, a message parameter reached the interpolator and executed commands, revealing /app/flag.

Detection & defence

  • Upgrade Apache Commons Text to ≥ 1.10.
  • Never interpolate untrusted input; disable dangerous interpolator prefixes.