From 1cec5987cc316082876867baf1130f947124e770 Mon Sep 17 00:00:00 2001 From: "Adam C. Emerson" Date: Fri, 8 Jul 2022 14:58:16 -0400 Subject: [PATCH] CVE-2022-3854: rgw: Guard against malformed bucket URLs Fixes: https://tracker.ceph.com/issues/55765 Fixes: https://tracker.ceph.com/issues/56586 Signed-off-by: Adam C. Emerson Signed-off-by: Adam C. Emerson Origin: upstream, https://github.com/ceph/ceph/pull/47194/commits/9746e8011ff1de6de7dba9c0041e28a16c8f6828.patch Bug-Debian: https://bugs.debian.org/1027151 Last-Update: 2022-01-09 Misplaced colons can result in radosgw thinking is has a bucket URL but with no bucket name, leading to a crash later on. Gbp-Pq: Name CVE-2022-3854_1_rgw_Guard_against_malformed_bucket_URLs.patch --- src/rgw/rgw_common.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/rgw/rgw_common.cc b/src/rgw/rgw_common.cc index b44d4bfa7..3d09a1e00 100644 --- a/src/rgw/rgw_common.cc +++ b/src/rgw/rgw_common.cc @@ -1279,6 +1279,11 @@ bool verify_bucket_permission_no_policy(const DoutPrefixProvider* dpp, struct re bool verify_bucket_permission(const DoutPrefixProvider* dpp, struct req_state * const s, const uint64_t op) { + if (rgw::sal::RGWBucket::empty(s->bucket)) { + // request is missing a bucket name + return false; + } + perm_state_from_req_state ps(s); return verify_bucket_permission(dpp, -- 2.30.2