Skip to contentSkip to conversation

samba: Fix CVE-2026-3012

PATCH New Ashishkumar Parmar X (asparmar - E INFOCHIPS PRIVATE LIMITED at Cisco) 1 participant 2 messages Jul 8

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 samba: Fix CVE-2026-3012

From: Ashishkumar Parmar <[email protected]>

This patch applies the upstream Samba security backport for CVE-2026-3012. The upstream security bundle is referenced in [1], and the public CVE advisory is referenced in [2]. The individual backported commit links are recorded in the embedded patch headers.

[1] https://www.samba.org/samba/ftp/patches/security/samba-4.22.9-security-2026-05-25.patch
[2] https://www.samba.org/samba/security/CVE-2026-3012.html

---
 .../samba/samba/CVE-2026-3012_p1.patch        | 131 ++++++++++++++++++
 .../samba/samba/CVE-2026-3012_p2.patch        |  51 +++++++
 .../samba/samba_4.19.9.bb                     |   2 +
 3 files changed, 184 insertions(+)
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/CVE-2026-3012_p1.patch
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/CVE-2026-3012_p2.patch
meta-networking/recipes-connectivity/samba/samba/CVE-2026-3012_p1.patch new file +131 -0
new file mode 100644
index 0000000000..ce54b2916f
@@ -0,0 +1,131 @@
+From f21f87e0f64dc4aea8c9537f182282077ae6a37b Mon Sep 17 00:00:00 2001
+From: Douglas Bagnall <[email protected]>
+Date: Mon, 23 Feb 2026 11:01:57 +1300
+Subject: [PATCH] CVE-2026-3012: do not fetch certificate over http
+
+In the case where a certificate was found via HTTP, it was trusted
+without verification and put in the global CA store.
+
+There is no means to check the certificate other than by comparing it
+to certificates we may have gathered via LDAP, but in that case there
+is no advantage over just using the LDAP-derived certificates.
+
+Using the LDAP certificates was already the fallback case if HTTP
+failed, so we just make it the default.
+
+The HTTP fetch depends on the NDES service, which is a variant of
+Simple Certificate Enrolment Protocol (SCEP, RFC8894), but in fact
+Samba implements none of that protocol other than the HTTP fetch. SCEP
+is for clients that are not true domain members. Domain members can
+access to certificates over LDAP. This patch is not reducing SCEP
+client support because Samba never had it.
+
+BUG: https://bugzilla.samba.org/show_bug.cgi?id=16003
+
+Reported-by: Arad Inbar, DREAM Security Research Team
+Reported-by: Nir Somech, DREAM Security Research Team
+Reported-by: Ben Grinberg, DREAM Security Research Team
+
+CVE: CVE-2026-3012
+Upstream-Status: Backport [https://gitlab.com/samba-team/samba/-/commit/f21f87e0f64dc4aea8c9537f182282077ae6a37b]
+
+Backport Changes:
+- Adapted python/samba/gp/gp_cert_auto_enroll_ext.py hunks to
+  Samba 4.19.9 context.
+- Omitted selftest/knownfail.d/gpo-auto-enrol because the Yocto
+  recipe does not run upstream Samba selftest.
+
+Signed-off-by: Douglas Bagnall <[email protected]>
+Reviewed-by: Jennifer Sutton <[email protected]>
+(cherry picked from commit f21f87e0f64dc4aea8c9537f182282077ae6a37b)
+Signed-off-by: Ashishkumar Parmar <[email protected]>
+---
+diff --git a/python/samba/gp/gp_cert_auto_enroll_ext.py b/python/samba/gp/gp_cert_auto_enroll_ext.py
+index df3b472..31de4b1 100644
+--- a/python/samba/gp/gp_cert_auto_enroll_ext.py
++++ b/python/samba/gp/gp_cert_auto_enroll_ext.py
+@@ -16,7 +16,6 @@
+
+ import os
+ import operator
+-import requests
+ from samba.gp.gpclass import gp_pol_ext, gp_applier, GPOSTATE
+ from samba import Ldb
+ from ldb import SCOPE_SUBTREE, SCOPE_BASE
+@@ -200,56 +199,24 @@ def get_supported_templates(server):
+     return out.strip().split()
+
+
+-def getca(ca, url, trust_dir):
+-    """Fetch Certificate Chain from the CA."""
++def getca(ca, trust_dir):
++    """Fetch a certificate from LDAP."""
+     root_cert = os.path.join(trust_dir, '%s.crt' % ca['name'])
+     root_certs = []
+
+-    try:
+-        r = requests.get(url=url, params={'operation': 'GetCACert',
+-                                          'message': 'CAIdentifier'})
+-    except requests.exceptions.ConnectionError:
+-        log.warn('Failed to establish a new connection')
+-        r = None
+-    if r is None or r.content == b'' or r.headers['Content-Type'] == 'text/html':
+-        log.warn('Failed to fetch the root certificate chain.')
+-        log.warn('The Network Device Enrollment Service is either not' +
+-                 ' installed or not configured.')
+-        if 'cACertificate' in ca:
+-            log.warn('Installing the server certificate only.')
+-            der_certificate = base64.b64decode(ca['cACertificate'])
+-            try:
+-                cert = load_der_x509_certificate(der_certificate)
+-            except TypeError:
+-                cert = load_der_x509_certificate(der_certificate,
+-                                                 default_backend())
+-            cert_data = cert.public_bytes(Encoding.PEM)
+-            with open(root_cert, 'wb') as w:
+-                w.write(cert_data)
+-            root_certs.append(root_cert)
+-        return root_certs
+-
+-    if r.headers['Content-Type'] == 'application/x-x509-ca-cert':
++    if 'cACertificate' in ca:
++        log.warn('Installing the server certificate only.')
++        der_certificate = base64.b64decode(ca['cACertificate'])
+         # Older versions of load_der_x509_certificate require a backend param
+         try:
+-            cert = load_der_x509_certificate(r.content)
++            cert = load_der_x509_certificate(der_certificate)
+         except TypeError:
+-            cert = load_der_x509_certificate(r.content, default_backend())
++            cert = load_der_x509_certificate(der_certificate,
++                                             default_backend())
+         cert_data = cert.public_bytes(Encoding.PEM)
+         with open(root_cert, 'wb') as w:
+             w.write(cert_data)
+         root_certs.append(root_cert)
+-    elif r.headers['Content-Type'] == 'application/x-x509-ca-ra-cert':
+-        certs = load_der_pkcs7_certificates(r.content)
+-        for i in range(0, len(certs)):
+-            cert = certs[i].public_bytes(Encoding.PEM)
+-            filename, extension = root_cert.rsplit('.', 1)
+-            dest = '%s.%d.%s' % (filename, i, extension)
+-            with open(dest, 'wb') as w:
+-                w.write(cert)
+-            root_certs.append(dest)
+-    else:
+-        log.warn('getca: Wrong (or missing) MIME content type')
+
+     return root_certs
+
+@@ -273,8 +240,7 @@ def changed(new_data, old_data):
+ def cert_enroll(ca, ldb, trust_dir, private_dir, auth='Kerberos'):
+     """Install the root certificate chain."""
+     data = dict({'files': [], 'templates': []}, **ca)
+-    url = 'http://%s/CertSrv/mscep/mscep.dll/pkiclient.exe?' % ca['hostname']
+-    root_certs = getca(ca, url, trust_dir)
++    root_certs = getca(ca, trust_dir)
+     data['files'].extend(root_certs)
+     global_trust_dir = find_global_trust_dir()
+     for src in root_certs:
+--
+2.43.0
meta-networking/recipes-connectivity/samba/samba/CVE-2026-3012_p2.patch new file +51 -0

51 lines not on this page · raw message

meta-networking/recipes-connectivity/samba/samba_4.19.9.bb +2 -0
index d50d9f5155..055e404bb9 100644
@@ -24,6 +24,8 @@ SRC_URI = "${SAMBA_MIRROR}/stable/samba-${PV}.tar.gz \
            file://0005-Fix-pyext_PATTERN-for-cross-compilation.patch \
            file://0006-smbtorture-skip-test-case-tfork_cmd_send.patch \
            file://0007-Deleted-settiong-of-python-to-fix-the-install-confli.patch \
+           file://CVE-2026-3012_p1.patch \
+           file://CVE-2026-3012_p2.patch \
            "
 
 SRC_URI:append:libc-musl = " \
Signature · 1 line
2.35.6
#1 lore raw

PATCH 2/2 samba: Fix CVE-2026-4408

From: Ashishkumar Parmar <[email protected]>

This patch applies the upstream Samba security backport for CVE-2026-4408. The upstream security bundle is referenced in [1], and the public CVE advisory is referenced in [2]. The individual backported commit links are recorded in the embedded patch headers.

Only the CVE-2026-4408-relevant commits from [1] are backported:
[PATCH 11/31] through [PATCH 21/31] and [PATCH 25/31] through [PATCH 31/31]. The remaining bundle commits are intentionally omitted because they fix separate CVEs: CVE-2026-1933, CVE-2026-2340, CVE-2026-3012, CVE-2026-3238, and CVE-2026-4480-only changes.

[1] https://www.samba.org/samba/ftp/patches/security/samba-4.22.9-security-2026-05-25.patch
[2] https://www.samba.org/samba/security/CVE-2026-4408.html

---
 .../samba/samba/CVE-2026-4408_p1.patch        |   75 ++
 .../samba/samba/CVE-2026-4408_p10.patch       |  339 +++++
 .../samba/samba/CVE-2026-4408_p11.patch       |   94 ++
 .../samba/samba/CVE-2026-4408_p12.patch       |   47 +
 .../samba/samba/CVE-2026-4408_p13.patch       |  174 +++
 .../samba/samba/CVE-2026-4408_p14.patch       |   59 +
 .../samba/samba/CVE-2026-4408_p15.patch       | 1108 +++++++++++++++++
 .../samba/samba/CVE-2026-4408_p16.patch       |  422 +++++++
 .../samba/samba/CVE-2026-4408_p17.patch       |   55 +
 .../samba/samba/CVE-2026-4408_p18.patch       |   52 +
 .../samba/samba/CVE-2026-4408_p2.patch        |  133 ++
 .../samba/samba/CVE-2026-4408_p3.patch        |  208 ++++
 .../samba/samba/CVE-2026-4408_p4.patch        |  179 +++
 .../samba/samba/CVE-2026-4408_p5.patch        |   46 +
 .../samba/samba/CVE-2026-4408_p6.patch        |  131 ++
 .../samba/samba/CVE-2026-4408_p7.patch        |   84 ++
 .../samba/samba/CVE-2026-4408_p8.patch        |   39 +
 .../samba/samba/CVE-2026-4408_p9.patch        |   61 +
 .../samba/samba_4.19.9.bb                     |   18 +
 19 files changed, 3324 insertions(+)
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p1.patch
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p10.patch
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p11.patch
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p12.patch
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p13.patch
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p14.patch
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p15.patch
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p16.patch
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p17.patch
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p18.patch
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p2.patch
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p3.patch
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p4.patch
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p5.patch
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p6.patch
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p7.patch
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p8.patch
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p9.patch
meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p1.patch new file +75 -0
new file mode 100644
index 0000000000..2ca29b2f9e
@@ -0,0 +1,75 @@
+From 26b64ec55944b375ead223a214c5f4301329511f Mon Sep 17 00:00:00 2001
+From: Stefan Metzmacher <[email protected]>
+Date: Thu, 23 Apr 2026 18:20:15 +0200
+Subject: [PATCH] CVE-2026-4480/CVE-2026-4408: lib/util: inline
+ string_sub2() into string_sub() the only caller
+
+This will simplify further changes.
+
+BUG: https://bugzilla.samba.org/show_bug.cgi?id=16033
+BUG: https://bugzilla.samba.org/show_bug.cgi?id=16034
+
+CVE: CVE-2026-4408
+Upstream-Status: Backport [https://gitlab.com/samba-team/samba/-/commit/26b64ec55944b375ead223a214c5f4301329511f]
+
+Signed-off-by: Stefan Metzmacher <[email protected]>
+Reviewed-by: Douglas Bagnall <[email protected]>
+(cherry picked from commit 26b64ec55944b375ead223a214c5f4301329511f)
+Signed-off-by: Ashishkumar Parmar <[email protected]>
+---
+ lib/util/substitute.c | 20 ++------------------
+ 1 file changed, 2 insertions(+), 18 deletions(-)
+
+diff --git a/lib/util/substitute.c b/lib/util/substitute.c
+index b7b5588da863..26362ca77b2c 100644
+--- a/lib/util/substitute.c
++++ b/lib/util/substitute.c
+@@ -47,10 +47,9 @@
+  use of len==0 which was for no length checks to be done.
+ **/
+ 
+-static void string_sub2(char *s,const char *pattern, const char *insert, size_t len,
+-			bool remove_unsafe_characters, bool replace_once,
+-			bool allow_trailing_dollar)
++void string_sub(char *s, const char *pattern, const char *insert, size_t len)
+ {
++	bool remove_unsafe_characters = true;
+ 	char *p;
+ 	size_t ls, lp, li, i;
+ 
+@@ -79,13 +78,6 @@ static void string_sub2(char *s,const char *pattern, const char *insert, size_t
+ 		for (i=0;i<li;i++) {
+ 			switch (insert[i]) {
+ 			case '$':
+-				/* allow a trailing $
+-				 * (as in machine accounts) */
+-				if (allow_trailing_dollar && (i == li - 1 )) {
+-					p[i] = insert[i];
+-					break;
+-				}
+-				FALL_THROUGH;
+ 			case '`':
+ 			case '"':
+ 			case '\'':
+@@ -107,17 +99,9 @@ static void string_sub2(char *s,const char *pattern, const char *insert, size_t
+ 		}
+ 		s = p + li;
+ 		ls = ls + li - lp;
+-
+-		if (replace_once)
+-			break;
+ 	}
+ }
+ 
+-void string_sub(char *s,const char *pattern, const char *insert, size_t len)
+-{
+-	string_sub2( s, pattern, insert, len, true, false, false );
+-}
+-
+ /**
+  Similar to string_sub() but allows for any character to be substituted. 
+  Use with caution!
+-- 
+2.43.0
+
+
meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p10.patch new file +339 -0

339 lines not on this page · raw message

meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p11.patch new file +94 -0

94 lines not on this page · raw message

meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p12.patch new file +47 -0

47 lines not on this page · raw message

meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p13.patch new file +174 -0

174 lines not on this page · raw message

meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p14.patch new file +59 -0

59 lines not on this page · raw message

meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p15.patch new file +1108 -0

1,108 lines not on this page · raw message

meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p16.patch new file +422 -0

422 lines not on this page · raw message

meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p17.patch new file +55 -0

55 lines not on this page · raw message

meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p18.patch new file +52 -0

52 lines not on this page · raw message

meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p2.patch new file +133 -0

133 lines not on this page · raw message

meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p3.patch new file +208 -0

208 lines not on this page · raw message

meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p4.patch new file +179 -0

179 lines not on this page · raw message

meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p5.patch new file +46 -0

46 lines not on this page · raw message

meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p6.patch new file +131 -0

9 lines not on this page · raw message

meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p7.patch new file +84 -0

84 lines not on this page · raw message

meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p8.patch new file +39 -0
new file mode 100644
index 0000000000..f99cf2653b

Lines of this file are not shown. View the raw message.

meta-networking/recipes-connectivity/samba/samba/CVE-2026-4408_p9.patch new file +61 -0

61 lines not on this page · raw message

meta-networking/recipes-connectivity/samba/samba_4.19.9.bb +18 -0
index 055e404bb9..5e649ec66f 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.35.6

Part of the diff is not shown here. View the raw message.