Skip to main content
Menu
Advisories

ACL authorizer regex literals strip backslash escapes, causing patterns to match more broadly than intended

GHSA-X5XX-3J9W-X63GPublished Updated GitHub

Description

Originally reported on: github.com/kroxylicious/kroxylicious/issues/5236

The ACL authorizer's matching /…/ regex literal syntax strips all backslash characters before passing patterns to the RE2 engine. Only \/ (embedded slash) and \\ (literal backslash) should be unescaped; every other escape sequence (\., \d, \w, \s, \b, etc.) is meaningful to the regex engine and must be passed through intact.

Details

unquoteRegex delegates to the string unquote helper, which applies replaceAll("\\\\(.)", "$1") — a substitution that removes the backslash from every \X sequence, not just \/.

An ACL rule such as:

allow User with name = "alice" to READ Topic with name matching /orders\.v1/;

is silently enforced as the pattern orders.v1, where . matches any character. The rule therefore permits access to topic names such as ordersXv1 or orders v1 that the operator did not intend to allow.

Other escape sequences behave similarly: \d becomes d (matching only the letter d, not any digit), \w becomes w, and so on. In every case the enforced pattern differs from the written pattern with no error or warning.

Impact

An authenticated Kafka client may gain read and/or write access to topics that the ACL was intended to block. The broadening of access is silent — operators receive no error or warning, and the system appears to function normally.

Affected versions

All versions from v0.18.0 (when the ACL authorizer was introduced) through v0.25.1.

Fix

Only unescape \/ → / and \\ → \. All other backslash sequences must be forwarded to the regex engine unchanged.

Affected versions

References

GitHub · kroxylicious/kroxylicious