public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Peter Lemenkov <lemenkov@gmail.com>
To: git-commits@fedoraproject.org
Subject: [rpms/rabbitmq-server] f43: Backport fixes for 16 RabbitMQ CVEs
Date: Wed, 04 Nov 2026 17:58:47 GMT	[thread overview]
Message-ID: <179381512713.1.17149233347310897710.rpms-rabbitmq-server-7063bacb4efd@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/rabbitmq-server
            Branch : f43
            Commit : 7063bacb4efddb45928aa6bdc0f26df2e496eb04
            Author : Peter Lemenkov <lemenkov@gmail.com>
            Date   : 2026-11-04T18:58:16+01:00
            Stats  : +2077/-1 in 25 file(s)
            URL    : https://src.fedoraproject.org/rpms/rabbitmq-server/c/7063bacb4efddb45928aa6bdc0f26df2e496eb04?branch=f43

            Log:
            Backport fixes for 16 RabbitMQ CVEs

Backported from upstream v4.3.x (no public 4.0.x release carries them):
CVE-2026-44838, CVE-2026-61837, CVE-2026-66071, CVE-2026-66073,
CVE-2026-67222, CVE-2026-67223, CVE-2026-67225, CVE-2026-67226,
CVE-2026-67227, CVE-2026-67230, CVE-2026-67239, CVE-2026-67407,
CVE-2026-67411, CVE-2026-67412, CVE-2026-67413, CVE-2026-67421

CVE-2026-67407 and CVE-2026-67413 are adapted fixes, since the upstream
ones depend on rabbit_re, which 4.0.9 lacks. For CVE-2026-67230 the
post-login frame size raise is not taken, because the bundled Cowboy
2.12.0 ignores max_frame_size in set_options. Test hunks are dropped
since the release tarball ships no test directories.

Resolves: rhbz#2566756, rhbz#2566800, rhbz#2566802, rhbz#2566803
Resolves: rhbz#2566804, rhbz#2566805, rhbz#2566806, rhbz#2566807
Resolves: rhbz#2566808, rhbz#2566809, rhbz#2566811, rhbz#2566813
Resolves: rhbz#2566815, rhbz#2566819, rhbz#2566939

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>

---
diff --git a/rabbitmq-server-0018-HTTP-API-refactor-global-parameter-name-lookups.patch b/rabbitmq-server-0018-HTTP-API-refactor-global-parameter-name-lookups.patch
new file mode 100644
index 0000000..c39f287
--- /dev/null
+++ b/rabbitmq-server-0018-HTTP-API-refactor-global-parameter-name-lookups.patch
@@ -0,0 +1,41 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Michael Klishin <michaelklishin@icloud.com>
+Date: Mon, 27 Apr 2026 19:48:11 -0700
+Subject: [PATCH 18/41] HTTP API: refactor global parameter name lookups
+
+(cherry picked from commit b92b642d1eb73dae7727b1f677683fd3acf8d0d5)
+(cherry picked from commit 8fbe6d8112427e85fb9a9206b3eb6e9a3ddd3e39)
+
+[Backport to 4.0.9: clean cherry-pick. Fixes CVE-2026-67227 (atom
+exhaustion via the global-parameters :name path segment).]
+
+Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+---
+ .../src/rabbit_mgmt_wm_global_parameter.erl              | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/deps/rabbitmq_management/src/rabbit_mgmt_wm_global_parameter.erl b/deps/rabbitmq_management/src/rabbit_mgmt_wm_global_parameter.erl
+index 49072a331d..847f1ecff1 100644
+--- a/deps/rabbitmq_management/src/rabbit_mgmt_wm_global_parameter.erl
++++ b/deps/rabbitmq_management/src/rabbit_mgmt_wm_global_parameter.erl
+@@ -52,7 +52,7 @@ accept_content(ReqData0, Context = #context{user = #user{username = Username}})
+           Val = if is_map(Value) -> maps:to_list(Value);
+                     true         -> Value
+                 end,
+-          rabbit_runtime_parameters:set_global(name(ReqData), Val, Username),
++          rabbit_runtime_parameters:set_global(raw_name(ReqData), Val, Username),
+           {true, ReqData, Context}
+       end).
+ 
+@@ -68,4 +68,9 @@ is_authorized(ReqData, Context) ->
+ parameter(ReqData) ->
+     rabbit_runtime_parameters:lookup_global(name(ReqData)).
+ 
+-name(ReqData)      -> rabbit_data_coercion:to_atom(rabbit_mgmt_util:id(name, ReqData)).
++name(ReqData) ->
++    try rabbit_data_coercion:to_existing_atom(rabbit_mgmt_util:id(name, ReqData))
++    catch error:badarg -> undefined
++    end.
++
++raw_name(ReqData) -> rabbit_mgmt_util:id(name, ReqData).

diff --git a/rabbitmq-server-0019-Runtime-parameters-refactor-component-lookups.patch b/rabbitmq-server-0019-Runtime-parameters-refactor-component-lookups.patch
new file mode 100644
index 0000000..e689fdc
--- /dev/null
+++ b/rabbitmq-server-0019-Runtime-parameters-refactor-component-lookups.patch
@@ -0,0 +1,48 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Michael Klishin <michaelklishin@icloud.com>
+Date: Mon, 27 Apr 2026 20:25:32 -0700
+Subject: [PATCH 19/41] Runtime parameters: refactor `component` lookups
+
+(cherry picked from commit 8ea4591468a5d89f6f6de72c36e55eed6f93a22c)
+(cherry picked from commit a87125ceef5eeec07b63b5fb60702a1f5f360616)
+
+[Backport to 4.0.9: clean cherry-pick. Same to_atom/1 hardening for the
+runtime parameter component lookup, taken together with the
+CVE-2026-67227 fix.]
+
+Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+---
+ deps/rabbit/src/rabbit_runtime_parameters.erl | 17 ++++++++++++-----
+ 1 file changed, 12 insertions(+), 5 deletions(-)
+
+diff --git a/deps/rabbit/src/rabbit_runtime_parameters.erl b/deps/rabbit/src/rabbit_runtime_parameters.erl
+index f919ad3969..4a24471672 100644
+--- a/deps/rabbit/src/rabbit_runtime_parameters.erl
++++ b/deps/rabbit/src/rabbit_runtime_parameters.erl
+@@ -383,13 +383,20 @@ global_info_keys() -> [name, value].
+ %%---------------------------------------------------------------------------
+ 
+ lookup_component(Component) ->
+-    case rabbit_registry:lookup_module(
+-           runtime_parameter, rabbit_data_coercion:to_atom(Component)) of
+-        {error, not_found} -> {errors,
+-                               [{"component ~ts not found", [Component]}]};
+-        {ok, Module}       -> {ok, Module}
++    try rabbit_data_coercion:to_existing_atom(Component) of
++        ComponentAtom ->
++            case rabbit_registry:lookup_module(
++                   runtime_parameter, ComponentAtom) of
++                {error, not_found} -> component_not_found(Component);
++                {ok, Module}       -> {ok, Module}
++            end
++    catch
++        error:badarg -> component_not_found(Component)
+     end.
+ 
++component_not_found(Component) ->
++    {errors, [{"component ~ts not found", [Component]}]}.
++
+ flatten_errors(L) ->
+     case [{F, A} || I <- lists:flatten([L]), {error, F, A} <- [I]] of
+         [] -> ok;

diff --git a/rabbitmq-server-0020-Escape-variables-in-topic-permissions.patch b/rabbitmq-server-0020-Escape-variables-in-topic-permissions.patch
new file mode 100644
index 0000000..a0acda8
--- /dev/null
+++ b/rabbitmq-server-0020-Escape-variables-in-topic-permissions.patch
@@ -0,0 +1,48 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Michael Klishin <michaelklishin@icloud.com>
+Date: Tue, 10 Feb 2026 13:35:03 -0800
+Subject: [PATCH 20/41] Escape '{variables}' in topic permissions
+
+(cherry picked from commit 839d9d40542cb22529c6b0921b9d03c46c092ab2)
+
+[Backport to 4.0.9: clean cherry-pick. Fixes CVE-2026-44838: 4.0.9-4
+fixed CVE-2026-44839, not this one, so topic permission variables were
+still expanded unescaped.]
+
+Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+---
+ deps/rabbit/src/rabbit_auth_backend_internal.erl | 15 ++++++++++++++-
+ 1 file changed, 14 insertions(+), 1 deletion(-)
+
+diff --git a/deps/rabbit/src/rabbit_auth_backend_internal.erl b/deps/rabbit/src/rabbit_auth_backend_internal.erl
+index 86e1df0688..d55956f9b6 100644
+--- a/deps/rabbit/src/rabbit_auth_backend_internal.erl
++++ b/deps/rabbit/src/rabbit_auth_backend_internal.erl
+@@ -183,12 +183,25 @@ expand_topic_permission(Permission, ToExpand) when is_map(ToExpand) ->
+     Closing = <<"}">>,
+     ReplaceFun = fun(K, V, Acc) ->
+                     Placeholder = <<Opening/binary, K/binary, Closing/binary>>,
+-                    binary:replace(Acc, Placeholder, V, [global])
++                    binary:replace(Acc, Placeholder, escape_regex(V), [global])
+                  end,
+     maps:fold(ReplaceFun, Permission, ToExpand);
+ expand_topic_permission(Permission, _ToExpand) ->
+     Permission.
+ 
++-spec escape_regex(binary()) -> binary().
++escape_regex(Bin) when is_binary(Bin) ->
++    << <<(escape_regex_char(C))/binary>> || <<C>> <= Bin >>.
++
++escape_regex_char(C)
++  when C =:= $\\; C =:= $^; C =:= $$; C =:= $.;
++       C =:= $|; C =:= $?; C =:= $*; C =:= $+;
++       C =:= $(; C =:= $); C =:= $[; C =:= $];
++       C =:= ${; C =:= $} ->
++    <<$\\, C>>;
++escape_regex_char(C) ->
++    <<C>>.
++
+ permission_index(configure) -> #permission.configure;
+ permission_index(write)     -> #permission.write;
+ permission_index(read)      -> #permission.read.

diff --git a/rabbitmq-server-0021-Escape-in-topic-permission-variables.patch b/rabbitmq-server-0021-Escape-in-topic-permission-variables.patch
new file mode 100644
index 0000000..113a546
--- /dev/null
+++ b/rabbitmq-server-0021-Escape-in-topic-permission-variables.patch
@@ -0,0 +1,36 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Peter Lemenkov <lemenkov@gmail.com>
+Date: Wed, 4 Nov 2026 18:27:09 +0100
+Subject: [PATCH 21/41] Escape "-" in topic permission variables
+
+The CVE-2026-44838 fix escapes regex metacharacters in expanded topic
+permission variables, but not "-". Inside a "[...]" character class
+"-" forms a range, so a client ID such as "a-z" substituted into a
+template like "^[{client_id}]-sensors$" still widens the pattern.
+
+Upstream fixed this in eb7e0e2ad6 ("Improve `rabbit_re`, adopt it in
+more places"), which moves the escaping into a new rabbit_re:escape/1
+and adds "-" to the escaped set. 4.0.9 has no rabbit_re, so add "-" to
+escape_regex_char/1 directly and port the upstream test case.
+
+Fixes CVE-2026-67407.
+
+Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+---
+ deps/rabbit/src/rabbit_auth_backend_internal.erl | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/deps/rabbit/src/rabbit_auth_backend_internal.erl b/deps/rabbit/src/rabbit_auth_backend_internal.erl
+index d55956f9b6..3f1ff6322c 100644
+--- a/deps/rabbit/src/rabbit_auth_backend_internal.erl
++++ b/deps/rabbit/src/rabbit_auth_backend_internal.erl
+@@ -197,7 +197,7 @@ escape_regex_char(C)
+   when C =:= $\\; C =:= $^; C =:= $$; C =:= $.;
+        C =:= $|; C =:= $?; C =:= $*; C =:= $+;
+        C =:= $(; C =:= $); C =:= $[; C =:= $];
+-       C =:= ${; C =:= $} ->
++       C =:= ${; C =:= $}; C =:= $- ->
+     <<$\\, C>>;
+ escape_regex_char(C) ->
+     <<C>>.

diff --git a/rabbitmq-server-0022-AMQP-1.0-management-align-GET-bindings-with-the-rest.patch b/rabbitmq-server-0022-AMQP-1.0-management-align-GET-bindings-with-the-rest.patch
new file mode 100644
index 0000000..b0e7a5a
--- /dev/null
+++ b/rabbitmq-server-0022-AMQP-1.0-management-align-GET-bindings-with-the-rest.patch
@@ -0,0 +1,50 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Michael Klishin <michaelklishin@icloud.com>
+Date: Wed, 24 Jun 2026 10:00:15 -0700
+Subject: [PATCH 22/41] AMQP 1.0 management: align `GET /bindings` with the
+ rest of the bindings handlers
+
+(cherry picked from commit 93998ec20bb7444d8f65a450b5a0f9ab9b104788)
+
+(cherry picked from commit 341e3f2795ebd1f816e712530f651a3221d23ad9)
+
+[Backport to 4.0.9: hand-applied only the handle_http_req/8 GET
+[<<"bindings">>] hunk: binding_checks/5 now runs before the binding
+list is returned. The -ifdef(TEST) export, the rabbitmq_amqp_client
+test helper and the test suites are not taken. Fixes CVE-2026-61837.]
+
+Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+---
+ deps/rabbit/src/rabbit_amqp_management.erl | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/deps/rabbit/src/rabbit_amqp_management.erl b/deps/rabbit/src/rabbit_amqp_management.erl
+index e60c967fe7..29944519c6 100644
+--- a/deps/rabbit/src/rabbit_amqp_management.erl
++++ b/deps/rabbit/src/rabbit_amqp_management.erl
+@@ -366,9 +366,9 @@ handle_http_req(<<"GET">>,
+                              <<"key">> := Key},
+                 null,
+                 Vhost,
+-                _User,
++                User,
+                 _ConnPid,
+-                PermCaches) ->
++                PermCaches0) ->
+     {DstKind,
+      DstNameBin} = case QueryMap of
+                        #{<<"dste">> := DstX} ->
+@@ -378,10 +378,11 @@ handle_http_req(<<"GET">>,
+                        _ ->
+                            throw(<<"400">>,
+                                  "missing 'dste' or 'dstq' in query: ~tp",
+-                                 QueryMap)
++                                 [QueryMap])
+                    end,
+     SrcXName = exchange_resource(Vhost, SrcXNameBin),
+     DstName = rabbit_misc:r(Vhost, DstKind, DstNameBin),
++    PermCaches = binding_checks(SrcXName, DstName, Key, User, PermCaches0),
+     Bindings0 = rabbit_binding:list_for_source_and_destination(SrcXName, DstName),
+     Bindings = [B || B = #binding{key = K} <- Bindings0, K =:= Key],
+     RespPayload = encode_bindings(Bindings),

diff --git a/rabbitmq-server-0023-Stream-management-plugin-format-a-few-more-rendered-.patch b/rabbitmq-server-0023-Stream-management-plugin-format-a-few-more-rendered-.patch
new file mode 100644
index 0000000..e9be6c4
--- /dev/null
+++ b/rabbitmq-server-0023-Stream-management-plugin-format-a-few-more-rendered-.patch
@@ -0,0 +1,41 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Michael Klishin <michaelklishin@icloud.com>
+Date: Fri, 12 Jun 2026 17:09:05 -0700
+Subject: [PATCH 23/41] Stream management plugin: format a few more rendered
+ values with `fmt_string`
+
+(cherry picked from commit 1ab24f33b41d4d241312584200ff430e76881348)
+(cherry picked from commit a92f3b8487e84f390ec94ce5034b0467c84ae558)
+
+[Backport to 4.0.9: clean cherry-pick. Fixes CVE-2026-67239 (stored XSS
+via TLS peer certificate fields in the stream connection page).]
+
+Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+---
+ .../priv/www/js/tmpl/streamConnection.ejs                   | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/deps/rabbitmq_stream_management/priv/www/js/tmpl/streamConnection.ejs b/deps/rabbitmq_stream_management/priv/www/js/tmpl/streamConnection.ejs
+index 571293bf48..cb0db258c3 100644
+--- a/deps/rabbitmq_stream_management/priv/www/js/tmpl/streamConnection.ejs
++++ b/deps/rabbitmq_stream_management/priv/www/js/tmpl/streamConnection.ejs
+@@ -99,15 +99,15 @@
+ <table class="facts">
+   <tr>
+     <th>Peer Certificate Issuer</th>
+-    <td><%= connection.peer_cert_issuer %></td>
++    <td><%= fmt_string(connection.peer_cert_issuer) %></td>
+   </tr>
+   <tr>
+     <th>Peer Certificate Subject</th>
+-    <td><%= connection.peer_cert_subject %></td>
++    <td><%= fmt_string(connection.peer_cert_subject) %></td>
+   </tr>
+   <tr>
+     <th>Peer Certificate Validity</th>
+-    <td><%= connection.peer_cert_validity %></td>
++    <td><%= fmt_string(connection.peer_cert_validity) %></td>
+   </tr>
+ </table>
+ <% } %>

diff --git a/rabbitmq-server-0024-Refactor-amqp_uri-parse-1.patch b/rabbitmq-server-0024-Refactor-amqp_uri-parse-1.patch
new file mode 100644
index 0000000..deef854
--- /dev/null
+++ b/rabbitmq-server-0024-Refactor-amqp_uri-parse-1.patch
@@ -0,0 +1,62 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Michael Klishin <michaelklishin@icloud.com>
+Date: Mon, 13 Apr 2026 17:41:17 -0700
+Subject: [PATCH 24/41] Refactor `amqp_uri:parse/1`
+
+(cherry picked from commit c3b950b3561aba71c371a87c01c9d1c182b43ea6)
+(cherry picked from commit 5b1b5f304ab92dc368be956b211d4d43acf1e4a9)
+
+[Backport to 4.0.9: clean cherry-pick. Fixes CVE-2026-67222 (atom
+exhaustion via the auth_mechanism URI parameter).]
+
+Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+---
+ deps/amqp_client/src/amqp_uri.erl | 20 ++++++++++++++------
+ 1 file changed, 14 insertions(+), 6 deletions(-)
+
+diff --git a/deps/amqp_client/src/amqp_uri.erl b/deps/amqp_client/src/amqp_uri.erl
+index 20361075cb..07fb3819fc 100644
+--- a/deps/amqp_client/src/amqp_uri.erl
++++ b/deps/amqp_client/src/amqp_uri.erl
+@@ -248,13 +248,16 @@ find_integer_parameter(Value) ->
+     end.
+ 
+ find_boolean_parameter(Value) ->
+-    Bool = list_to_atom(Value),
+-    case is_boolean(Bool) of
+-        true  -> return(Bool);
+-        false -> fail({require_boolean, Bool})
++    case Value of
++        "true"  -> return(true);
++        "false" -> return(false);
++        _       -> fail({require_boolean, Value})
+     end.
+ 
+-find_atom_parameter(Value) -> return(list_to_atom(Value)).
++find_atom_parameter(Value) ->
++    try return(list_to_existing_atom(Value))
++    catch error:badarg -> fail({invalid_atom_parameter, Value})
++    end.
+ 
+ mechanisms(ParsedUri) ->
+     Query = proplists:get_value('query', ParsedUri),
+@@ -262,12 +265,17 @@ mechanisms(ParsedUri) ->
+                      []    -> ["plain", "amqplain"];
+                      Mechs -> Mechs
+                  end,
+-    [case [list_to_atom(T) || T <- string:tokens(Mech, ":")] of
++    [case [safe_mechanism_token(T) || T <- string:tokens(Mech, ":")] of
+          [F]    -> fun (R, P, S) -> amqp_auth_mechanisms:F(R, P, S) end;
+          [M, F] -> fun (R, P, S) -> M:F(R, P, S) end;
+          L      -> throw({not_mechanism, L})
+      end || Mech <- Mechanisms].
+ 
++safe_mechanism_token(T) ->
++    try list_to_existing_atom(T)
++    catch error:badarg -> throw({unknown_mechanism, T})
++    end.
++
+ %% --=: Plain state monad implementation start :=--
+ run_state_monad(FunList, State) ->
+     lists:foldl(fun (Fun, StateN) -> Fun(StateN) end, State, FunList).

diff --git a/rabbitmq-server-0025-Restrict-AMQP-URI-auth_mechanism-to-a-fixed-mechanis.patch b/rabbitmq-server-0025-Restrict-AMQP-URI-auth_mechanism-to-a-fixed-mechanis.patch
new file mode 100644
index 0000000..bbba78a
--- /dev/null
+++ b/rabbitmq-server-0025-Restrict-AMQP-URI-auth_mechanism-to-a-fixed-mechanis.patch
@@ -0,0 +1,77 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?=
+ <514737+acogoluegnes@users.noreply.github.com>
+Date: Tue, 15 Sep 2026 08:46:47 +0200
+Subject: [PATCH 25/41] Restrict AMQP URI auth_mechanism to a fixed mechanism
+ table
+
+Map auth_mechanism URI values to a fixed table of funs instead of
+resolving an arbitrary Module:Function pair via list_to_existing_atom/1.
+This also makes URI parsing independent of which modules happen to be
+loaded, so a bad value is rejected at parse time instead of failing
+later with undef when the connection is established.
+
+The colon-separated form is kept only for amqp_auth_mechanisms, since
+that is the only module ever referenced this way in this repository
+and is asserted by an existing test.
+
+(cherry picked from commit baa391f95a6cc208ba82da5b3dd6f6b708d64995)
+
+# Conflicts:
+#	release-notes/4.4.0.md
+(cherry picked from commit 2073bdf822917ed1941803c285d1b42d4b5cd576)
+
+[Backport to 4.0.9: dropped the release-notes/4.3.7.md hunk. Taken with
+the CVE-2026-67222 fix: auth_mechanism must now name a known mechanism
+instead of an arbitrary Module:Function.]
+
+Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+---
+ deps/amqp_client/src/amqp_uri.erl | 23 ++++++++++++++---------
+ 1 file changed, 14 insertions(+), 9 deletions(-)
+
+diff --git a/deps/amqp_client/src/amqp_uri.erl b/deps/amqp_client/src/amqp_uri.erl
+index 07fb3819fc..051f5fdc41 100644
+--- a/deps/amqp_client/src/amqp_uri.erl
++++ b/deps/amqp_client/src/amqp_uri.erl
+@@ -52,7 +52,8 @@ remove_credentials(URI) ->
+ %%
+ %% The extra parameters that may be specified are channel_max,
+ %% frame_max, heartbeat and auth_mechanism (the latter can appear more
+-%% than once).  The extra parameters that may be specified for an SSL
++%% than once, and must be one of plain, amqplain, external or crdemo).
++%% The extra parameters that may be specified for an SSL
+ %% connection are cacertfile, certfile, keyfile, verify,
+ %% fail_if_no_peer_cert, password, and depth.
+ -type parse_result() :: {ok, #amqp_params_network{}} |
+@@ -265,17 +266,21 @@ mechanisms(ParsedUri) ->
+                      []    -> ["plain", "amqplain"];
+                      Mechs -> Mechs
+                  end,
+-    [case [safe_mechanism_token(T) || T <- string:tokens(Mech, ":")] of
+-         [F]    -> fun (R, P, S) -> amqp_auth_mechanisms:F(R, P, S) end;
+-         [M, F] -> fun (R, P, S) -> M:F(R, P, S) end;
+-         L      -> throw({not_mechanism, L})
+-     end || Mech <- Mechanisms].
++    [mechanism(Mech) || Mech <- Mechanisms].
+ 
+-safe_mechanism_token(T) ->
+-    try list_to_existing_atom(T)
+-    catch error:badarg -> throw({unknown_mechanism, T})
++mechanism(Mech) ->
++    case string:split(Mech, ":", all) of
++        [Name]                         -> mechanism_fun(Name, Mech);
++        ["amqp_auth_mechanisms", Name] -> mechanism_fun(Name, Mech);
++        _                              -> throw({unknown_mechanism, Mech})
+     end.
+ 
++mechanism_fun("plain",    _Mech) -> fun amqp_auth_mechanisms:plain/3;
++mechanism_fun("amqplain", _Mech) -> fun amqp_auth_mechanisms:amqplain/3;
++mechanism_fun("external", _Mech) -> fun amqp_auth_mechanisms:external/3;
++mechanism_fun("crdemo",   _Mech) -> fun amqp_auth_mechanisms:crdemo/3;
++mechanism_fun(_Name,       Mech) -> throw({unknown_mechanism, Mech}).
++
+ %% --=: Plain state monad implementation start :=--
+ run_state_monad(FunList, State) ->
+     lists:foldl(fun (Fun, StateN) -> Fun(StateN) end, State, FunList).

diff --git a/rabbitmq-server-0026-Federation-more-strict-when-validating-URIs.patch b/rabbitmq-server-0026-Federation-more-strict-when-validating-URIs.patch
new file mode 100644
index 0000000..2242d38
--- /dev/null
+++ b/rabbitmq-server-0026-Federation-more-strict-when-validating-URIs.patch
@@ -0,0 +1,93 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Michael Klishin <michaelklishin@icloud.com>
+Date: Tue, 14 Jul 2026 20:01:00 -0700
+Subject: [PATCH 26/41] Federation: more strict when validating URIs
+
+(cherry picked from commit 32f3650fc7097bf491a791d9e04fb87536eadc7b)
+(cherry picked from commit 8673c63338a88dfb2657932850069e044ecac1b0)
+
+[Backport to 4.0.9: the module still lives in deps/rabbitmq_federation
+in 4.0.9; resolved the include block (4.0.9 has none) by taking the
+upstream includes, which resolve to the local rabbit_federation.hrl and
+amqp_client.hrl. Test changes and the rabbitmq_federation_common
+Makefile are dropped. Fixes CVE-2026-67412.]
+
+Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+---
+ .../src/rabbit_federation_parameters.erl      | 31 +++++++++++++++----
+ 1 file changed, 25 insertions(+), 6 deletions(-)
+
+diff --git a/deps/rabbitmq_federation/src/rabbit_federation_parameters.erl b/deps/rabbitmq_federation/src/rabbit_federation_parameters.erl
+index 02c498d69d..24bef26756 100644
+--- a/deps/rabbitmq_federation/src/rabbit_federation_parameters.erl
++++ b/deps/rabbitmq_federation/src/rabbit_federation_parameters.erl
+@@ -9,6 +9,9 @@
+ -behaviour(rabbit_runtime_parameter).
+ -behaviour(rabbit_policy_validator).
+ 
++-include("rabbit_federation.hrl").
++-include_lib("amqp_client/include/amqp_client.hrl").
++
+ -export([validate/5, notify/5, notify_clear/4]).
+ -export([register/0, unregister/0, validate_policy/1, adjust/1]).
+ 
+@@ -45,10 +48,10 @@ validate(_VHost, <<"federation-upstream-set">>, Name, Term0, _User) ->
+         shared_validation()], Upstream)
+      || Upstream <- Term];
+ 
+-validate(_VHost, <<"federation-upstream">>, Name, Term0, _User) ->
++validate(_VHost, <<"federation-upstream">>, Name, Term0, User) ->
+     Term = rabbit_data_coercion:to_proplist(Term0),
+     rabbit_parameter_validation:proplist(
+-      Name, [{<<"uri">>, fun validate_uri/2, mandatory} |
++      Name, [{<<"uri">>, validate_uri(User), mandatory} |
+             shared_validation()], Term);
+ 
+ validate(_VHost, _Component, Name, _Term, _User) ->
+@@ -93,18 +96,21 @@ shared_validation() ->
+      {<<"channel-use-mode">>, rabbit_parameter_validation:enum(
+                               ['multiple', 'single']), optional}].
+ 
+-validate_uri(Name, Term) when is_binary(Term) ->
++validate_uri(User) ->
++    fun (Name, Term) -> validate_uri(Name, Term, User) end.
++
++validate_uri(Name, Term, User) when is_binary(Term) ->
+     case rabbit_parameter_validation:binary(Name, Term) of
+         ok -> case amqp_uri:parse(binary_to_list(Term)) of
+-                  {ok, _}    -> ok;
++                  {ok, Params} -> validate_uri_vhost_access(Params, User);
+                   {error, E} -> {error, "\"~ts\" not a valid URI: ~tp", [Term, E]}
+               end;
+         E  -> E
+     end;
+-validate_uri(Name, Term) ->
++validate_uri(Name, Term, User) ->
+     case rabbit_parameter_validation:list(Name, Term) of
+         ok -> case [V || U <- Term,
+-                         V <- [validate_uri(Name, U)],
++                         V <- [validate_uri(Name, U, User)],
+                          element(1, V) =:= error] of
+                   []      -> ok;
+                   [E | _] -> E
+@@ -112,6 +118,19 @@ validate_uri(Name, Term) ->
+         E  -> E
+     end.
+ 
++%% A direct URI carries its own virtual host; check access to it here.
++validate_uri_vhost_access(#amqp_params_direct{}, none) ->
++    ok;
++validate_uri_vhost_access(#amqp_params_direct{virtual_host = VHost}, User = #user{}) ->
++    try rabbit_access_control:check_vhost_access(User, VHost, undefined, #{}) of
++        ok -> ok
++    catch
++        _:_ -> {error, "user \"~ts\" may not connect to vhost \"~ts\"",
++                [User#user.username, VHost]}
++    end;
++validate_uri_vhost_access(_Params, _User) ->
++    ok.
++
+ %%----------------------------------------------------------------------------
+ 
+ validate_policy([{<<"federation-upstream-set">>, Value}])

diff --git a/rabbitmq-server-0027-Introduce-rabbit_nodes-resolve_member-1.patch b/rabbitmq-server-0027-Introduce-rabbit_nodes-resolve_member-1.patch
new file mode 100644
index 0000000..32c6ba5
--- /dev/null
+++ b/rabbitmq-server-0027-Introduce-rabbit_nodes-resolve_member-1.patch
@@ -0,0 +1,96 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Michael Klishin <michaelklishin@icloud.com>
+Date: Mon, 13 Apr 2026 16:46:07 -0700
+Subject: [PATCH 27/41] Introduce `rabbit_nodes:resolve_member/1`
+
+(cherry picked from commit 3976c13a5e3d5814fedd0a2dc77a003c76dd400b)
+(cherry picked from commit 425fc3cd38ae1713ab9827113cc6ba28f713cf5c)
+
+[Backport to 4.0.9: rabbit_stream_super_stream_mgmt.erl does not exist
+in 4.0.9 and is dropped. 4.0.9's rabbit_mgmt_util logs through
+rabbit_log, so ?LOG_WARNING/2 becomes rabbit_log:warning/2. Fixes
+CVE-2026-66073 (atom exhaustion via the node field of the queue,
+exchange and binding endpoints).]
+
+Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+---
+ deps/rabbit/src/rabbit_nodes.erl               | 18 +++++++++++++++++-
+ .../src/rabbit_mgmt_util.erl                   | 14 ++++++++++----
+ 2 files changed, 27 insertions(+), 5 deletions(-)
+
+diff --git a/deps/rabbit/src/rabbit_nodes.erl b/deps/rabbit/src/rabbit_nodes.erl
+index 086c386f6b..4ebf311ede 100644
+--- a/deps/rabbit/src/rabbit_nodes.erl
++++ b/deps/rabbit/src/rabbit_nodes.erl
+@@ -15,7 +15,7 @@
+          is_running/2, is_process_running/2,
+          cluster_name/0, set_cluster_name/1, set_cluster_name/2, ensure_epmd/0,
+          all_running/0,
+-         is_member/1, list_members/0, list_consistent_members/0,
++         is_member/1, resolve_member/1, list_members/0, list_consistent_members/0,
+          filter_members/1,
+          is_reachable/1, list_reachable/0, list_unreachable/0,
+          filter_reachable/1, filter_unreachable/1,
+@@ -173,6 +173,22 @@ all_running() -> list_running().
+ is_member(Node) when is_atom(Node) ->
+     [Node] =:= filter_members([Node]).
+ 
++-spec resolve_member(string()) -> {ok, node()} | {error, not_member}.
++%% @doc Resolves a node name string to a cluster member atom.
++%%
++%% Accepts both short names (`"rabbit"') and full names
++%% (`"rabbit@hostname"').
++
++resolve_member(NodeStr) when is_list(NodeStr) ->
++    {Prefix, Suffix} = rabbit_nodes_common:parts(NodeStr),
++    FullName = lists:append([Prefix, "@", Suffix]),
++    FullNameBin = list_to_binary(FullName),
++    Members = list_members(),
++    case [M || M <- Members, atom_to_binary(M, utf8) =:= FullNameBin] of
++        [Member] -> {ok, Member};
++        _        -> {error, not_member}
++    end.
++
+ -spec list_members() -> Nodes when
+       Nodes :: [node()].
+ %% @doc Returns the list of nodes in the cluster.
+diff --git a/deps/rabbitmq_management/src/rabbit_mgmt_util.erl b/deps/rabbitmq_management/src/rabbit_mgmt_util.erl
+index 467e1b1c4a..62e497402d 100644
+--- a/deps/rabbitmq_management/src/rabbit_mgmt_util.erl
++++ b/deps/rabbitmq_management/src/rabbit_mgmt_util.erl
+@@ -841,9 +841,8 @@ get_or_missing(K, L) ->
+ 
+ get_node(Props) ->
+     case maps:get(<<"node">>, Props, undefined) of
+-        undefined -> node();
+-        N         -> rabbit_nodes:make(
+-                       binary_to_list(N))
++        undefined -> {ok, node()};
++        N         -> rabbit_nodes:resolve_member(binary_to_list(N))
+     end.
+ 
+ direct_request(MethodName, Transformers, Extra, ErrorMsg, ReqData,
+@@ -851,7 +850,13 @@ direct_request(MethodName, Transformers, Extra, ErrorMsg, ReqData,
+     with_vhost_and_props(
+       fun(VHost, Props, ReqData1) ->
+               Method = props_to_method(MethodName, Props, Transformers, Extra),
+-              Node = get_node(Props),
++              case get_node(Props) of
++              {error, not_member} ->
++                  N = maps:get(<<"node">>, Props, <<>>),
++                  Msg = io_lib:format("Node ~ts is not a cluster member", [N]),
++                  rabbit_log:warning(ErrorMsg, [Msg]),
++                  bad_request(list_to_binary(Msg), ReqData1, Context);
++              {ok, Node} ->
+               case rabbit_misc:rpc_call(Node, rabbit_channel, handle_method,
+                                         [Method, none, #{}, none,
+                                          VHost, User]) of
+@@ -881,6 +886,7 @@ direct_request(MethodName, Transformers, Extra, ErrorMsg, ReqData,
+                         ReqData1, Context);
+                   _      -> {true, ReqData1, Context}
+               end
++              end
+       end, ReqData, Context).
+ 
+ with_vhost_and_props(Fun, ReqData, Context) ->

diff --git a/rabbitmq-server-0028-Management-UI-tweak-the-CSP-default.patch b/rabbitmq-server-0028-Management-UI-tweak-the-CSP-default.patch
new file mode 100644
index 0000000..43ef8f8
--- /dev/null
+++ b/rabbitmq-server-0028-Management-UI-tweak-the-CSP-default.patch
@@ -0,0 +1,47 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Michael Klishin <michaelklishin@icloud.com>
+Date: Fri, 25 Sep 2026 16:58:18 -0700
+Subject: [PATCH 28/41] Management UI: tweak the CSP default
+
+(cherry picked from commit 2cc93405e5d392a791a1c91510f0b543c3324dd6)
+(cherry picked from commit 3042365de1dcf6ceeaee1ca1945f0e8c0250260c)
+(cherry picked from commit 27be68b85ec329c8d8d28949fe4a8a7f202b5c20)
+
+[Backport to 4.0.9: applied by hand. 4.0.9 keeps its script-src value,
+which still needs 'unsafe-eval' and 'unsafe-inline', and only gains
+base-uri 'none'; the reason passed to initiate_logout/2 is escaped with
+fmt_escape_html/1. Fixes CVE-2026-67421.]
+
+Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+---
+ deps/rabbitmq_management/Makefile            | 2 +-
+ deps/rabbitmq_management/priv/www/js/main.js | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/deps/rabbitmq_management/Makefile b/deps/rabbitmq_management/Makefile
+index 1aad4366fc..af76000109 100644
+--- a/deps/rabbitmq_management/Makefile
++++ b/deps/rabbitmq_management/Makefile
+@@ -12,7 +12,7 @@ define PROJECT_ENV
+ 
+ 	    {cors_allow_origins, []},
+ 	    {cors_max_age, 1800},
+-	    {content_security_policy, "script-src 'self' 'unsafe-eval' 'unsafe-inline'; object-src 'self'"},
++	    {content_security_policy, "script-src 'self' 'unsafe-eval' 'unsafe-inline'; object-src 'self'; base-uri 'none'"},
+ 	    {max_http_body_size, 10000000},
+ 	    {delegate_count, 5},
+ 	    {require_auth_for_api_reference, false}
+diff --git a/deps/rabbitmq_management/priv/www/js/main.js b/deps/rabbitmq_management/priv/www/js/main.js
+index 22c9f47bc1..8fe079083a 100644
+--- a/deps/rabbitmq_management/priv/www/js/main.js
++++ b/deps/rabbitmq_management/priv/www/js/main.js
+@@ -1438,7 +1438,7 @@ function check_bad_response(req, full_page_404) {
+ 
+         if (error == 'bad_request' || error == 'not_found' || error == 'not_authorised' || error == 'not_authorized') {
+             if ((req.status == 401 || req.status == 403) && oauth.enabled) {
+-              initiate_logout(oauth, reason);
++              initiate_logout(oauth, fmt_escape_html(reason));
+             } else {
+               show_popup('warn', fmt_escape_html(reason));
+             }

diff --git a/rabbitmq-server-0029-MQTT-Web-MQTT-refactor-socket-handling.patch b/rabbitmq-server-0029-MQTT-Web-MQTT-refactor-socket-handling.patch
new file mode 100644
index 0000000..6d61e73
--- /dev/null
+++ b/rabbitmq-server-0029-MQTT-Web-MQTT-refactor-socket-handling.patch
@@ -0,0 +1,93 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Michael Klishin <michaelklishin@icloud.com>
+Date: Mon, 13 Jul 2026 21:10:43 -0700
+Subject: [PATCH 29/41] MQTT, Web MQTT: refactor socket handling
+
+(cherry picked from commit 7a27aaa7745b59a701387e44beb20fe0c9b8e8ee)
+(cherry picked from commit a7528314840c4f8dc9904684f9f97ffa7aac6349)
+
+[Backport to 4.0.9: src applies cleanly; the proxy_protocol test suite
+changes conflict and are dropped. 4.0.9's rabbit_net does not export
+the proxy_socket/0 type that the new rabbit_mqtt_processor:init/4 spec
+refers to, so it is added to export_type. Fixes CVE-2026-67411.]
+
+Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+---
+ deps/rabbit_common/src/rabbit_net.erl                  | 2 +-
+ deps/rabbitmq_mqtt/src/rabbit_mqtt_processor.erl       | 6 ++++--
+ deps/rabbitmq_mqtt/src/rabbit_mqtt_reader.erl          | 7 ++++++-
+ deps/rabbitmq_web_mqtt/src/rabbit_web_mqtt_handler.erl | 3 ++-
+ 4 files changed, 13 insertions(+), 5 deletions(-)
+
+diff --git a/deps/rabbit_common/src/rabbit_net.erl b/deps/rabbit_common/src/rabbit_net.erl
+index 5f05b8a81c..999178dfa3 100644
+--- a/deps/rabbit_common/src/rabbit_net.erl
++++ b/deps/rabbit_common/src/rabbit_net.erl
+@@ -20,7 +20,7 @@
+ 
+ %%---------------------------------------------------------------------------
+ 
+--export_type([socket/0, ip_port/0, hostname/0]).
++-export_type([socket/0, proxy_socket/0, ip_port/0, hostname/0]).
+ 
+ -type stat_option() ::
+         'recv_cnt' | 'recv_max' | 'recv_avg' | 'recv_oct' | 'recv_dvi' |
+diff --git a/deps/rabbitmq_mqtt/src/rabbit_mqtt_processor.erl b/deps/rabbitmq_mqtt/src/rabbit_mqtt_processor.erl
+index 35a6092811..2cf38edf84 100644
+--- a/deps/rabbitmq_mqtt/src/rabbit_mqtt_processor.erl
++++ b/deps/rabbitmq_mqtt/src/rabbit_mqtt_processor.erl
+@@ -117,7 +117,7 @@
+ 
+ %% NB: If init/4 returns an error, it must clean up itself because terminate/3 will not be called.
+ -spec init(ConnectPacket :: mqtt_packet(),
+-           RawSocket :: rabbit_net:socket(),
++           Socket :: rabbit_net:socket() | rabbit_net:proxy_socket(),
+            ConnectionName :: binary(),
+            SendFun :: send_fun()) ->
+     {ok, state()} | {error, {socket_ends, any()} | reason_code()}.
+@@ -127,9 +127,11 @@ init(#mqtt_packet{fixed = #mqtt_packet_fixed{type = ?CONNECT},
+     %% Check whether peer closed the connection.
+     %% For example, this can happen when connection was blocked because of resource
+     %% alarm and client therefore disconnected due to client side CONNACK timeout.
++    %% Resolve the ends from the (possibly Proxy Protocol-aware) socket, then unwrap it
++    %% for the rest of the connection where the raw socket is expected.
+     case rabbit_net:socket_ends(Socket, inbound) of
+         {ok, SocketEnds} ->
+-            process_connect(ConnectPacket, Socket, ConnName, SendFun, SocketEnds);
++            process_connect(ConnectPacket, rabbit_net:unwrap_socket(Socket), ConnName, SendFun, SocketEnds);
+         {error, Reason} ->
+             {error, {socket_ends, Reason}}
+     end.
+diff --git a/deps/rabbitmq_mqtt/src/rabbit_mqtt_reader.erl b/deps/rabbitmq_mqtt/src/rabbit_mqtt_reader.erl
+index 74d8bd48f6..7733800e3e 100644
+--- a/deps/rabbitmq_mqtt/src/rabbit_mqtt_reader.erl
++++ b/deps/rabbitmq_mqtt/src/rabbit_mqtt_reader.erl
+@@ -331,7 +331,12 @@ process_received_bytes(Bytes, State = #state{socket = Socket,
+                                               throw({send_failed, Reason})
+                                       end
+                               end,
+-                    try rabbit_mqtt_processor:init(Packet, Socket, ConnName, SendFun) of
++                    %% Pass the proxy-aware socket so the processor resolves the ends from it
++                    InitSocket = case State#state.proxy_socket of
++                                     undefined -> Socket;
++                                     ProxySocket -> ProxySocket
++                                 end,
++                    try rabbit_mqtt_processor:init(Packet, InitSocket, ConnName, SendFun) of
+                         {ok, ProcState1} ->
+                             ?LOG_INFO("Accepted MQTT connection ~ts for client ID ~ts",
+                                       [ConnName, rabbit_mqtt_processor:info(client_id, ProcState1)]),
+diff --git a/deps/rabbitmq_web_mqtt/src/rabbit_web_mqtt_handler.erl b/deps/rabbitmq_web_mqtt/src/rabbit_web_mqtt_handler.erl
+index 3a88cf8973..8cc094c042 100644
+--- a/deps/rabbitmq_web_mqtt/src/rabbit_web_mqtt_handler.erl
++++ b/deps/rabbitmq_web_mqtt/src/rabbit_web_mqtt_handler.erl
+@@ -302,7 +302,8 @@ handle_data1(Data, State = #state{socket = Socket,
+         {ok, Packet, Rest, ParseState1} ->
+             case ProcState of
+                 connect_packet_unprocessed ->
+-                    case rabbit_mqtt_processor:init(Packet, rabbit_net:unwrap_socket(Socket),
++                    %% Pass the proxy-aware socket so the processor resolves the ends from it
++                    case rabbit_mqtt_processor:init(Packet, Socket,
+                                                     ConnName, fun send_reply/1) of
+                         {ok, ProcState1} ->
+                             ?LOG_INFO("Accepted Web MQTT connection ~ts for client ID ~ts",

diff --git a/rabbitmq-server-0030-Limit-the-number-of-user-tags-to-3.patch b/rabbitmq-server-0030-Limit-the-number-of-user-tags-to-3.patch
new file mode 100644
index 0000000..26770cc
--- /dev/null
+++ b/rabbitmq-server-0030-Limit-the-number-of-user-tags-to-3.patch
@@ -0,0 +1,201 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Michael Klishin <michaelklishin@icloud.com>
+Date: Tue, 28 Apr 2026 11:56:38 -0700
+Subject: [PATCH 30/41] Limit the number of user tags to 3
+
+The most common case is zero to two tags, so 32
+is generous and should cover the cases with
+a fair number of tags.
+
+(cherry picked from commit 01a436d255f7f883ce8e4c266fb3dfd3d16c72df)
+(cherry picked from commit 364fd78163c87b7539f85d135744ff1f4b3fde79)
+
+[Backport to 4.0.9: conflicts were context only. 4.0.9 keeps
+rabbit_log:debug/2 instead of ?LOG_DEBUG, and rabbit_mgmt_wm_user has
+no protected-user branch, so validate_tag_count/1 wraps the existing
+with_decode body. The new user_tags_count_limit_SUITE, its Makefile
+entry and the CLI and HTTP API test changes are dropped. Note that the
+cap is 32 tags despite the title. Fixes CVE-2026-67226.]
+
+Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+---
+ .../src/rabbit_auth_backend_internal.erl      | 38 +++++++++++++++----
+ .../cli/ctl/commands/set_user_tags_command.ex | 13 +++++++
+ .../src/rabbit_mgmt_wm_user.erl               | 23 ++++++++++-
+ 3 files changed, 65 insertions(+), 9 deletions(-)
+
+diff --git a/deps/rabbit/src/rabbit_auth_backend_internal.erl b/deps/rabbit/src/rabbit_auth_backend_internal.erl
+index 3f1ff6322c..c184443cf5 100644
+--- a/deps/rabbit/src/rabbit_auth_backend_internal.erl
++++ b/deps/rabbit/src/rabbit_auth_backend_internal.erl
+@@ -46,6 +46,8 @@
+ 
+ -export([hashing_module_for_user/1, expand_topic_permission/2]).
+ 
++-export([max_user_tags/0, count_user_tags/1]).
++
+ -ifdef(TEST).
+ -export([extract_user_permission_params/2,
+          extract_topic_permission_params/2]).
+@@ -68,6 +70,9 @@ hashing_module_for_user(User) ->
+     ModOrUndefined = internal_user:get_hashing_algorithm(User),
+     rabbit_password:hashing_mod(ModOrUndefined).
+ 
++%% Limit the number of tags a user can have.
++-define(MAX_USER_TAGS, 32).
++
+ -define(BLANK_PASSWORD_REJECTION_MESSAGE,
+         "user '~ts' attempted to log in with a blank password, which is prohibited by the internal authN backend. "
+         "To use TLS/x509 certificate-based authentication, see the rabbitmq_auth_mechanism_ssl plugin and configure the client to use the EXTERNAL authentication mechanism. "
+@@ -258,7 +263,7 @@ add_user_sans_validation(Username, Password, ActingUser, Limits, Tags) ->
+     HashingMod = rabbit_password:hashing_mod(),
+     PasswordHash = hash_password(HashingMod, Password),
+     User0 = internal_user:create_user(Username, PasswordHash, HashingMod),
+-    ConvertedTags = [rabbit_data_coercion:to_atom(I) || I <- Tags],
++    ConvertedTags = [rabbit_data_coercion:to_atom(I) || I <- validate_tag_count(Tags)],
+     User1 = internal_user:set_tags(User0, ConvertedTags),
+     User = case Limits of
+                undefined -> User1;
+@@ -268,7 +273,7 @@ add_user_sans_validation(Username, Password, ActingUser, Limits, Tags) ->
+ 
+ add_user_sans_validation(Username, PasswordHash, HashingMod, Tags, Limits, ActingUser) ->
+     rabbit_log:debug("Asked to create a new user '~ts' with password hash", [Username]),
+-    ConvertedTags = [rabbit_data_coercion:to_atom(I) || I <- Tags],
++    ConvertedTags = [rabbit_data_coercion:to_atom(I) || I <- validate_tag_count(Tags)],
+     User0 = internal_user:create_user(Username, PasswordHash, HashingMod),
+     User1 = internal_user:set_tags(
+               internal_user:set_password_hash(User0, PasswordHash, HashingMod),
+@@ -387,7 +392,7 @@ update_user_sans_validation(Tags, Limits) ->
+ 
+                 rabbit_log:debug("Asked to set user tags for user '~ts' to ~tp", [Username, Tags]),
+ 
+-                ConvertedTags = [rabbit_data_coercion:to_atom(I) || I <- Tags],
++                ConvertedTags = [rabbit_data_coercion:to_atom(I) || I <- validate_tag_count(Tags)],
+                 R = update_user_with_hash(Username,
+                                           hash_password(rabbit_password:hashing_mod(),
+                                                         Password),
+@@ -455,7 +460,7 @@ update_user_with_hash(Username, PasswordHash, HashingAlgorithm, ConvertedTags, L
+ -spec set_tags(rabbit_types:username(), [atom()], rabbit_types:username()) -> 'ok'.
+ 
+ set_tags(Username, Tags, ActingUser) ->
+-    ConvertedTags = [rabbit_data_coercion:to_atom(I) || I <- Tags],
++    ConvertedTags = [rabbit_data_coercion:to_atom(I) || I <- validate_tag_count(Tags)],
+     rabbit_log:debug("Asked to set user tags for user '~ts' to ~tp", [Username, ConvertedTags]),
+     try
+         R = rabbit_db_user:update(Username, fun(User) ->
+@@ -769,7 +774,7 @@ update_user_password_hash(Username, PasswordHash, Tags, Limits, User, Version) -
+     HashingAlgorithm = hashing_algorithm(User, Version),
+ 
+     Hash = rabbit_misc:b64decode_or_throw(PasswordHash),
+-    ConvertedTags = [rabbit_data_coercion:to_atom(I) || I <- Tags],
++    ConvertedTags = [rabbit_data_coercion:to_atom(I) || I <- validate_tag_count(Tags)],
+     update_user_with_hash(
+       Username, Hash, HashingAlgorithm, ConvertedTags, Limits).
+ 
+@@ -847,9 +852,28 @@ clear_user_limits(Username, LimitType, ActingUser) ->
+     notify_limit_clear(Username, ActingUser).
+ 
+ tag_list_from(Tags) when is_list(Tags) ->
+-    [to_atom(string:strip(to_list(T))) || T <- Tags];
++    [to_atom(string:strip(to_list(T))) || T <- validate_tag_count(Tags)];
+ tag_list_from(Tags) when is_binary(Tags) ->
+-    [to_atom(string:strip(T)) || T <- string:tokens(to_list(Tags), ",")].
++    [to_atom(string:strip(T)) ||
++        T <- validate_tag_count(string:tokens(to_list(Tags), ","))].
++
++validate_tag_count(Tags) when is_list(Tags), length(Tags) =< ?MAX_USER_TAGS ->
++    Tags;
++validate_tag_count(_) ->
++    throw({error, {too_many_tags, ?MAX_USER_TAGS}}).
++
++-spec max_user_tags() -> non_neg_integer().
++max_user_tags() ->
++    ?MAX_USER_TAGS.
++
++%% Counts the number of tags in either a list or a CSV binary,
++%% mirroring how `tag_list_from/1` interprets the input.
++-spec count_user_tags(Tags) -> non_neg_integer() when
++      Tags :: [term()] | binary().
++count_user_tags(Tags) when is_list(Tags) ->
++    length(Tags);
++count_user_tags(Tags) when is_binary(Tags) ->
++    length(string:tokens(to_list(Tags), ",")).
+ 
+ flatten_errors(L) ->
+     case [{F, A} || I <- lists:flatten([L]), {error, F, A} <- [I]] of
+diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_user_tags_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_user_tags_command.ex
+index ee3aabc693..c2f54f5d79 100644
+--- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_user_tags_command.ex
++++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_user_tags_command.ex
+@@ -9,12 +9,21 @@ defmodule RabbitMQ.CLI.Ctl.Commands.SetUserTagsCommand do
+ 
+   @behaviour RabbitMQ.CLI.CommandBehaviour
+ 
++  # Must match ?MAX_USER_TAGS in rabbit_auth_backend_internal.
++  @max_user_tags 32
++
+   def merge_defaults(args, opts), do: {args, opts}
+ 
+   def validate([], _) do
+     {:validation_failure, :not_enough_args}
+   end
+ 
++  def validate([_user | tags], _) when length(tags) > @max_user_tags do
++    {:validation_failure,
++     {:bad_argument,
++      "A user can have at most #{@max_user_tags} tags (received #{length(tags)})"}}
++  end
++
+   def validate(_, _), do: :ok
+ 
+   use RabbitMQ.CLI.Core.RequiresRabbitAppRunning
+@@ -37,6 +46,10 @@ defmodule RabbitMQ.CLI.Ctl.Commands.SetUserTagsCommand do
+     {:error, ExitCodes.exit_nouser(), "User \"#{username}\" does not exist"}
+   end
+ 
++  def output({:badrpc, {:EXIT, {{:nocatch, {:error, {:too_many_tags, max}}}, _stack}}}, _) do
++    {:error, "A user can have at most #{max} tags"}
++  end
++
+   use RabbitMQ.CLI.DefaultOutput
+ 
+   def usage, do: "set_user_tags <username> <tag> [...]"
+diff --git a/deps/rabbitmq_management/src/rabbit_mgmt_wm_user.erl b/deps/rabbitmq_management/src/rabbit_mgmt_wm_user.erl
+index d3691c8de3..ad890d0eab 100644
+--- a/deps/rabbitmq_management/src/rabbit_mgmt_wm_user.erl
++++ b/deps/rabbitmq_management/src/rabbit_mgmt_wm_user.erl
+@@ -49,8 +49,13 @@ accept_content(ReqData0, Context = #context{user = #user{username = ActingUser}}
+     rabbit_mgmt_util:with_decode(
+       [], ReqData0, Context,
+       fun(_, User, ReqData) ->
+-              _ = put_user(User#{name => Username}, ActingUser),
+-              {true, ReqData, Context}
++              case validate_tag_count(User) of
++                  ok ->
++                      _ = put_user(User#{name => Username}, ActingUser),
++                      {true, ReqData, Context};
++                  {error, Msg} ->
++                      rabbit_mgmt_util:bad_request(Msg, ReqData, Context)
++              end
+       end).
+ 
+ delete_resource(ReqData, Context = #context{user = #user{username = ActingUser}}) ->
+@@ -71,3 +76,17 @@ put_user(User, ActingUser) ->
+ 
+ put_user(User, Version, ActingUser) ->
+     rabbit_auth_backend_internal:put_user(User, Version, ActingUser).
++
++validate_tag_count(#{tags := Tags}) when is_list(Tags); is_binary(Tags) ->
++    Max = rabbit_auth_backend_internal:max_user_tags(),
++    case rabbit_auth_backend_internal:count_user_tags(Tags) of
++        N when N =< Max ->
++            ok;
++        N ->
++            Msg = rabbit_misc:format(
++                    "A user can have at most ~b tags (received ~b)",
++                    [Max, N]),
++            {error, iolist_to_binary(Msg)}
++    end;
++validate_tag_count(_) ->
++    ok.

diff --git a/rabbitmq-server-0031-Address-atom-exhaustion-attack.patch b/rabbitmq-server-0031-Address-atom-exhaustion-attack.patch
new file mode 100644
index 0000000..6a0325a
--- /dev/null
+++ b/rabbitmq-server-0031-Address-atom-exhaustion-attack.patch
@@ -0,0 +1,42 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Marcial Rosales <marcial.rosales@broadcom.com>
+Date: Wed, 15 Apr 2026 09:22:18 +0200
+Subject: [PATCH 31/41] Address atom exhaustion attack
+
+(cherry picked from commit ca36babb7c169c451ded51408c86673e9a312363)
+(cherry picked from commit 150bee6c33da57bce107fc373d20247003f07ed1)
+
+[Backport to 4.0.9: hand-ported: 4.0.9 filters tag scopes with a local
+matching_scopes_without_prefix/2 and its rabbit_data_coercion has no
+to_existing_atom/1, so safe_to_atom/1 calls binary_to_existing_atom/2
+directly. Tag scopes that do not name an existing atom are ignored, as
+upstream. The unit_SUITE changes are dropped. Fixes CVE-2026-66071.]
+
+Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+---
+ .../src/rabbit_auth_backend_oauth2.erl                | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/deps/rabbitmq_auth_backend_oauth2/src/rabbit_auth_backend_oauth2.erl b/deps/rabbitmq_auth_backend_oauth2/src/rabbit_auth_backend_oauth2.erl
+index cb107eb508..a6fb8e0c94 100644
+--- a/deps/rabbitmq_auth_backend_oauth2/src/rabbit_auth_backend_oauth2.erl
++++ b/deps/rabbitmq_auth_backend_oauth2/src/rabbit_auth_backend_oauth2.erl
+@@ -654,7 +654,16 @@ find_claim_in_token(Claim, Token) ->
+ tags_from(DecodedToken) ->
+     Scopes    = maps:get(?SCOPE_JWT_FIELD, DecodedToken, []),
+     TagScopes = matching_scopes_without_prefix(Scopes, ?TAG_SCOPE_PREFIX),
+-    lists:usort(lists:map(fun rabbit_data_coercion:to_atom/1, TagScopes)).
++    lists:usort(lists:filtermap(fun safe_to_atom/1, TagScopes)).
++
++safe_to_atom(Bin) when is_binary(Bin) ->
++    try
++        {true, binary_to_existing_atom(Bin, utf8)}
++    catch
++        error:badarg -> false
++    end;
++safe_to_atom(_) ->
++    false.
+ 
+ matching_scopes_without_prefix(Scopes, PrefixPattern) ->
+     PatternLength = byte_size(PrefixPattern),

diff --git a/rabbitmq-server-0032-JMS-topic-selector-bound-LIKE-pattern-matching.patch b/rabbitmq-server-0032-JMS-topic-selector-bound-LIKE-pattern-matching.patch
new file mode 100644
index 0000000..26751af
--- /dev/null
+++ b/rabbitmq-server-0032-JMS-topic-selector-bound-LIKE-pattern-matching.patch
@@ -0,0 +1,63 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Peter Lemenkov <lemenkov@gmail.com>
+Date: Wed, 4 Nov 2026 18:32:28 +0100
+Subject: [PATCH 32/41] JMS topic selector: bound LIKE pattern matching
+
+LIKE expressions in x-jms-topic binding selectors come from clients and
+are turned into PCRE patterns that sjx_evaluator ran with plain re:run/3,
+without match or recursion limits. An authenticated user that can bind
+and publish could use a pathological selector to keep scheduler CPU busy.
+
+Upstream fixed this in 051ae4f6d3 ("Use rabbit_re in JMS plugin") and
+549cfbfc19 ("Use rabbit_re for pattern matching in JMS plugin"), which
+depend on rabbit_re, a module 4.0.9 does not have. Apply the same limits
+directly: match_limit and match_limit_recursion of 50000, a 1024 byte cap
+on generated patterns, and treat a pattern that fails to compile as no
+match instead of crashing in re:run/3.
+
+Fixes CVE-2026-67413.
+
+Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+---
+ .../rabbitmq_jms_topic_exchange/src/sjx_evaluator.erl | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/deps/rabbitmq_jms_topic_exchange/src/sjx_evaluator.erl b/deps/rabbitmq_jms_topic_exchange/src/sjx_evaluator.erl
+index 94a09db7a9..0124894602 100644
+--- a/deps/rabbitmq_jms_topic_exchange/src/sjx_evaluator.erl
++++ b/deps/rabbitmq_jms_topic_exchange/src/sjx_evaluator.erl
+@@ -15,6 +15,10 @@
+ 
+ -module(sjx_evaluator).
+ 
++%% The same limits as rabbit_re in later RabbitMQ versions.
++-define(MATCH_LIMIT, 50000).
++-define(MAX_PATTERN_LENGTH, 1024).
++
+ -export([evaluate/2]).
+ %% Evaluation function
+ %%
+@@ -100,9 +104,13 @@ isLike(undefined, _Patt) -> undefined;
+ isLike(L, {regex, MP}) -> patt_match(L, MP);
+ isLike(L, {Patt, Esc}) -> patt_match(L, pattern_of(Patt, Esc)).
+ 
++patt_match(_L, error) -> false;
+ patt_match(L, MP) ->
+   BS = byte_size(L),
+-  case re:run(L, MP, [{capture, first}]) of
++  %% LIKE patterns come from client-supplied selectors, so bound backtracking.
++  case re:run(L, MP, [{capture, first},
++                      {match_limit, ?MATCH_LIMIT},
++                      {match_limit_recursion, ?MATCH_LIMIT}]) of
+     {match, [{0, BS}]} -> true;
+     _                  -> false
+   end.
+@@ -163,6 +171,7 @@ escape($\\) -> "\\\\";
+ escape(Ch)  -> Ch.
+ 
+ compile_re(error) -> error;
++compile_re(MatchMany) when length(MatchMany) > ?MAX_PATTERN_LENGTH -> error;
+ compile_re(MatchMany) ->
+     case re:compile(MatchMany)
+     of  {ok, Rx} -> Rx;

diff --git a/rabbitmq-server-0033-LDAP-handle-DN-template-values-per-RFC-4514.patch b/rabbitmq-server-0033-LDAP-handle-DN-template-values-per-RFC-4514.patch
new file mode 100644
index 0000000..e3850b2
--- /dev/null
+++ b/rabbitmq-server-0033-LDAP-handle-DN-template-values-per-RFC-4514.patch
@@ -0,0 +1,170 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Michael Klishin <michaelklishin@icloud.com>
+Date: Tue, 14 Apr 2026 16:06:18 -0700
+Subject: [PATCH 33/41] LDAP: handle DN template values per RFC 4514
+
+(cherry picked from commit 9a3c55a55979a72c755b02c50b4553e90c61f425)
+(cherry picked from commit ad3ca47accd313a4a0dbcbbe17bf60fc8f4b2614)
+
+[Backport to 4.0.9: clean cherry-pick. Prerequisite for the
+CVE-2026-67223 fix: adds rabbit_ldap_rfc4514 with fill_dn/2.]
+
+Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+---
+ .../src/rabbit_auth_backend_ldap.erl          | 23 +++++--
+ .../src/rabbit_ldap_rfc4514.erl               | 67 +++++++++++++++++++
+ 2 files changed, 83 insertions(+), 7 deletions(-)
+ create mode 100644 deps/rabbitmq_auth_backend_ldap/src/rabbit_ldap_rfc4514.erl
+
+diff --git a/deps/rabbitmq_auth_backend_ldap/src/rabbit_auth_backend_ldap.erl b/deps/rabbitmq_auth_backend_ldap/src/rabbit_auth_backend_ldap.erl
+index f5ee514f05..68a2438d84 100644
+--- a/deps/rabbitmq_auth_backend_ldap/src/rabbit_auth_backend_ldap.erl
++++ b/deps/rabbitmq_auth_backend_ldap/src/rabbit_auth_backend_ldap.erl
+@@ -235,7 +235,7 @@ evaluate0({for, []}, _Args, _User, _LDAP) ->
+ evaluate0({exists, DNPattern}, Args, _User, LDAP) ->
+     %% eldap forces us to have a filter. objectClass should always be there.
+     Filter = eldap:present("objectClass"),
+-    DN = fill(DNPattern, Args),
++    DN = fill_dn(DNPattern, Args),
+     R = object_exists(DN, Filter, LDAP),
+     ?L1("evaluated exists for \"~ts\": ~tp", [DN, R]),
+     R;
+@@ -247,7 +247,7 @@ evaluate0({in_group, DNPattern, Desc}, Args,
+           #auth_user{impl = ImplFun}, LDAP) ->
+     UserDN = (ImplFun())#impl.user_dn,
+     Filter = eldap:equalityMatch(Desc, UserDN),
+-    DN = fill(DNPattern, Args),
++    DN = fill_dn(DNPattern, Args),
+     R = object_exists(DN, Filter, LDAP),
+     ?L1("evaluated in_group for \"~ts\": ~tp", [DN, R]),
+     R;
+@@ -266,7 +266,7 @@ evaluate0({in_group_nested, DNPattern, Desc, Scope}, Args,
+                      B ->
+                          B
+                  end,
+-    GroupDN = fill(DNPattern, Args),
++    GroupDN = fill_dn(DNPattern, Args),
+     EldapScope =
+         case Scope of
+             subtree      -> eldap:wholeSubtree();
+@@ -357,7 +357,7 @@ evaluate0({string, StringPattern}, Args, _User, _LDAP) ->
+     R;
+ 
+ evaluate0({attribute, DNPattern, AttributeName}, Args, _User, LDAP) ->
+-    DN = fill(DNPattern, Args),
++    DN = fill_dn(DNPattern, Args),
+     R = attribute(DN, AttributeName, LDAP),
+     ?L1("evaluated attribute \"~ts\" for \"~ts\": ~tp",
+         [AttributeName, DN, format_multi_attr(R)]),
+@@ -868,7 +868,9 @@ username_to_dn_prebind(Username) ->
+               fun (LDAP) -> dn_lookup(Username, LDAP) end).
+ 
+ username_to_dn(Username, LDAP,  postbind) -> dn_lookup(Username, LDAP);
+-username_to_dn(Username, _LDAP, _When)    -> fill_user_dn_pattern(Username).
++username_to_dn(Username, _LDAP, _When)    ->
++    ADArgs = rabbit_auth_backend_ldap_util:get_active_directory_args(Username),
++    fill_dn(env(user_dn_pattern), [{username, Username}] ++ ADArgs).
+ 
+ dn_lookup(Username, LDAP) ->
+     Filled = fill_user_dn_pattern(Username),
+@@ -899,10 +901,11 @@ simple_bind_fill_pattern(Username) ->
+     simple_bind_fill_pattern(env(user_bind_pattern), Username).
+ 
+ simple_bind_fill_pattern(none, Username) ->
+-    fill_user_dn_pattern(Username);
++    ADArgs = rabbit_auth_backend_ldap_util:get_active_directory_args(Username),
++    fill_dn(env(user_dn_pattern), [{username, Username}] ++ ADArgs);
+ simple_bind_fill_pattern(Pattern, Username) ->
+     ADArgs = rabbit_auth_backend_ldap_util:get_active_directory_args(Username),
+-    fill(Pattern, [{username, Username}] ++ ADArgs).
++    fill_dn(Pattern, [{username, Username}] ++ ADArgs).
+ 
+ creds(User) -> creds(User, env(other_bind)).
+ 
+@@ -972,6 +975,12 @@ fill(Fmt, Args) ->
+     ?L2("template result: \"~ts\"", [R]),
+     R.
+ 
++fill_dn(Fmt, Args) ->
++    ?L2("filling DN template \"~ts\" with~n            ~tp", [Fmt, Args]),
++    R = rabbit_ldap_rfc4514:fill_dn(Fmt, Args),
++    ?L2("DN template result: \"~ts\"", [R]),
++    R.
++
+ log_result({ok, #auth_user{}}) -> ok;
+ log_result(true)               -> ok;
+ log_result(false)              -> denied;
+diff --git a/deps/rabbitmq_auth_backend_ldap/src/rabbit_ldap_rfc4514.erl b/deps/rabbitmq_auth_backend_ldap/src/rabbit_ldap_rfc4514.erl
+new file mode 100644
+index 0000000000..6cb2f13262
+--- /dev/null
++++ b/deps/rabbitmq_auth_backend_ldap/src/rabbit_ldap_rfc4514.erl
+@@ -0,0 +1,67 @@
++%% This Source Code Form is subject to the terms of the Mozilla Public
++%% License, v. 2.0. If a copy of the MPL was not distributed with this
++%% file, You can obtain one at https://mozilla.org/MPL/2.0/.
++%%
++%% Copyright (c) 2007-2026 Broadcom. All Rights Reserved. The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
++%%
++
++%% RFC 4514 — String Representation of Distinguished Names.
++%%
++%% This module escapes values for safe inclusion in DN attribute value
++%% positions, preventing DN injection when untrusted input (usernames,
++%% vhost names, resource names) is substituted into DN templates.
++-module(rabbit_ldap_rfc4514).
++
++-export([escape_value/1, fill_dn/2]).
++
++%% Fills an LDAP DN template with RFC 4514-escaped substitution values.
++%%
++%% Delegates to rabbit_auth_backend_ldap_util:fill/2 after escaping all
++%% values. The `user_dn' key is excluded from escaping because it holds
++%% a complete Distinguished Name (from a prior LDAP lookup or DN
++%% pattern fill), not a component value.
++-spec fill_dn(string(), [{atom(), term()}]) -> string().
++fill_dn(Fmt, Args) ->
++    rabbit_auth_backend_ldap_util:fill(
++      Fmt, [{K, escape_arg(K, V)} || {K, V} <- Args]).
++
++escape_arg(user_dn, V) -> V;
++escape_arg(_, V)        -> escape_value(V).
++
++%% Escapes a value for safe inclusion in an RFC 4514 DN attribute value.
++%%
++%% Per Section 2.4, the following are backslash-escaped:
++%%   - Characters: , + " \ < > ; and NUL
++%%   - A leading SPACE or #
++%%   - A trailing SPACE
++-spec escape_value(term()) -> term().
++escape_value(V) when is_binary(V) ->
++    list_to_binary(escape_value(binary_to_list(V)));
++escape_value(V) when is_atom(V) ->
++    escape_value(atom_to_list(V));
++escape_value([]) ->
++    [];
++escape_value([H | T]) when H =:= $\s; H =:= $# ->
++    [$\\, H | escape_middle(T)];
++escape_value(V) when is_list(V) ->
++    escape_middle(V);
++escape_value(V) ->
++    V.
++
++escape_middle([])      -> [];
++escape_middle([$\s])   -> [$\\, $\s];
++escape_middle([H | T]) ->
++    case is_special(H) of
++        true  -> [$\\, H | escape_middle(T)];
++        false -> [H | escape_middle(T)]
++    end.
++
++is_special($,)  -> true;
++is_special($+)  -> true;
++is_special($")  -> true;
++is_special($\\) -> true;
++is_special($<)  -> true;
++is_special($>)  -> true;
++is_special($;)  -> true;
++is_special(0)   -> true;
++is_special(_)   -> false.

diff --git a/rabbitmq-server-0034-A-follow-up-to-16101.patch b/rabbitmq-server-0034-A-follow-up-to-16101.patch
new file mode 100644
index 0000000..fc800e6
--- /dev/null
+++ b/rabbitmq-server-0034-A-follow-up-to-16101.patch
@@ -0,0 +1,107 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Michael Klishin <michaelklishin@icloud.com>
+Date: Wed, 17 Jun 2026 11:31:35 -0700
+Subject: [PATCH 34/41] A follow-up to #16101
+
+Refactor, deeper integrate the RFC 4514 escaping
+of the DN and its "components".
+
+(cherry picked from commit 36f636ca3a254fb25f9cd1d4a735fdabdc5be405)
+(cherry picked from commit 22d43308cd0575e0aba0441f6badcd199c302189)
+
+[Backport to 4.0.9: one conflict in dn_lookup/2: 4.0.9 logs with
+rabbit_log_ldap:warning/2, which is kept, and the fallback now returns
+escaped_user_dn(Username). Fixes CVE-2026-67223.]
+
+Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+---
+ .../src/rabbit_auth_backend_ldap.erl          | 19 ++++++++++++-------
+ .../src/rabbit_auth_backend_ldap_util.erl     |  3 +++
+ .../src/rabbit_ldap_rfc4514.erl               |  4 ++--
+ 3 files changed, 17 insertions(+), 9 deletions(-)
+
+diff --git a/deps/rabbitmq_auth_backend_ldap/src/rabbit_auth_backend_ldap.erl b/deps/rabbitmq_auth_backend_ldap/src/rabbit_auth_backend_ldap.erl
+index 68a2438d84..87e491d7f0 100644
+--- a/deps/rabbitmq_auth_backend_ldap/src/rabbit_auth_backend_ldap.erl
++++ b/deps/rabbitmq_auth_backend_ldap/src/rabbit_auth_backend_ldap.erl
+@@ -23,7 +23,8 @@
+ -export([get_connections/0]).
+ 
+ %% for tests
+--export([purge_connections/0]).
++-export([purge_connections/0,
++         fill_user_dn_pattern/1, escaped_user_dn/1]).
+ 
+ -define(L(F, A),  log("LDAP "         ++ F, A)).
+ -define(L1(F, A), log("    LDAP "     ++ F, A)).
+@@ -868,9 +869,7 @@ username_to_dn_prebind(Username) ->
+               fun (LDAP) -> dn_lookup(Username, LDAP) end).
+ 
+ username_to_dn(Username, LDAP,  postbind) -> dn_lookup(Username, LDAP);
+-username_to_dn(Username, _LDAP, _When)    ->
+-    ADArgs = rabbit_auth_backend_ldap_util:get_active_directory_args(Username),
+-    fill_dn(env(user_dn_pattern), [{username, Username}] ++ ADArgs).
++username_to_dn(Username, _LDAP, _When)    -> escaped_user_dn(Username).
+ 
+ dn_lookup(Username, LDAP) ->
+     Filled = fill_user_dn_pattern(Username),
+@@ -888,7 +887,8 @@ dn_lookup(Username, LDAP) ->
+         {ok, {eldap_search_result, Entries, _Referrals, _Controls}} ->
+             rabbit_log_ldap:warning("Searching for DN for ~ts, got back ~tp",
+                                [Filled, Entries]),
+-            Filled;
++            %% Used as a bind DN, so RFC 4514-escape substituted values.
++            escaped_user_dn(Username);
+         {error, _} = E ->
+             exit(E)
+     end.
+@@ -897,12 +897,17 @@ fill_user_dn_pattern(Username) ->
+     ADArgs = rabbit_auth_backend_ldap_util:get_active_directory_args(Username),
+     fill(env(user_dn_pattern), [{username, Username}] ++ ADArgs).
+ 
++%% The user DN built from `user_dn_pattern' with RFC 4514-escaped
++%% substitutions. A no-op for usernames without DN-special characters.
++escaped_user_dn(Username) ->
++    ADArgs = rabbit_auth_backend_ldap_util:get_active_directory_args(Username),
++    fill_dn(env(user_dn_pattern), [{username, Username}] ++ ADArgs).
++
+ simple_bind_fill_pattern(Username) ->
+     simple_bind_fill_pattern(env(user_bind_pattern), Username).
+ 
+ simple_bind_fill_pattern(none, Username) ->
+-    ADArgs = rabbit_auth_backend_ldap_util:get_active_directory_args(Username),
+-    fill_dn(env(user_dn_pattern), [{username, Username}] ++ ADArgs);
++    escaped_user_dn(Username);
+ simple_bind_fill_pattern(Pattern, Username) ->
+     ADArgs = rabbit_auth_backend_ldap_util:get_active_directory_args(Username),
+     fill_dn(Pattern, [{username, Username}] ++ ADArgs).
+diff --git a/deps/rabbitmq_auth_backend_ldap/src/rabbit_auth_backend_ldap_util.erl b/deps/rabbitmq_auth_backend_ldap/src/rabbit_auth_backend_ldap_util.erl
+index 533924ee68..8f5c6b1f9e 100644
+--- a/deps/rabbitmq_auth_backend_ldap/src/rabbit_auth_backend_ldap_util.erl
++++ b/deps/rabbitmq_auth_backend_ldap/src/rabbit_auth_backend_ldap_util.erl
+@@ -9,6 +9,9 @@
+ 
+ -export([fill/2, get_active_directory_args/1]).
+ 
++%% Raw substitution without escaping. Safe only for non-DN sinks (ACL string
++%% comparisons, eldap:equalityMatch/2 filter values). To build a DN, use
++%% rabbit_ldap_rfc4514:fill_dn/2, which RFC 4514-escapes substituted values.
+ fill(Fmt, []) ->
+     binary_to_list(iolist_to_binary(Fmt));
+ 
+diff --git a/deps/rabbitmq_auth_backend_ldap/src/rabbit_ldap_rfc4514.erl b/deps/rabbitmq_auth_backend_ldap/src/rabbit_ldap_rfc4514.erl
+index 6cb2f13262..fd6c795047 100644
+--- a/deps/rabbitmq_auth_backend_ldap/src/rabbit_ldap_rfc4514.erl
++++ b/deps/rabbitmq_auth_backend_ldap/src/rabbit_ldap_rfc4514.erl
+@@ -8,8 +8,8 @@
+ %% RFC 4514 — String Representation of Distinguished Names.
+ %%
+ %% This module escapes values for safe inclusion in DN attribute value
+-%% positions, preventing DN injection when untrusted input (usernames,
+-%% vhost names, resource names) is substituted into DN templates.
++%% positions when input such as usernames, vhost names, or resource names is
++%% substituted into DN templates.
+ -module(rabbit_ldap_rfc4514).
+ 
+ -export([escape_value/1, fill_dn/2]).

diff --git a/rabbitmq-server-0035-ldap-escape-down-level-logon-names-by-parts.patch b/rabbitmq-server-0035-ldap-escape-down-level-logon-names-by-parts.patch
new file mode 100644
index 0000000..5da88d8
--- /dev/null
+++ b/rabbitmq-server-0035-ldap-escape-down-level-logon-names-by-parts.patch
@@ -0,0 +1,136 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Aitor Perez <1515757+Zerpet@users.noreply.github.com>
+Date: Thu, 20 Aug 2026 16:34:12 +0200
+Subject: [PATCH 35/41] ldap: escape down-level logon names by parts
+
+In Active Directory, it is still possible to login using the Down-Level
+Logon name (DOMAIN\username). Prior to applying RFC 4514 DN escaping,
+the plugin passed the username verbatim, allowing the DL Logon name to
+succeed. After escaping all username unconditionally, valid DL Logon
+names are unable to login via LDAP plugin.
+
+This commit fixes this regression by detecting a Down-Level Logon name,
+escaping each part separately, and then joining them. Any other form of
+username is escaped as before.
+
+(cherry picked from commit 95bd5a612662ebef37a98a24e611b56d6fa68a34)
+(cherry picked from commit bef90e9f2255b64e148af6303577e49fd309b24a)
+
+[Backport to 4.0.9: the util module conflict pulled in parse_query/1
+and its helpers, which belong to a later feature; only the
+get_active_directory_args/1 rework is applied. The unit_SUITE changes
+are dropped. Needed with the CVE-2026-67223 fix so that DOMAIN\user
+logins keep working.]
+
+Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+---
+ .../src/rabbit_auth_backend_ldap.erl          | 48 +++++++++++++++++--
+ .../src/rabbit_auth_backend_ldap_util.erl     | 22 ++++++---
+ 2 files changed, 59 insertions(+), 11 deletions(-)
+
+diff --git a/deps/rabbitmq_auth_backend_ldap/src/rabbit_auth_backend_ldap.erl b/deps/rabbitmq_auth_backend_ldap/src/rabbit_auth_backend_ldap.erl
+index 87e491d7f0..db043e5634 100644
+--- a/deps/rabbitmq_auth_backend_ldap/src/rabbit_auth_backend_ldap.erl
++++ b/deps/rabbitmq_auth_backend_ldap/src/rabbit_auth_backend_ldap.erl
+@@ -24,7 +24,7 @@
+ 
+ %% for tests
+ -export([purge_connections/0,
+-         fill_user_dn_pattern/1, escaped_user_dn/1]).
++         fill_user_dn_pattern/1, escaped_user_dn/1, simple_bind_fill_pattern/1]).
+ 
+ -define(L(F, A),  log("LDAP "         ++ F, A)).
+ -define(L1(F, A), log("    LDAP "     ++ F, A)).
+@@ -900,8 +900,7 @@ fill_user_dn_pattern(Username) ->
+ %% The user DN built from `user_dn_pattern' with RFC 4514-escaped
+ %% substitutions. A no-op for usernames without DN-special characters.
+ escaped_user_dn(Username) ->
+-    ADArgs = rabbit_auth_backend_ldap_util:get_active_directory_args(Username),
+-    fill_dn(env(user_dn_pattern), [{username, Username}] ++ ADArgs).
++    fill_bind_dn(env(user_dn_pattern), Username).
+ 
+ simple_bind_fill_pattern(Username) ->
+     simple_bind_fill_pattern(env(user_bind_pattern), Username).
+@@ -909,8 +908,49 @@ simple_bind_fill_pattern(Username) ->
+ simple_bind_fill_pattern(none, Username) ->
+     escaped_user_dn(Username);
+ simple_bind_fill_pattern(Pattern, Username) ->
++    fill_bind_dn(Pattern, Username).
++
++%% Fills a bind-identity DN pattern (`user_dn_pattern'/`user_bind_pattern')
++%% with an RFC 4514-escaped `username', then any remaining `ad_domain'/
++%% `ad_user' substitutions.
++%%
++%% `${username}' is pre-filled separately (rather than via `fill_dn') so
++%% that AD down-level logon names ("DOMAIN\user") can be escaped
++%% component-wise: see escaped_username_value/2.
++fill_bind_dn(Pattern, Username) ->
+     ADArgs = rabbit_auth_backend_ldap_util:get_active_directory_args(Username),
+-    fill_dn(Pattern, [{username, Username}] ++ ADArgs).
++    Pattern1 = fill(Pattern, [{username, escaped_username_value(Username, ADArgs)}]),
++    fill_dn(Pattern1, ADArgs).
++
++%% AD down-level logon names ("DOMAIN\user") use backslash as a domain
++%% separator, not DN-attribute data. Escaping it per RFC 4514 would double
++%% it, breaking the bind against AD (RMQ-4282). Escape the domain and user
++%% components independently instead, and rejoin them with a literal
++%% backslash, so any other RFC 4514-special character in either component
++%% is still escaped.
++%%
++%% A username with more than one backslash isn't a valid down-level logon
++%% name -- which one would be the separator is ambiguous -- so it falls
++%% through to whole-value escaping, same as a username with none.
++%%
++%% The same fallback applies when the escaped user part starts with a
++%% backslash (its first character is itself RFC 4514-special): that
++%% backslash would sit right after the domain-separator backslash, and a
++%% DN parser reads the pair as one escaped literal backslash, leaving the
++%% special character that follows unescaped and able to inject a new DN
++%% component.
++escaped_username_value(Username, [{ad_domain, Domain}, {ad_user, User}]) ->
++    UserList = rabbit_data_coercion:to_list(User),
++    EscapedUser = rabbit_ldap_rfc4514:escape_value(UserList),
++    case lists:member($\\, UserList) orelse lists:prefix("\\", EscapedUser) of
++        false ->
++            rabbit_ldap_rfc4514:escape_value(rabbit_data_coercion:to_list(Domain)) ++
++            "\\" ++ EscapedUser;
++        true ->
++            escaped_username_value(Username, [])
++    end;
++escaped_username_value(Username, []) ->
++    rabbit_ldap_rfc4514:escape_value(Username).
+ 
+ creds(User) -> creds(User, env(other_bind)).
+ 
+diff --git a/deps/rabbitmq_auth_backend_ldap/src/rabbit_auth_backend_ldap_util.erl b/deps/rabbitmq_auth_backend_ldap/src/rabbit_auth_backend_ldap_util.erl
+index 8f5c6b1f9e..87551fe82d 100644
+--- a/deps/rabbitmq_auth_backend_ldap/src/rabbit_auth_backend_ldap_util.erl
++++ b/deps/rabbitmq_auth_backend_ldap/src/rabbit_auth_backend_ldap_util.erl
+@@ -27,11 +27,19 @@ to_repl([$&  | T])           -> [$\\, $&  | to_repl(T)];
+ to_repl([H   | T])           -> [H        | to_repl(T)];
+ to_repl(_)                   -> []. % fancy variables like peer IP are just ignored
+ 
+-get_active_directory_args([ADDomain, ADUser]) ->
+-    [{ad_domain, ADDomain}, {ad_user, ADUser}];
+-get_active_directory_args(Parts) when is_list(Parts) ->
+-    [];
++%% If Username is in Domain\User format, provide additional fill template
++%% arguments.
++%%
++%% Only binary Usernames are split: a 2-element split/1 result is only
++%% meaningful for a genuine Domain\User binary, and matching on any
++%% 2-element list here would also (mis)fire for an unrelated plain-string
++%% Username of exactly two characters.
+ get_active_directory_args(Username) when is_binary(Username) ->
+-    % If Username is in Domain\User format, provide additional fill
+-    % template arguments
+-    get_active_directory_args(binary:split(Username, <<"\\">>, [trim_all])).
++    split_active_directory_args(binary:split(Username, <<"\\">>, [trim_all]));
++get_active_directory_args(_Username) ->
++    [].
++
++split_active_directory_args([ADDomain, ADUser]) ->
++    [{ad_domain, ADDomain}, {ad_user, ADUser}];
++split_active_directory_args(_Parts) ->
++    [].

diff --git a/rabbitmq-server-0036-LDAP-escape-DN-template-values-not-whole-non-DN-bind.patch b/rabbitmq-server-0036-LDAP-escape-DN-template-values-not-whole-non-DN-bind.patch
new file mode 100644
index 0000000..effe260
--- /dev/null
+++ b/rabbitmq-server-0036-LDAP-escape-DN-template-values-not-whole-non-DN-bind.patch
@@ -0,0 +1,132 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Michael Klishin <michaelklishin@icloud.com>
+Date: Mon, 31 Aug 2026 15:09:56 -0700
+Subject: [PATCH 36/41] LDAP: escape DN template values, not whole non-DN bind
+ names
+
+RFC 4514 escaping preventing path traversals was a bit
+too strict for certain common Active Directory
+scenarios (setups).
+
+References #16101, #16712, #17220.
+
+Close #17277.
+Close #17271.
+
+(cherry picked from commit d6ca7b0df9c16f3e0d77cbff7b8c0670ba64c750)
+(cherry picked from commit 0e8aa863d2ecd0c715b4148ab982801e003ad071)
+
+[Backport to 4.0.9: upstream reworks fill_bind_dn/2 here and drops the
+per-component escaping added by bef90e9f22. Both conflict hunks take
+the upstream side, and safe_ad_args/1 is made identical to v4.3.6,
+since the shared context between the hunks left part of the removed
+escaped_username_value/2 inside it. The unit_SUITE changes are dropped.
+Needed with the CVE-2026-67223 fix so that non-DN bind names
+(userPrincipalName, down-level logon names) are not RFC 4514-escaped.]
+
+Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+---
+ .../src/rabbit_auth_backend_ldap.erl          | 75 +++++++++----------
+ 1 file changed, 36 insertions(+), 39 deletions(-)
+
+diff --git a/deps/rabbitmq_auth_backend_ldap/src/rabbit_auth_backend_ldap.erl b/deps/rabbitmq_auth_backend_ldap/src/rabbit_auth_backend_ldap.erl
+index db043e5634..684ca0da83 100644
+--- a/deps/rabbitmq_auth_backend_ldap/src/rabbit_auth_backend_ldap.erl
++++ b/deps/rabbitmq_auth_backend_ldap/src/rabbit_auth_backend_ldap.erl
+@@ -894,11 +894,8 @@ dn_lookup(Username, LDAP) ->
+     end.
+ 
+ fill_user_dn_pattern(Username) ->
+-    ADArgs = rabbit_auth_backend_ldap_util:get_active_directory_args(Username),
+-    fill(env(user_dn_pattern), [{username, Username}] ++ ADArgs).
++    fill_raw(env(user_dn_pattern), Username).
+ 
+-%% The user DN built from `user_dn_pattern' with RFC 4514-escaped
+-%% substitutions. A no-op for usernames without DN-special characters.
+ escaped_user_dn(Username) ->
+     fill_bind_dn(env(user_dn_pattern), Username).
+ 
+@@ -910,47 +907,47 @@ simple_bind_fill_pattern(none, Username) ->
+ simple_bind_fill_pattern(Pattern, Username) ->
+     fill_bind_dn(Pattern, Username).
+ 
+-%% Fills a bind-identity DN pattern (`user_dn_pattern'/`user_bind_pattern')
+-%% with an RFC 4514-escaped `username', then any remaining `ad_domain'/
+-%% `ad_user' substitutions.
+-%%
+-%% `${username}' is pre-filled separately (rather than via `fill_dn') so
+-%% that AD down-level logon names ("DOMAIN\user") can be escaped
+-%% component-wise: see escaped_username_value/2.
+ fill_bind_dn(Pattern, Username) ->
++    case is_dn_pattern(Pattern) of
++        true  -> fill_dn_pattern(Pattern, Username, []);
++        false -> fill_raw(Pattern, Username)
++    end.
++
++fill_raw(Pattern, Username) ->
+     ADArgs = rabbit_auth_backend_ldap_util:get_active_directory_args(Username),
+-    Pattern1 = fill(Pattern, [{username, escaped_username_value(Username, ADArgs)}]),
+-    fill_dn(Pattern1, ADArgs).
+-
+-%% AD down-level logon names ("DOMAIN\user") use backslash as a domain
+-%% separator, not DN-attribute data. Escaping it per RFC 4514 would double
+-%% it, breaking the bind against AD (RMQ-4282). Escape the domain and user
+-%% components independently instead, and rejoin them with a literal
+-%% backslash, so any other RFC 4514-special character in either component
+-%% is still escaped.
+-%%
+-%% A username with more than one backslash isn't a valid down-level logon
+-%% name -- which one would be the separator is ambiguous -- so it falls
+-%% through to whole-value escaping, same as a username with none.
+-%%
+-%% The same fallback applies when the escaped user part starts with a
+-%% backslash (its first character is itself RFC 4514-special): that
+-%% backslash would sit right after the domain-separator backslash, and a
+-%% DN parser reads the pair as one escaped literal backslash, leaving the
+-%% special character that follows unescaped and able to inject a new DN
+-%% component.
+-escaped_username_value(Username, [{ad_domain, Domain}, {ad_user, User}]) ->
++    fill(Pattern, [{username, Username}] ++ ADArgs).
++
++%% A DN always contains an `attr=value' pair. A pattern without one produces
++%% a bind name that is not a DN — a complete DN supplied as the username, a
++%% userPrincipalName, a down-level logon name — and RFC 4514 escaping would
++%% corrupt such names.
++is_dn_pattern(Pattern) ->
++    lists:member($=, rabbit_data_coercion:to_list(Pattern)).
++
++fill_dn_with_username(DNPattern, Args) ->
++    Username = pget(username, Args),
++    OtherArgs = [KV || {K, _} = KV <- Args,
++                       K =/= username, K =/= ad_domain, K =/= ad_user],
++    fill_dn_pattern(DNPattern, Username, OtherArgs).
++
++fill_dn_pattern(Pattern, Username, OtherArgs) ->
++    ADArgs = safe_ad_args(
++               rabbit_auth_backend_ldap_util:get_active_directory_args(Username)),
++    fill_dn(Pattern, [{username, Username}] ++ ADArgs ++ OtherArgs).
++
++%% Rejects an unusable "DOMAIN\user" split: a backslash in the user part
++%% makes the separator ambiguous, and an escaped user part starting with a
++%% backslash would pair with a preceding literal one, un-escaping the
++%% character after it (a DN injection). The AD variables then stay unfilled.
++safe_ad_args([{ad_domain, _}, {ad_user, User}] = ADArgs) ->
+     UserList = rabbit_data_coercion:to_list(User),
+     EscapedUser = rabbit_ldap_rfc4514:escape_value(UserList),
+     case lists:member($\\, UserList) orelse lists:prefix("\\", EscapedUser) of
+-        false ->
+-            rabbit_ldap_rfc4514:escape_value(rabbit_data_coercion:to_list(Domain)) ++
+-            "\\" ++ EscapedUser;
+-        true ->
+-            escaped_username_value(Username, [])
++        false -> ADArgs;
++        true  -> []
+     end;
+-escaped_username_value(Username, []) ->
+-    rabbit_ldap_rfc4514:escape_value(Username).
++safe_ad_args([]) ->
++    [].
+ 
+ creds(User) -> creds(User, env(other_bind)).
+ 

diff --git a/rabbitmq-server-0037-Web-MQTT-Web-STOMP-enforce-login-timeout-for-WebSock.patch b/rabbitmq-server-0037-Web-MQTT-Web-STOMP-enforce-login-timeout-for-WebSock.patch
new file mode 100644
index 0000000..7769e5b
--- /dev/null
+++ b/rabbitmq-server-0037-Web-MQTT-Web-STOMP-enforce-login-timeout-for-WebSock.patch
@@ -0,0 +1,48 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Michael Klishin <michaelklishin@icloud.com>
+Date: Tue, 14 Apr 2026 19:02:42 -0700
+Subject: [PATCH 37/41] Web MQTT, Web STOMP: enforce login timeout for
+ WebSocket connections
+
+(cherry picked from commit f4fff6c87a357ec73eee3f83e72e0a54582d044f)
+
+(cherry picked from commit 3ff40e40817e11b4504854f7c1ebbd2b507803c5)
+
+[Backport to 4.0.9: only the Web STOMP part is applied; the Web MQTT
+handler change and the new login timeout test suites are not taken. The
+stomp.login_timeout setting already exists in 4.0.9. Part of the
+CVE-2026-67230 fix.]
+
+Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+---
+ deps/rabbitmq_web_stomp/src/rabbit_web_stomp_handler.erl | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/deps/rabbitmq_web_stomp/src/rabbit_web_stomp_handler.erl b/deps/rabbitmq_web_stomp/src/rabbit_web_stomp_handler.erl
+index 5f98feaf25..14599527b3 100644
+--- a/deps/rabbitmq_web_stomp/src/rabbit_web_stomp_handler.erl
++++ b/deps/rabbitmq_web_stomp/src/rabbit_web_stomp_handler.erl
+@@ -98,6 +98,8 @@ init(Req0, Opts) ->
+ websocket_init(State) ->
+     process_flag(trap_exit, true),
+     {ok, ProcessorState} = init_processor_state(State),
++    LoginTimeout = application:get_env(rabbitmq_stomp, login_timeout, 10_000),
++    erlang:send_after(LoginTimeout, self(), login_timeout),
+     {ok, rabbit_event:init_stats_timer(
+            State#state{proc_state     = ProcessorState,
+                        parse_state    = rabbit_stomp_frame:initial_state()},
+@@ -241,6 +243,13 @@ websocket_info(close_websocket, State) ->
+ websocket_info(emit_stats, State) ->
+     {ok, emit_stats(State)};
+ 
++websocket_info(login_timeout, State = #state{connection = C})
++  when C =:= none; C =:= undefined ->
++    ?LOG_ERROR("Web STOMP: closing connection (login timeout)"),
++    stop(State);
++websocket_info(login_timeout, State) ->
++    {ok, State};
++
+ websocket_info(Msg, State) ->
+     rabbit_log_connection:info("Web STOMP: unexpected message ~tp",
+                     [Msg]),

diff --git a/rabbitmq-server-0038-Web-MQTT-Web-STOMP-set-Cowboy-s-max_frame_size.patch b/rabbitmq-server-0038-Web-MQTT-Web-STOMP-set-Cowboy-s-max_frame_size.patch
new file mode 100644
index 0000000..04e31e0
--- /dev/null
+++ b/rabbitmq-server-0038-Web-MQTT-Web-STOMP-set-Cowboy-s-max_frame_size.patch
@@ -0,0 +1,45 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Michael Klishin <michaelklishin@icloud.com>
+Date: Mon, 13 Apr 2026 19:08:30 -0700
+Subject: [PATCH 38/41] Web MQTT, Web STOMP: set Cowboy's `max_frame_size`
+
+Conflicts:
+	deps/rabbitmq_web_mqtt/src/rabbit_web_mqtt_handler.erl
+	deps/rabbitmq_web_stomp/src/rabbit_web_stomp_handler.erl
+
+(cherry picked from commit d1d34f83c179cbf9f656389c0ec4477d994833a0)
+
+(cherry picked from commit 205680bf7c42ae33170bd1a6f8d75fec364f475e)
+
+[Backport to 4.0.9: only the Web STOMP part is applied, by hand because
+4.0.9's init/2 has no check_origin wrapper. Cowboy's WebSocket
+max_frame_size is set once at init to the STOMP max_frame_size plus
+4096 bytes. The later 593842bc27 ('Web STOMP: align these limits with
+Web MQTT') lowers this to 64 KiB before authentication and raises it
+after login through a set_options command, but Cowboy 2.12.0, bundled
+with 4.0.9, ignores max_frame_size in set_options, so that change is
+not taken. Together with the login timeout this bounds unauthenticated
+Web STOMP connections in time and in frame size. Fixes CVE-2026-67230.]
+
+Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+---
+ deps/rabbitmq_web_stomp/src/rabbit_web_stomp_handler.erl | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/deps/rabbitmq_web_stomp/src/rabbit_web_stomp_handler.erl b/deps/rabbitmq_web_stomp/src/rabbit_web_stomp_handler.erl
+index 14599527b3..79fa38ade9 100644
+--- a/deps/rabbitmq_web_stomp/src/rabbit_web_stomp_handler.erl
++++ b/deps/rabbitmq_web_stomp/src/rabbit_web_stomp_handler.erl
+@@ -82,7 +82,10 @@ init(Req0, Opts) ->
+             end
+     end,
+     WsOpts0 = proplists:get_value(ws_opts, Opts, #{}),
+-    WsOpts  = maps:merge(#{compress => true}, WsOpts0),
++    MaxFrameSize = application:get_env(
++        rabbitmq_stomp, max_frame_size, ?DEFAULT_MAX_FRAME_SIZE) + 4096,
++    WsOpts = maps:merge(#{compress => true,
++                           max_frame_size => MaxFrameSize}, WsOpts0),
+     {?MODULE, Req, #state{
+         frame_type         = proplists:get_value(type, Opts, text),
+         heartbeat_sup      = KeepaliveSup,

diff --git a/rabbitmq-server-0039-Implement-a-stream-reader-TODO.patch b/rabbitmq-server-0039-Implement-a-stream-reader-TODO.patch
new file mode 100644
index 0000000..83bc1ba
--- /dev/null
+++ b/rabbitmq-server-0039-Implement-a-stream-reader-TODO.patch
@@ -0,0 +1,187 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Michael Klishin <michaelklishin@icloud.com>
+Date: Fri, 10 Apr 2026 20:13:10 -0700
+Subject: [PATCH 39/41] Implement a stream reader TODO
+
+(cherry picked from commit e6c184a7c98bad6847f099023a73c1f9f37d3495)
+(cherry picked from commit 0d595e8b1cb72341c1effd45310d94717ac6c787)
+
+[Backport to 4.0.9: 4.0.9's reader logs through rabbit_log and has no
+{unknown, _} frame clauses, and rabbit_stream_core has no
+resolve_offset_spec response, so only the frame_too_large clauses and
+type are added. Test suite changes and the proper TEST_DEPS line are
+dropped. Part of the CVE-2026-67225 fix.]
+
+Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+---
+ .../src/rabbit_stream_reader.erl              | 20 +++++-
+ .../src/rabbit_stream_core.erl                | 62 +++++++++++++------
+ 2 files changed, 63 insertions(+), 19 deletions(-)
+
+diff --git a/deps/rabbitmq_stream/src/rabbit_stream_reader.erl b/deps/rabbitmq_stream/src/rabbit_stream_reader.erl
+index f069e25b04..9fa98be887 100644
+--- a/deps/rabbitmq_stream/src/rabbit_stream_reader.erl
++++ b/deps/rabbitmq_stream/src/rabbit_stream_reader.erl
+@@ -189,7 +189,7 @@ init([KeepaliveSup,
+                 #stream_connection_state{consumers = #{},
+                                          blocked = false,
+                                          data =
+-                                             rabbit_stream_core:init(undefined)},
++                                             rabbit_stream_core:init(#{frame_max => FrameMax})},
+             Transport:setopts(RealSocket, [{active, once}]),
+             _ = rabbit_alarm:register(self(), {?MODULE, resource_alarm, []}),
+             ConnectionNegotiationStepTimeout =
+@@ -1516,6 +1516,11 @@ handle_frame_pre_auth(Transport,
+ handle_frame_pre_auth(_Transport, Connection, State, heartbeat) ->
+     rabbit_log:debug("Received heartbeat frame pre auth"),
+     {Connection, State};
++handle_frame_pre_auth(_Transport, Connection, State, {frame_too_large, Size, Max}) ->
++    rabbit_log:error("Frame size (~b bytes) exceeds maximum (~b bytes)",
++                     [Size, Max]),
++    rabbit_global_counters:increase_protocol_counter(stream, ?FRAME_TOO_LARGE, 1),
++    {Connection#stream_connection{connection_step = failure}, State};
+ handle_frame_pre_auth(_Transport, Connection, State, Command) ->
+     rabbit_log_connection:warning("unknown command ~w, closing connection.",
+                                   [Command]),
+@@ -2856,6 +2861,19 @@ handle_frame_post_auth(Transport,
+ handle_frame_post_auth(_Transport, Connection, State, heartbeat) ->
+     rabbit_log:debug("Received heartbeat frame post auth"),
+     {Connection, State};
++handle_frame_post_auth(Transport,
++                       #stream_connection{socket = S} = Connection,
++                       State,
++                       {frame_too_large, Size, Max}) ->
++    rabbit_log:error("Frame size (~b bytes) exceeds maximum (~b bytes)",
++                     [Size, Max]),
++    rabbit_global_counters:increase_protocol_counter(stream, ?FRAME_TOO_LARGE, 1),
++    Frame =
++        rabbit_stream_core:frame({request, 1,
++                                  {close, ?RESPONSE_CODE_FRAME_TOO_LARGE,
++                                   <<"frame too large">>}}),
++    send(Transport, S, Frame),
++    {Connection#stream_connection{connection_step = close_sent}, State};
+ handle_frame_post_auth(Transport,
+                        #stream_connection{socket = S} = Connection,
+                        State,
+diff --git a/deps/rabbitmq_stream_common/src/rabbit_stream_core.erl b/deps/rabbitmq_stream_common/src/rabbit_stream_core.erl
+index fad066a2df..cae1504cec 100644
+--- a/deps/rabbitmq_stream_common/src/rabbit_stream_core.erl
++++ b/deps/rabbitmq_stream_common/src/rabbit_stream_core.erl
+@@ -26,16 +26,15 @@
+          parse_command/1]).
+ 
+ %% holds static or rarely changing fields
+--record(cfg, {}).
++-record(cfg, {frame_max :: non_neg_integer() | unlimited}).
+ -record(?MODULE,
+         {cfg :: #cfg{},
+          frames = [] :: [iodata()],
+-         %% partial data
+          data ::
+              undefined |
+-             %% this is only if the binary is smaller than 4 bytes
+              binary() |
+-             {RemainingBytes :: non_neg_integer(), iodata()},
++             {RemainingBytes :: non_neg_integer(), iodata()} |
++             {frame_too_large, non_neg_integer()},
+          commands = queue:new() :: queue:queue(command())}).
+ 
+ -opaque state() :: #?MODULE{}.
+@@ -167,11 +166,16 @@
+       [{Command :: atom(), MinVersion :: command_version(),
+         MaxVersion :: command_version()}]} |
+      {stream_stats, response_code(), Stats :: #{binary() => integer()}}} |
++    {frame_too_large, DeclaredSize :: non_neg_integer(),
++     MaxSize :: non_neg_integer()} |
+     {unknown, binary()}.
+ 
+--spec init(term()) -> state().
++-spec init(#{frame_max => non_neg_integer() | unlimited} | term()) -> state().
++init(Opts) when is_map(Opts) ->
++    FrameMax = maps:get(frame_max, Opts, unlimited),
++    #?MODULE{cfg = #cfg{frame_max = FrameMax}};
+ init(_) ->
+-    #?MODULE{cfg = #cfg{}}.
++    #?MODULE{cfg = #cfg{frame_max = unlimited}}.
+ 
+ -spec next_command(state()) -> {command(), state()} | empty.
+ next_command(#?MODULE{commands = Commands0} = State) ->
+@@ -186,36 +190,47 @@ next_command(#?MODULE{commands = Commands0} = State) ->
+ all_commands(#?MODULE{commands = Commands0} = State) ->
+     {queue:to_list(Commands0), State#?MODULE{commands = queue:new()}}.
+ 
+-%% returns frames
+ -spec incoming_data(binary(), state()) -> state().
+-%% TODO: check max frame size
+ incoming_data(<<>>,
+               #?MODULE{frames = Frames, commands = Commands} = State) ->
+     State#?MODULE{frames = [], commands = parse_frames(Frames, Commands)};
+ incoming_data(<<Size:32, Frame:Size/binary, Rem/binary>>,
+-              #?MODULE{frames = Frames, data = undefined} = State) ->
+-    incoming_data(Rem,
+-                  State#?MODULE{frames = [Frame | Frames], data = undefined});
++              #?MODULE{cfg = #cfg{frame_max = FrameMax},
++                       frames = Frames,
++                       data = undefined} = State) ->
++    case frame_size_ok(Size, FrameMax) of
++        true ->
++            incoming_data(Rem,
++                          State#?MODULE{frames = [Frame | Frames],
++                                        data = undefined});
++        false ->
++            frame_too_large(Size, FrameMax, State)
++    end;
+ incoming_data(<<Size:32, Rem/binary>>,
+-              #?MODULE{frames = Frames,
++              #?MODULE{cfg = #cfg{frame_max = FrameMax},
++                       frames = Frames,
+                        data = undefined,
+                        commands = Commands} =
+                   State) ->
+-    %% not enough data to complete frame, stash and await more data
+-    State#?MODULE{frames = [],
+-                  data = {Size - byte_size(Rem), Rem},
+-                  commands = parse_frames(Frames, Commands)};
++    case frame_size_ok(Size, FrameMax) of
++        true ->
++            State#?MODULE{frames = [],
++                          data = {Size - byte_size(Rem), Rem},
++                          commands = parse_frames(Frames, Commands)};
++        false ->
++            frame_too_large(Size, FrameMax, State)
++    end;
+ incoming_data(Data,
+               #?MODULE{frames = Frames,
+                        data = undefined,
+                        commands = Commands} =
+                   State)
+     when byte_size(Data) < 4 ->
+-    %% not enough data to even know the size required
+-    %% just stash binary and hit last clause next
+     State#?MODULE{frames = [],
+                   data = Data,
+                   commands = parse_frames(Frames, Commands)};
++incoming_data(_Data, #?MODULE{data = {frame_too_large, _}} = State) ->
++    State;
+ incoming_data(Data,
+               #?MODULE{frames = Frames,
+                        data = {Size, Partial},
+@@ -240,6 +255,17 @@ incoming_data(Data, #?MODULE{data = Partial} = State)
+     incoming_data(<<Partial/binary, Data/binary>>,
+                   State#?MODULE{data = undefined}).
+ 
++frame_size_ok(_, unlimited) ->
++    true;
++frame_size_ok(Size, FrameMax) ->
++    Size =< FrameMax.
++
++frame_too_large(Size, FrameMax, #?MODULE{frames = Frames, commands = Commands} = State) ->
++    Cmd = {frame_too_large, Size, FrameMax},
++    State#?MODULE{frames = [],
++                  data = {frame_too_large, Size},
++                  commands = queue:in(Cmd, parse_frames(Frames, Commands))}.
++
+ parse_frames(Frames, Queue) ->
+     lists:foldr(fun(Frame, Acc) -> queue:in(parse_command(Frame), Acc)
+                 end,

diff --git a/rabbitmq-server-0040-Follow-up-to-16020-integrate-with-connection-tuning.patch b/rabbitmq-server-0040-Follow-up-to-16020-integrate-with-connection-tuning.patch
new file mode 100644
index 0000000..e01cfee
--- /dev/null
+++ b/rabbitmq-server-0040-Follow-up-to-16020-integrate-with-connection-tuning.patch
@@ -0,0 +1,85 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Michael Klishin <michaelklishin@icloud.com>
+Date: Fri, 10 Apr 2026 22:07:38 -0700
+Subject: [PATCH 40/41] Follow-up to #16020: integrate with connection tuning
+
+(cherry picked from commit 07d79d44b8eac705b894c28b31cb4caff7d62668)
+(cherry picked from commit ae99e7ed762c22086f304467e4cf86fa829eddaa)
+
+[Backport to 4.0.9: src applies cleanly; the test suite changes
+conflict and are dropped. Part of the CVE-2026-67225 fix: the parser
+now enforces the frame_max negotiated in Tune.]
+
+Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+---
+ .../rabbitmq_stream/src/rabbit_stream_reader.erl | 16 ++++++++++++----
+ .../src/rabbit_stream_core.erl                   |  8 ++++++++
+ 2 files changed, 20 insertions(+), 4 deletions(-)
+
+diff --git a/deps/rabbitmq_stream/src/rabbit_stream_reader.erl b/deps/rabbitmq_stream/src/rabbit_stream_reader.erl
+index 9fa98be887..c8cf5bb281 100644
+--- a/deps/rabbitmq_stream/src/rabbit_stream_reader.erl
++++ b/deps/rabbitmq_stream/src/rabbit_stream_reader.erl
+@@ -1416,12 +1416,20 @@ handle_frame_pre_auth(Transport,
+ handle_frame_pre_auth(_Transport,
+                       #stream_connection{helper_sup = SupPid,
+                                          socket = Sock,
+-                                         name = ConnectionName} =
++                                         name = ConnectionName,
++                                         frame_max = ConfiguredFrameMax} =
+                           Connection,
+-                      #stream_connection_state{blocked = Blocked} = State,
++                      #stream_connection_state{blocked = Blocked,
++                                               data = CoreState0} = State,
+                       {tune, FrameMax, Heartbeat}) ->
+     rabbit_log_connection:debug("Tuning response ~tp ~tp ",
+                                 [FrameMax, Heartbeat]),
++    %% The client must not negotiate a frame_max larger than the
++    %% value advertised by the server, so clamp it to the configured
++    %% ceiling before pushing the negotiated value into the parser.
++    NegotiatedFrameMax = min(FrameMax, ConfiguredFrameMax),
++    CoreState = rabbit_stream_core:set_frame_max(NegotiatedFrameMax,
++                                                 CoreState0),
+     Parent = self(),
+     %% sending a message to the main process so the heartbeat frame is sent from this main process
+     %% otherwise heartbeat frames can interleave with chunk delivery
+@@ -1448,10 +1456,10 @@ handle_frame_pre_auth(_Transport,
+             ok
+     end,
+     {Connection#stream_connection{connection_step = tuned,
+-                                  frame_max = FrameMax,
++                                  frame_max = NegotiatedFrameMax,
+                                   heartbeat = Heartbeat,
+                                   heartbeater = Heartbeater},
+-     State};
++     State#stream_connection_state{data = CoreState}};
+ handle_frame_pre_auth(Transport,
+                       #stream_connection{user = User,
+                                          socket = S,
+diff --git a/deps/rabbitmq_stream_common/src/rabbit_stream_core.erl b/deps/rabbitmq_stream_common/src/rabbit_stream_core.erl
+index cae1504cec..28e8d75b18 100644
+--- a/deps/rabbitmq_stream_common/src/rabbit_stream_core.erl
++++ b/deps/rabbitmq_stream_common/src/rabbit_stream_core.erl
+@@ -19,6 +19,7 @@
+ -include("rabbit_stream.hrl").
+ 
+ -export([init/1,
++         set_frame_max/2,
+          incoming_data/2,
+          next_command/1,
+          all_commands/1,
+@@ -177,6 +178,13 @@ init(Opts) when is_map(Opts) ->
+ init(_) ->
+     #?MODULE{cfg = #cfg{frame_max = unlimited}}.
+ 
++%% Updates the frame_max enforced by the parser. Called by the
++%% reader after TUNE so the negotiated value is enforced instead of
++%% the initial ceiling.
++-spec set_frame_max(non_neg_integer() | unlimited, state()) -> state().
++set_frame_max(FrameMax, #?MODULE{cfg = Cfg} = State) ->
++    State#?MODULE{cfg = Cfg#cfg{frame_max = FrameMax}}.
++
+ -spec next_command(state()) -> {command(), state()} | empty.
+ next_command(#?MODULE{commands = Commands0} = State) ->
+     case queue:out(Commands0) of

diff --git a/rabbitmq-server-0041-Follow-up-to-16020-integrate-the-special-value-of-0.patch b/rabbitmq-server-0041-Follow-up-to-16020-integrate-the-special-value-of-0.patch
new file mode 100644
index 0000000..e329a1f
--- /dev/null
+++ b/rabbitmq-server-0041-Follow-up-to-16020-integrate-the-special-value-of-0.patch
@@ -0,0 +1,97 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Michael Klishin <michaelklishin@icloud.com>
+Date: Sat, 11 Apr 2026 02:11:50 -0700
+Subject: [PATCH 41/41] Follow-up to #16020: integrate the special value of `0`
+
+as we already do in the Stream Protocol and elsewhere
+in RabbitMQ protocol implementations.
+
+(cherry picked from commit 6567e80ee72ef8e66b5170190cfc89100de8ce81)
+(cherry picked from commit 5879a5089b0bcfb14e845eb19849e6cae2709c21)
+
+[Backport to 4.0.9: only negotiate_frame_max/2 is added to the
+-ifdef(TEST) export list (4.0.9 has no clean_subscriptions/4); test
+suite changes are dropped. Part of the CVE-2026-67225 fix.]
+
+Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+---
+ .../src/rabbit_stream_reader.erl              | 19 ++++++++++++++-----
+ .../src/rabbit_stream_core.erl                | 13 +++++++++++--
+ 2 files changed, 25 insertions(+), 7 deletions(-)
+
+diff --git a/deps/rabbitmq_stream/src/rabbit_stream_reader.erl b/deps/rabbitmq_stream/src/rabbit_stream_reader.erl
+index c8cf5bb281..9870f34732 100644
+--- a/deps/rabbitmq_stream/src/rabbit_stream_reader.erl
++++ b/deps/rabbitmq_stream/src/rabbit_stream_reader.erl
+@@ -106,7 +106,8 @@
+          close_sent/3]).
+ -ifdef(TEST).
+ -export([ensure_token_expiry_timer/2,
+-         evaluate_state_after_secret_update/4]).
++         evaluate_state_after_secret_update/4,
++         negotiate_frame_max/2]).
+ -endif.
+ 
+ callback_mode() ->
+@@ -1424,10 +1425,8 @@ handle_frame_pre_auth(_Transport,
+                       {tune, FrameMax, Heartbeat}) ->
+     rabbit_log_connection:debug("Tuning response ~tp ~tp ",
+                                 [FrameMax, Heartbeat]),
+-    %% The client must not negotiate a frame_max larger than the
+-    %% value advertised by the server, so clamp it to the configured
+-    %% ceiling before pushing the negotiated value into the parser.
+-    NegotiatedFrameMax = min(FrameMax, ConfiguredFrameMax),
++    %% 0 on either side means "no limit" and must not be clamped to 0.
++    NegotiatedFrameMax = negotiate_frame_max(FrameMax, ConfiguredFrameMax),
+     CoreState = rabbit_stream_core:set_frame_max(NegotiatedFrameMax,
+                                                  CoreState0),
+     Parent = self(),
+@@ -1534,6 +1533,16 @@ handle_frame_pre_auth(_Transport, Connection, State, Command) ->
+                                   [Command]),
+     {Connection#stream_connection{connection_step = failure}, State}.
+ 
++%% 0 on either side means "no limit"; fall back to the other value.
++-spec negotiate_frame_max(non_neg_integer(), non_neg_integer()) ->
++    non_neg_integer().
++negotiate_frame_max(0, Configured) ->
++    Configured;
++negotiate_frame_max(Client, 0) ->
++    Client;
++negotiate_frame_max(Client, Configured) ->
++    min(Client, Configured).
++
+ auth_fail(Username, Msg, Args, Connection, ConnectionState) ->
+     notify_auth_result(Username,
+                        user_authentication_failure,
+diff --git a/deps/rabbitmq_stream_common/src/rabbit_stream_core.erl b/deps/rabbitmq_stream_common/src/rabbit_stream_core.erl
+index 28e8d75b18..d377414e5e 100644
+--- a/deps/rabbitmq_stream_common/src/rabbit_stream_core.erl
++++ b/deps/rabbitmq_stream_common/src/rabbit_stream_core.erl
+@@ -173,7 +173,7 @@
+ 
+ -spec init(#{frame_max => non_neg_integer() | unlimited} | term()) -> state().
+ init(Opts) when is_map(Opts) ->
+-    FrameMax = maps:get(frame_max, Opts, unlimited),
++    FrameMax = normalise_frame_max(maps:get(frame_max, Opts, unlimited)),
+     #?MODULE{cfg = #cfg{frame_max = FrameMax}};
+ init(_) ->
+     #?MODULE{cfg = #cfg{frame_max = unlimited}}.
+@@ -183,7 +183,16 @@ init(_) ->
+ %% the initial ceiling.
+ -spec set_frame_max(non_neg_integer() | unlimited, state()) -> state().
+ set_frame_max(FrameMax, #?MODULE{cfg = Cfg} = State) ->
+-    State#?MODULE{cfg = Cfg#cfg{frame_max = FrameMax}}.
++    State#?MODULE{cfg = Cfg#cfg{frame_max = normalise_frame_max(FrameMax)}}.
++
++%% `frame_max` = 0 means "no limit" (AMQP 0-9-1 convention);
++%% the parser expresses that as the atom `unlimited`.
++-spec normalise_frame_max(non_neg_integer() | unlimited) ->
++    pos_integer() | unlimited.
++normalise_frame_max(0) ->
++    unlimited;
++normalise_frame_max(FrameMax) ->
++    FrameMax.
+ 
+ -spec next_command(state()) -> {command(), state()} | empty.
+ next_command(#?MODULE{commands = Commands0} = State) ->

diff --git a/rabbitmq-server.spec b/rabbitmq-server.spec
index 54a5c7c..2c9e3ae 100644
--- a/rabbitmq-server.spec
+++ b/rabbitmq-server.spec
@@ -7,7 +7,7 @@
 
 Name: rabbitmq-server
 Version: 4.0.9
-Release: 6%{?dist}
+Release: 7%{?dist}
 License: MPL-2.0
 Source0: https://github.com/rabbitmq/rabbitmq-server/releases/download/v%{version}/%{name}_%{version}.orig.tar.xz
 Source1: https://github.com/rabbitmq/rabbitmq-server/releases/download/v%{version}/%{name}_%{version}.orig.tar.xz.asc
@@ -34,6 +34,30 @@ Patch14: rabbitmq-server-0014-rabbit_access_control-update_state-2-rebuild-user-
 Patch15: rabbitmq-server-0015-Match-exact-symbol-length-when-detecting-AMQP-1.0-bo.patch
 Patch16: rabbitmq-server-0016-Parse-MQTT-properties-strictly.patch
 Patch17: rabbitmq-server-0017-OAuth-2-improve-robustness-of-a-token-refresh-path.patch
+Patch18: rabbitmq-server-0018-HTTP-API-refactor-global-parameter-name-lookups.patch
+Patch19: rabbitmq-server-0019-Runtime-parameters-refactor-component-lookups.patch
+Patch20: rabbitmq-server-0020-Escape-variables-in-topic-permissions.patch
+Patch21: rabbitmq-server-0021-Escape-in-topic-permission-variables.patch
+Patch22: rabbitmq-server-0022-AMQP-1.0-management-align-GET-bindings-with-the-rest.patch
+Patch23: rabbitmq-server-0023-Stream-management-plugin-format-a-few-more-rendered-.patch
+Patch24: rabbitmq-server-0024-Refactor-amqp_uri-parse-1.patch
+Patch25: rabbitmq-server-0025-Restrict-AMQP-URI-auth_mechanism-to-a-fixed-mechanis.patch
+Patch26: rabbitmq-server-0026-Federation-more-strict-when-validating-URIs.patch
+Patch27: rabbitmq-server-0027-Introduce-rabbit_nodes-resolve_member-1.patch
+Patch28: rabbitmq-server-0028-Management-UI-tweak-the-CSP-default.patch
+Patch29: rabbitmq-server-0029-MQTT-Web-MQTT-refactor-socket-handling.patch
+Patch30: rabbitmq-server-0030-Limit-the-number-of-user-tags-to-3.patch
+Patch31: rabbitmq-server-0031-Address-atom-exhaustion-attack.patch
+Patch32: rabbitmq-server-0032-JMS-topic-selector-bound-LIKE-pattern-matching.patch
+Patch33: rabbitmq-server-0033-LDAP-handle-DN-template-values-per-RFC-4514.patch
+Patch34: rabbitmq-server-0034-A-follow-up-to-16101.patch
+Patch35: rabbitmq-server-0035-ldap-escape-down-level-logon-names-by-parts.patch
+Patch36: rabbitmq-server-0036-LDAP-escape-DN-template-values-not-whole-non-DN-bind.patch
+Patch37: rabbitmq-server-0037-Web-MQTT-Web-STOMP-enforce-login-timeout-for-WebSock.patch
+Patch38: rabbitmq-server-0038-Web-MQTT-Web-STOMP-set-Cowboy-s-max_frame_size.patch
+Patch39: rabbitmq-server-0039-Implement-a-stream-reader-TODO.patch
+Patch40: rabbitmq-server-0040-Follow-up-to-16020-integrate-with-connection-tuning.patch
+Patch41: rabbitmq-server-0041-Follow-up-to-16020-integrate-the-special-value-of-0.patch
 
 URL: https://www.rabbitmq.com/
 BuildRequires: elixir
@@ -191,6 +215,13 @@ rm -f %{_rabbit_libdir}/lib/rabbitmq_server-%{version}/ebin/rabbit.{rel,script,b
 
 
 %changelog
+* Wed Nov 04 2026 Peter Lemenkov <lemenkov@gmail.com> - 4.0.9-7
+- Backport fixes for CVE-2026-44838, CVE-2026-61837, CVE-2026-66071,
+  CVE-2026-66073, CVE-2026-67222, CVE-2026-67223, CVE-2026-67225,
+  CVE-2026-67226, CVE-2026-67227, CVE-2026-67230, CVE-2026-67239,
+  CVE-2026-67407, CVE-2026-67411, CVE-2026-67412, CVE-2026-67413,
+  CVE-2026-67421
+
 * Mon Nov 02 2026 Peter Lemenkov <lemenkov@gmail.com> - 4.0.9-6
 - Backport fixes for CVE-2026-67409 (rhbz#2559734), CVE-2026-67416
   (rhbz#2561690), CVE-2026-67418 (rhbz#2561691) and CVE-2026-67420

                 reply	other threads:[~2026-11-04 17:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179381512713.1.17149233347310897710.rpms-rabbitmq-server-7063bacb4efd@fedoraproject.org \
    --to=lemenkov@gmail.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox