Skip to contentSkip to conversation

samba: fix CVE-2023-34968

PATCH Polampalli, Archana 1 participant 1 message Oct 20, 2023 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Reminder!

-Archana
________________________________
From: [email protected] <[email protected]> on behalf of Polampalli, Archana via lists.openembedded.org <[email protected]>
Sent: 03 October 2023 17:17
To: [email protected] <[email protected]>
Subject: [oe][meta-networking][kirkstone][PATCH 1/1] samba: fix CVE-2023-34968

A path disclosure vulnerability was found in Samba. As part of the Spotlight protocol, Samba discloses the server-side absolute path of shares, files, and directories in the results for search queries. This flaw allows a malicious client or an attacker with a targeted RPC request to view the information that is part of the disclosed path.

---
 .../samba/samba/CVE-2023-34968_0001.patch     | 104 ++++
 .../samba/samba/CVE-2023-34968_0002.patch     |  39 ++
 .../samba/samba/CVE-2023-34968_0003.patch     |  65 +++
 .../samba/samba/CVE-2023-34968_0004.patch     |  85 +++
 .../samba/samba/CVE-2023-34968_0005.patch     |  83 +++
 .../samba/samba/CVE-2023-34968_0006.patch     |  57 +++
 .../samba/samba/CVE-2023-34968_0007.patch     |  49 ++
 .../samba/samba/CVE-2023-34968_0008.patch     |  62 +++
 .../samba/samba/CVE-2023-34968_0009.patch     | 465 +++++++++++++++++
 .../samba/samba/CVE-2023-34968_0010.patch     | 484 ++++++++++++++++++
 .../samba/samba/CVE-2023-34968_0011.patch     | 295 +++++++++++
 .../samba/samba_4.14.14.bb                    |  11 +
 12 files changed, 1799 insertions(+)
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/CVE-2023-34968_0001.patch
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/CVE-2023-34968_0002.patch
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/CVE-2023-34968_0003.patch
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/CVE-2023-34968_0004.patch
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/CVE-2023-34968_0005.patch
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/CVE-2023-34968_0006.patch
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/CVE-2023-34968_0007.patch
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/CVE-2023-34968_0008.patch
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/CVE-2023-34968_0009.patch
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/CVE-2023-34968_0010.patch
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/CVE-2023-34968_0011.patch
meta-networking/recipes-connectivity/samba/samba/CVE-2023-34968_0001.patch new file +104 -0
new file mode 100644
index 000000000..ad8e3e4ce
@@ -0,0 +1,104 @@
+From 98b2a013bc723cd660978d5a1db40b987816f90e Mon Sep 17 00:00:00 2001
+From: Ralph Boehme <[email protected]>
+Date: Tue, 6 Jun 2023 15:17:26 +0200
+Subject: [PATCH] CVE-2023-34968: mdssvc: cache and reuse stat info in struct
+ sl_inode_path_map
+
+Prepare for the "path" being a fake path and not the real server-side
+path where we won't be able to vfs_stat_fsp() this fake path. Luckily we already
+got stat info for the object in mds_add_result() so we can just pass stat info
+from there.
+
+BUG: https://bugzilla.samba.org/show_bug.cgi?id=15388
+
+Signed-off-by: Ralph Boehme <[email protected]>
+Reviewed-by: Stefan Metzmacher <[email protected]>
+
+Upstream-Status: Backport [https://github.com/samba-team/samba/commit/98b2a013bc723cd660978d5a1db40b987816f90e]
+
+CVE: CVE-2023-34968
+
+Signed-off-by: Archana Polampalli <[email protected]>
+---
+ source3/rpc_server/mdssvc/mdssvc.c | 32 +++++++-----------------------
+ source3/rpc_server/mdssvc/mdssvc.h |  1 +
+ 2 files changed, 8 insertions(+), 25 deletions(-)
+
+diff --git a/source3/rpc_server/mdssvc/mdssvc.c b/source3/rpc_server/mdssvc/mdssvc.c
+index 26a3ec7..a6cc653 100644
+--- a/source3/rpc_server/mdssvc/mdssvc.c
++++ b/source3/rpc_server/mdssvc/mdssvc.c
+@@ -446,7 +446,10 @@ static int ino_path_map_destr_cb(struct sl_inode_path_map *entry)
+  * entries by calling talloc_free() on the query slq handles.
+  **/
+
+-static bool inode_map_add(struct sl_query *slq, uint64_t ino, const char *path)
++static bool inode_map_add(struct sl_query *slq,
++                        uint64_t ino,
++                        const char *path,
++                        struct stat_ex *st)
+ {
+       NTSTATUS status;
+       struct sl_inode_path_map *entry;
+@@ -493,6 +496,7 @@ static bool inode_map_add(struct sl_query *slq, uint64_t ino, const char *path)
+
+       entry->ino = ino;
+       entry->mds_ctx = slq->mds_ctx;
++      entry->st = *st;
+       entry->path = talloc_strdup(entry, path);
+       if (entry->path == NULL) {
+               DEBUG(1, ("talloc failed\n"));
+@@ -629,7 +633,7 @@ bool mds_add_result(struct sl_query *slq, const char *path)
+               return false;
+       }
+
+-      ok = inode_map_add(slq, ino64, path);
++      ok = inode_map_add(slq, ino64, path, &sb);
+       if (!ok) {
+               DEBUG(1, ("inode_map_add error\n"));
+               slq->state = SLQ_STATE_ERROR;
+@@ -1350,29 +1354,7 @@ static bool slrpc_fetch_attributes(struct mds_ctx *mds_ctx,
+               elem = talloc_get_type_abort(p, struct sl_inode_path_map);
+               path = elem->path;
+
+-              status = synthetic_pathref(talloc_tos(),
+-                                         mds_ctx->conn->cwd_fsp,
+-                                         path,
+-                                         NULL,
+-                                         NULL,
+-                                         0,
+-                                         0,
+-                                         &smb_fname);
+-              if (!NT_STATUS_IS_OK(status)) {
+-                      /* This is not an error, the user may lack permissions */
+-                      DBG_DEBUG("synthetic_pathref [%s]: %s\n",
+-                                smb_fname_str_dbg(smb_fname),
+-                                nt_errstr(status));
+-                      return true;
+-              }
+-
+-              result = SMB_VFS_FSTAT(smb_fname->fsp, &smb_fname->st);
+-              if (result != 0) {
+-                      TALLOC_FREE(smb_fname);
+-                      return true;
+-              }
+-
+-              sp = &smb_fname->st;
++              sp = &elem->st;
+       }
+
+       ok = add_filemeta(mds_ctx, reqinfo, fm_array, path, sp);
+diff --git a/source3/rpc_server/mdssvc/mdssvc.h b/source3/rpc_server/mdssvc/mdssvc.h
+index 3924827..a097991 100644
+--- a/source3/rpc_server/mdssvc/mdssvc.h
++++ b/source3/rpc_server/mdssvc/mdssvc.h
+@@ -105,6 +105,7 @@ struct sl_inode_path_map {
+       struct mds_ctx    *mds_ctx;
+       uint64_t           ino;
+       char              *path;
++      struct stat_ex     st;
+ };
+
+ /* Per process state */
+--
+2.40.0
meta-networking/recipes-connectivity/samba/samba/CVE-2023-34968_0002.patch new file +39 -0
new file mode 100644
index 000000000..21b98c4d7
@@ -0,0 +1,39 @@
+From 47a0c1681dd1e7ec407679793966ec8bdc08a24e Mon Sep 17 00:00:00 2001
+From: Ralph Boehme <[email protected]>
+Date: Sat, 17 Jun 2023 13:39:55 +0200
+Subject: [PATCH] CVE-2023-34968: mdssvc: add missing "kMDSStoreMetaScopes"
+ dict key in slrpc_fetch_properties()
+
+We were adding the value, but not the key.
+
+BUG: https://bugzilla.samba.org/show_bug.cgi?id=15388
+
+Signed-off-by: Ralph Boehme <[email protected]>
+Reviewed-by: Stefan Metzmacher <[email protected]>
+
+Upstream-Status: Backport [https://github.com/samba-team/samba/commit/47a0c1681dd1e7ec407679793966ec8bdc08a24e]
+
+CVE: CVE-2023-34968
+
+Signed-off-by: Archana Polampalli <[email protected]>
+---
+ source3/rpc_server/mdssvc/mdssvc.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/source3/rpc_server/mdssvc/mdssvc.c b/source3/rpc_server/mdssvc/mdssvc.c
+index a6d09a43b9c..9c23ef95753 100644
+--- a/source3/rpc_server/mdssvc/mdssvc.c
++++ b/source3/rpc_server/mdssvc/mdssvc.c
+@@ -730,6 +730,10 @@ static bool slrpc_fetch_properties(struct mds_ctx *mds_ctx,
+       }
+
+       /* kMDSStoreMetaScopes array */
++      result = dalloc_stradd(dict, "kMDSStoreMetaScopes");
++      if (result != 0) {
++              return false;
++      }
+       array = dalloc_zero(dict, sl_array_t);
+       if (array == NULL) {
+               return NULL;
+--
+2.40.0
meta-networking/recipes-connectivity/samba/samba/CVE-2023-34968_0003.patch new file +65 -0

65 lines not on this page · raw message

meta-networking/recipes-connectivity/samba/samba/CVE-2023-34968_0004.patch new file +85 -0

85 lines not on this page · raw message

meta-networking/recipes-connectivity/samba/samba/CVE-2023-34968_0005.patch new file +83 -0

83 lines not on this page · raw message

meta-networking/recipes-connectivity/samba/samba/CVE-2023-34968_0006.patch new file +57 -0

57 lines not on this page · raw message

meta-networking/recipes-connectivity/samba/samba/CVE-2023-34968_0007.patch new file +49 -0

49 lines not on this page · raw message

meta-networking/recipes-connectivity/samba/samba/CVE-2023-34968_0008.patch new file +62 -0

62 lines not on this page · raw message

meta-networking/recipes-connectivity/samba/samba/CVE-2023-34968_0009.patch new file +465 -0

465 lines not on this page · raw message

meta-networking/recipes-connectivity/samba/samba/CVE-2023-34968_0010.patch new file +484 -0

484 lines not on this page · raw message

meta-networking/recipes-connectivity/samba/samba/CVE-2023-34968_0011.patch new file +295 -0

295 lines not on this page · raw message

meta-networking/recipes-connectivity/samba/samba_4.14.14.bb +11 -0
index 73e8a82e8..aa27592cb 100644
@@ -38,6 +38,17 @@ SRC_URI = "${SAMBA_MIRROR}/stable/samba-${PV}.tar.gz \
            file://CVE-2022-2127.patch \
            file://CVE-2023-34967_0001.patch \
            file://CVE-2023-34967_0002.patch \
+           file://CVE-2023-34968_0001.patch \
+           file://CVE-2023-34968_0002.patch \
+           file://CVE-2023-34968_0003.patch \
+           file://CVE-2023-34968_0004.patch \
+           file://CVE-2023-34968_0005.patch \
+           file://CVE-2023-34968_0006.patch \
+           file://CVE-2023-34968_0007.patch \
+           file://CVE-2023-34968_0008.patch \
+           file://CVE-2023-34968_0009.patch \
+           file://CVE-2023-34968_0010.patch \
+           file://CVE-2023-34968_0011.patch \
            "
 
 SRC_URI:append:libc-musl = " \

--
2.40.0