Skip to content
Medium 5.1

LDAP backend interpolates identity variables into authorization regexes unescaped, letting a username widen its own ACL

GHSA-hqjp-fc45-wj4f First seen on SecPulse

Summary

Summary

In the LDAP backend's documented access queries the regular expression is the ACL.
${username} and the other variables are substituted into it with no escaping, so a principal
whose name contains PCRE metacharacters rewrites the pattern that is supposed to constrain it
and gain...

Affected packages

PackageAffected → Fixed
otherrabbitmq-server
>= 4.4.0, < 4.4.1→ 4.4.1
otherrabbitmq-server
>= 4.3.0, < 4.3.8→ 4.3.8
otherrabbitmq-server
>= 4.2.0, < 4.2.13→ 4.2.13
otherrabbitmq-server
>= 4.1.0, < 4.1.18→ 4.1.18
otherrabbitmq-server
>= 3.13.0, < 3.13.22→ 3.13.22
Original description The description as published by the source.

Summary

In the LDAP backend's documented access queries the regular expression is the ACL.
${username} and the other variables are substituted into it with no escaping, so a principal
whose name contains PCRE metacharacters rewrites the pattern that is supposed to constrain it
and gains access to other principals' resources. This is an incomplete instance of the
project's own hardening: commit f964a14cf9 (2026-07-03) added rabbit_re:escape/1 for exactly
this problem and applied it to two backends, but not to LDAP.

Details

deps/rabbitmq_auth_backend_ldap/src/rabbit_auth_backend_ldap.erl:376:

evaluate0({string, StringPattern}, Args, _User, _LDAP) ->
    R = fill(StringPattern, Args),

reaching the matcher unchanged:

do_match(S1, S2) ->
    R = rabbit_re:matches(S1, S2),

rabbit_re:matches/2 calls re:run/3 with no anchoring, so a top-level alternation applies to
the whole pattern. The substitution helper states its own limitation
(rabbit_auth_backend_ldap_util.erl:12):

%% Raw substitution without escaping. Safe only for non-DN sinks (ACL string
%% comparisons, eldap:equalityMatch/2 filter values).

An ACL regex is not a string comparison. By contrast the internal backend does escape, at
deps/rabbit/src/rabbit_auth_backend_internal.erl:222:

binary:replace(Acc, Placeholder, rabbit_re:escape(V), [global])

rabbit_re:escape/1 has exactly two production callers in the tree, that one and
`rabbit…

Source: GitHub Repository Security Advisories (Game のスタック) GitHub Advisory OSV

References

We use cookies for analytics and ad measurement. This setting applies to all Game co., Ltd. sites. Details