Description
String::Util versions before 1.36 for Perl are susceptible to a regular expression denial of service.
The trim and rtrim functions stripped trailing whitespace with s/\s*$//u. Because \s* matches greedily and the $ anchor fails whenever a non-whitespace character follows the whitespace, the regex engine retries the match at each offset of a long whitespace run, producing quadratic backtracking. The fix replaces \s*$ with \s+$.
Any caller that passes untrusted input to trim or rtrim can trigger CPU exhaustion with a string containing a long run of whitespace.
Affected products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| BAKERSCOT | String::Util | < 1.36 | 1.36 |
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 14 | libstring-util-perl | 1.36-1 | — |
| Debian 13 | libstring-util-perl | No fix yet | — |
| Debian 12 | libstring-util-perl | No fix yet | — |
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 26.10 | libstring-util-perl | No fix yet | — |
| Ubuntu 26.04 LTS | libstring-util-perl | No fix yet | — |
| Ubuntu 25.10 | libstring-util-perl | No fix yet | — |
| Ubuntu 24.04 LTS | libstring-util-perl | No fix yet | — |