🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.devel.release
Article #1306

Bug#1156304: trixie-pu: package opensc/0.26.1-2+deb13u1

#1306
From: Andreas Henriksson
Date: Fri, 04 Dec 2026 14:50
887 lines
39205 bytes
--zf5pz3e3x4nbjh44
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Thu, Dec 03, 2026 at 11:47:22PM +0100, Andreas Henriksson wrote:
> Package: release.debian.org
> Severity: normal
> Tags: trixie
> X-Debbugs-Cc: opensc@packages.debian.org
> Control: affects -1 + src:opensc
> User: release.debian.org@packages.debian.org
> Usertags: pu
> 
> [ Reason ]
> Fixing outstanding CVE issues in the opensc package.
> See:
> https://security-tracker.debian.org/tracker/source-package/opensc
[...]

New upload at:
https://debusine.debian.net/debian/developers/work-request/1695207/

Updated debdiff attached. Now also include backport of CVE-2026-10275
fix.

Regards,
Andreas Henriksson

--zf5pz3e3x4nbjh44
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="opensc-spu.debdiff"

diff -Nru opensc-0.26.1/debian/changelog opensc-0.26.1/debian/changelog
--- opensc-0.26.1/debian/changelog	2025-06-06 12:10:29.000000000 +0200
+++ opensc-0.26.1/debian/changelog	2026-12-04 15:39:03.000000000 +0100
@@ -1,3 +1,17 @@
+opensc (0.26.1-2+deb13u1) trixie; urgency=medium
+
+  * Non-maintainer upload by the LTS Team.
+  * Apply patches from upstream addressing
+    - CVE-2025-13763
+    - CVE-2025-49010
+    - CVE-2025-66037
+    - CVE-2025-66038
+    - CVE-2025-66215
+    - CVE-2026-103531
+  * Backport CVE-2026-10275 fix to trixie
+
+ -- Andreas Henriksson <andreas@fatal.se>  Fri, 04 Dec 2026 15:39:03 +0100
+
 opensc (0.26.1-2) unstable; urgency=medium
 
   * Team upload
diff -Nru opensc-0.26.1/debian/patches/CVE-2025-13763-10.patch opensc-0.26.1/debian/patches/CVE-2025-13763-10.patch
--- opensc-0.26.1/debian/patches/CVE-2025-13763-10.patch	1970-01-01 01:00:00.000000000 +0100
+++ opensc-0.26.1/debian/patches/CVE-2025-13763-10.patch	2026-12-04 15:37:59.000000000 +0100
@@ -0,0 +1,23 @@
+From: Jakub Jelen <jjelen@redhat.com>
+Date: Tue, 23 Sep 2025 16:46:40 +0200
+Subject: cac: Avoid using of uninitialized memory (fuzz_pkcs15_crypt/6)
+
+Signed-off-by: Jakub Jelen <jjelen@redhat.com>
+(cherry picked from commit 5b0cda30e8226c41c69735f95234d98eda1be550)
+---
+ src/libopensc/card-cac.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/libopensc/card-cac.c b/src/libopensc/card-cac.c
+index 71ab7e4..63b7b5d 100644
+--- a/src/libopensc/card-cac.c
++++ b/src/libopensc/card-cac.c
+@@ -1181,7 +1181,7 @@ static int cac_select_file_by_type(sc_card_t *card, const sc_path_t *in_path, sc
+ 		 * Do this only if we select applets for reading
+ 		 * (not during driver initialization)
+ 		 */
+-		cac_properties_t prop;
++		cac_properties_t prop = {0};
+ 		size_t i = -1;
+ 
+ 		r = cac_get_properties(card, &prop);
diff -Nru opensc-0.26.1/debian/patches/CVE-2025-13763-11.patch opensc-0.26.1/debian/patches/CVE-2025-13763-11.patch
--- opensc-0.26.1/debian/patches/CVE-2025-13763-11.patch	1970-01-01 01:00:00.000000000 +0100
+++ opensc-0.26.1/debian/patches/CVE-2025-13763-11.patch	2026-12-04 15:37:59.000000000 +0100
@@ -0,0 +1,32 @@
+From: Jakub Jelen <jjelen@redhat.com>
+Date: Wed, 24 Sep 2025 13:44:48 +0200
+Subject: cac: Fix possible use of uninitialized memory (fuzz_pkcs15_crypt/4)
+
+Signed-off-by: Jakub Jelen <jjelen@redhat.com>
+(cherry picked from commit 35b2f54212db0d6adcc337e456ddc728eeabd044)
+---
+ src/libopensc/card-cac.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/libopensc/card-cac.c b/src/libopensc/card-cac.c
+index 63b7b5d..42453a3 100644
+--- a/src/libopensc/card-cac.c
++++ b/src/libopensc/card-cac.c
+@@ -509,7 +509,7 @@ static int cac_read_binary(sc_card_t *card, unsigned int idx,
+ 		}
+ 		priv->cache_buf_len = tlv_len;
+ 
+-		for (tl_ptr = tl, val_ptr=val, tlv_ptr = priv->cache_buf;
++		for (tl_ptr = tl, val_ptr = val, tlv_ptr = priv->cache_buf;
+ 				tl_len >= 2 && tlv_len > 0;
+ 				val_len -= len, tlv_len -= len, val_ptr += len, tlv_ptr += len) {
+ 			/* get the tag and the length */
+@@ -534,6 +534,8 @@ static int cac_read_binary(sc_card_t *card, unsigned int idx,
+ 			}
+ 			memcpy(tlv_ptr, val_ptr, len);
+ 		}
++		/* fixup the cache_buf_le to reflect for the bad data ignored above */
++		priv->cache_buf_len = (tlv_ptr - priv->cache_buf);
+ 		break;
+ 
+ 	case CAC_OBJECT_TYPE_CERT:
diff -Nru opensc-0.26.1/debian/patches/CVE-2025-13763-12.patch opensc-0.26.1/debian/patches/CVE-2025-13763-12.patch
--- opensc-0.26.1/debian/patches/CVE-2025-13763-12.patch	1970-01-01 01:00:00.000000000 +0100
+++ opensc-0.26.1/debian/patches/CVE-2025-13763-12.patch	2026-12-04 15:37:59.000000000 +0100
@@ -0,0 +1,32 @@
+From: Jakub Jelen <jjelen@redhat.com>
+Date: Tue, 23 Sep 2025 18:48:12 +0200
+Subject: cac: Avoid using uninitialized memory (fuzz_pkcs15_crypt/9)
+
+Signed-off-by: Jakub Jelen <jjelen@redhat.com>
+(cherry picked from commit 61985ce021b386b11a29eb4d27c6a7ae00e8e2a6)
+---
+ src/libopensc/card-cac.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/libopensc/card-cac.c b/src/libopensc/card-cac.c
+index 42453a3..8cd5c31 100644
+--- a/src/libopensc/card-cac.c
++++ b/src/libopensc/card-cac.c
+@@ -229,7 +229,7 @@ static const cac_object_t *cac_find_obj_by_id(unsigned short object_id)
+  */
+ static int cac_is_cert(cac_private_data_t * priv, const sc_path_t *in_path)
+ {
+-	cac_object_t test_obj;
++	cac_object_t test_obj = {0};
+ 	test_obj.path = *in_path;
+ 	test_obj.path.index = 0;
+ 	test_obj.path.count = 0;
+@@ -1277,7 +1277,7 @@ static int cac_path_from_cardurl(sc_card_t *card, sc_path_t *path, cac_card_url_
+ static int cac_parse_aid(sc_card_t *card, cac_private_data_t *priv, const u8 *aid, int aid_len)
+ {
+ 	cac_object_t new_object;
+-	cac_properties_t prop;
++	cac_properties_t prop = {0};
+ 	size_t i;
+ 	int r;
+ 
diff -Nru opensc-0.26.1/debian/patches/CVE-2025-13763-13.patch opensc-0.26.1/debian/patches/CVE-2025-13763-13.patch
--- opensc-0.26.1/debian/patches/CVE-2025-13763-13.patch	1970-01-01 01:00:00.000000000 +0100
+++ opensc-0.26.1/debian/patches/CVE-2025-13763-13.patch	2026-12-04 15:37:59.000000000 +0100
@@ -0,0 +1,25 @@
+From: Jakub Jelen <jjelen@redhat.com>
+Date: Wed, 24 Sep 2025 10:27:42 +0200
+Subject: authentic: Avoid buffer overrun (fuzz_pkcs15_reader/6)
+
+(cherry picked from commit dc4a1f2617867eb3b2c170ec51dd2bbae0212480)
+---
+ src/libopensc/card-authentic.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/libopensc/card-authentic.c b/src/libopensc/card-authentic.c
+index bb8642c..f1cd52f 100644
+--- a/src/libopensc/card-authentic.c
++++ b/src/libopensc/card-authentic.c
+@@ -298,9 +298,9 @@ authentic_parse_credential_data(struct sc_context *ctx, struct sc_pin_cmd_data *
+ 
+ 	rv = authentic_get_tagged_data(ctx, blob, blob_len, AUTHENTIC_TAG_DOCP_MECH, &data, &data_len);
+ 	LOG_TEST_RET(ctx, rv, "cannot get PIN type");
+-	if (*data == 0)
++	if (data_len > 0 && *data == 0)
+ 		pin_cmd->pin_type = SC_AC_CHV;
+-	else if (*data >= 2 && *data <= 7)
++	else if (data_len > 0 && *data >= 2 && *data <= 7)
+ 		pin_cmd->pin_type = SC_AC_AUT;
+ 	else
+ 		LOG_TEST_RET(ctx, SC_ERROR_NOT_SUPPORTED, "unsupported Credential type");
diff -Nru opensc-0.26.1/debian/patches/CVE-2025-13763-1.patch opensc-0.26.1/debian/patches/CVE-2025-13763-1.patch
--- opensc-0.26.1/debian/patches/CVE-2025-13763-1.patch	1970-01-01 01:00:00.000000000 +0100
+++ opensc-0.26.1/debian/patches/CVE-2025-13763-1.patch	2026-12-04 15:37:59.000000000 +0100
@@ -0,0 +1,23 @@
+From: Jakub Jelen <jjelen@redhat.com>
+Date: Tue, 23 Sep 2025 14:51:55 +0200
+Subject: tcos: Fix use of uninitialized value (fuzz_pkcs15_crypt/2)
+
+Signed-off-by: Jakub Jelen <jjelen@redhat.com>
+(cherry picked from commit 263d29e2f8baf33f329849c82ba9c08ec45f1ad7)
+---
+ src/libopensc/pkcs15-tcos.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/libopensc/pkcs15-tcos.c b/src/libopensc/pkcs15-tcos.c
+index 491d9c8..24e8cee 100644
+--- a/src/libopensc/pkcs15-tcos.c
++++ b/src/libopensc/pkcs15-tcos.c
+@@ -78,7 +78,7 @@ static int insert_cert(
+ 	}
+ 
+ 	/* some certificates are prefixed by an OID */
+-	if (cert_len >= 5 && (size_t)(7 + cert[5]) <= cert_len &&
++	if (cert_len > 9 && (size_t)(7 + cert[5]) <= cert_len &&
+ 			cert[4] == 0x06 && cert[5] < 10 && cert[6 + cert[5]] == 0x30 &&
+ 			cert[7 + cert[5]] == 0x82) {
+ 		if ((size_t)(9 + cert[5]) > cert_len) {
diff -Nru opensc-0.26.1/debian/patches/CVE-2025-13763-2.patch opensc-0.26.1/debian/patches/CVE-2025-13763-2.patch
--- opensc-0.26.1/debian/patches/CVE-2025-13763-2.patch	1970-01-01 01:00:00.000000000 +0100
+++ opensc-0.26.1/debian/patches/CVE-2025-13763-2.patch	2026-12-04 15:37:59.000000000 +0100
@@ -0,0 +1,42 @@
+From: Jakub Jelen <jjelen@redhat.com>
+Date: Wed, 4 Jun 2025 19:51:17 +0200
+Subject: starcert: Avoid using uninitialized values (3)
+
+Previously, the read could return small response, which would result
+in accessin uninitialized parts of the buffer.
+
+Thanks Matteo Marini for the report!
+
+Signed-off-by: Jakub Jelen <jjelen@redhat.com>
+(cherry picked from commit 7e3dcae1d14e898dfed00ce8aa1d1bfeaee7c936)
+---
+ src/libopensc/pkcs15-atrust-acos.c | 2 +-
+ src/libopensc/pkcs15-starcert.c    | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/libopensc/pkcs15-atrust-acos.c b/src/libopensc/pkcs15-atrust-acos.c
+index e6b5398..a4d4217 100644
+--- a/src/libopensc/pkcs15-atrust-acos.c
++++ b/src/libopensc/pkcs15-atrust-acos.c
+@@ -78,7 +78,7 @@ static int get_cert_len(sc_card_t *card, sc_path_t *path)
+ 	if (r < 0)
+ 		return 0;
+ 	r = sc_read_binary(card, 0, buf, sizeof(buf), 0);
+-	if (r < 0)
++	if (r < 4)
+ 		return 0;
+ 	if (buf[0] != 0x30 || buf[1] != 0x82)
+ 		return 0;
+diff --git a/src/libopensc/pkcs15-starcert.c b/src/libopensc/pkcs15-starcert.c
+index b2beb75..8aafb1d 100644
+--- a/src/libopensc/pkcs15-starcert.c
++++ b/src/libopensc/pkcs15-starcert.c
+@@ -88,7 +88,7 @@ static int get_cert_len(sc_card_t *card, sc_path_t *path)
+ 	if (r < 0)
+ 		return 0;
+ 	r = sc_read_binary(card, 0, buf, sizeof(buf), 0);
+-	if (r < 0)
++	if (r < 4)
+ 		return 0;
+ 	if (buf[0] != 0x30 || buf[1] != 0x82)
+ 		return 0;
diff -Nru opensc-0.26.1/debian/patches/CVE-2025-13763-3.patch opensc-0.26.1/debian/patches/CVE-2025-13763-3.patch
--- opensc-0.26.1/debian/patches/CVE-2025-13763-3.patch	1970-01-01 01:00:00.000000000 +0100
+++ opensc-0.26.1/debian/patches/CVE-2025-13763-3.patch	2026-12-04 15:37:59.000000000 +0100
@@ -0,0 +1,24 @@
+From: Jakub Jelen <jjelen@redhat.com>
+Date: Tue, 23 Sep 2025 14:57:43 +0200
+Subject: pkcs15-pubkey: Avoid accessing behind buffer bounds
+ (fuzz_pkcs15_crypt/3)
+
+Signed-off-by: Jakub Jelen <jjelen@redhat.com>
+(cherry picked from commit 7000dee0eb7d35246b5e180b39bb4e03b11f1c47)
+---
+ src/libopensc/pkcs15-pubkey.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/libopensc/pkcs15-pubkey.c b/src/libopensc/pkcs15-pubkey.c
+index 83f3feb..ab9ea41 100644
+--- a/src/libopensc/pkcs15-pubkey.c
++++ b/src/libopensc/pkcs15-pubkey.c
+@@ -1335,7 +1335,7 @@ sc_pkcs15_pubkey_from_spki_fields(struct sc_context *ctx, struct sc_pkcs15_pubke
+ 	}
+ 	memcpy(tmp_buf, buf, buflen);
+ 
+-	if ((*tmp_buf & SC_ASN1_TAG_CONTEXT))
++	if (buflen > 0 && (*tmp_buf & SC_ASN1_TAG_CONTEXT))
+ 		*tmp_buf = SC_ASN1_TAG_CONSTRUCTED | SC_ASN1_TAG_SEQUENCE;
+ 
+ 	memset(&pk_alg, 0, sizeof(pk_alg));
diff -Nru opensc-0.26.1/debian/patches/CVE-2025-13763-4.patch opensc-0.26.1/debian/patches/CVE-2025-13763-4.patch
--- opensc-0.26.1/debian/patches/CVE-2025-13763-4.patch	1970-01-01 01:00:00.000000000 +0100
+++ opensc-0.26.1/debian/patches/CVE-2025-13763-4.patch	2026-12-04 15:37:59.000000000 +0100
@@ -0,0 +1,24 @@
+From: Jakub Jelen <jjelen@redhat.com>
+Date: Tue, 23 Sep 2025 16:37:05 +0200
+Subject: openpgp: Avoid using uninitialized data in the OID
+ (fuzz_pkcs15_crypt/5)
+
+Signed-off-by: Jakub Jelen <jjelen@redhat.com>
+(cherry picked from commit 29122ae779fa8ecb201b0c0b3bdad058b9540262)
+---
+ src/libopensc/pkcs15-openpgp.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/libopensc/pkcs15-openpgp.c b/src/libopensc/pkcs15-openpgp.c
+index d465724..f6fa324 100644
+--- a/src/libopensc/pkcs15-openpgp.c
++++ b/src/libopensc/pkcs15-openpgp.c
+@@ -315,7 +315,7 @@ sc_pkcs15emu_openpgp_init(sc_pkcs15_card_t *p15card)
+ 
+ 		/* only add valid keys, i.e. those with a legal algorithm identifier & finger print */
+ 		if (j >= 0 && cxdata[0] != 0) {
+-			struct sc_object_id oid;
++			struct sc_object_id oid = {0};
+ 			struct sc_algorithm_info * algorithm_info; /* no need to free */
+ 
+ 			algorithm_info = NULL;
diff -Nru opensc-0.26.1/debian/patches/CVE-2025-13763-5.patch opensc-0.26.1/debian/patches/CVE-2025-13763-5.patch
--- opensc-0.26.1/debian/patches/CVE-2025-13763-5.patch	1970-01-01 01:00:00.000000000 +0100
+++ opensc-0.26.1/debian/patches/CVE-2025-13763-5.patch	2026-12-04 15:37:59.000000000 +0100
@@ -0,0 +1,23 @@
+From: Jakub Jelen <jjelen@redhat.com>
+Date: Wed, 24 Sep 2025 10:24:33 +0200
+Subject: coolkey: Avoid zero-lenght allocations and access of uninitialized
+ memory (fuzz_pkcs15_reader/4)
+
+(cherry picked from commit 40fbddc46e026618b6a3d0a03e62adc1fb5ca956)
+---
+ src/libopensc/pkcs15-coolkey.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/libopensc/pkcs15-coolkey.c b/src/libopensc/pkcs15-coolkey.c
+index 5435e59..5d259f4 100644
+--- a/src/libopensc/pkcs15-coolkey.c
++++ b/src/libopensc/pkcs15-coolkey.c
+@@ -209,7 +209,7 @@ coolkey_get_attribute_bytes_alloc(sc_card_t *card, sc_cardctl_coolkey_object_t *
+ 	int r;
+ 
+ 	r = coolkey_get_attribute(card, obj, type, &val, &val_len, NULL);
+-	if (r < 0) {
++	if (r < 0 || val_len < 1) {
+ 		return r;
+ 	}
+ 	*data = malloc(val_len);
diff -Nru opensc-0.26.1/debian/patches/CVE-2025-13763-6.patch opensc-0.26.1/debian/patches/CVE-2025-13763-6.patch
--- opensc-0.26.1/debian/patches/CVE-2025-13763-6.patch	1970-01-01 01:00:00.000000000 +0100
+++ opensc-0.26.1/debian/patches/CVE-2025-13763-6.patch	2026-12-04 15:37:59.000000000 +0100
@@ -0,0 +1,46 @@
+From: Jakub Jelen <jjelen@redhat.com>
+Date: Thu, 5 Jun 2025 11:00:21 +0200
+Subject: iasecc: Avoid using uninitialized memory (6)
+
+The parsed length from data did not take into the account the buffer
+bounds, which could result in accessing uninitialized memory.
+
+This change verifies the parsed size fits into the allocated buffer
+and following checks make sure we do not go behind the initialized
+buffer bounds.
+
+Thanks Matteo Marini for the report!
+
+Signed-off-by: Jakub Jelen <jjelen@redhat.com>
+(cherry picked from commit 7aafe6f8c4a962d8ee9208a62272b6b38d6db9f6)
+---
+ src/libopensc/iasecc-sdo.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/src/libopensc/iasecc-sdo.c b/src/libopensc/iasecc-sdo.c
+index dbd5b9f..f25f659 100644
+--- a/src/libopensc/iasecc-sdo.c
++++ b/src/libopensc/iasecc-sdo.c
+@@ -776,14 +776,21 @@ iasecc_sdo_parse(struct sc_card *card, unsigned char *data, size_t data_len, str
+ 		size_size = iasecc_parse_size(data + 1, data_len - 1, &size);
+ 		LOG_TEST_RET(ctx, size_size, "parse error: invalid size data of IASECC_SDO_TEMPLATE");
+ 
++		if (data_len < (size_t)(size_size + 1)) {
++			LOG_FUNC_RETURN(ctx, SC_ERROR_INVALID_DATA);
++		}
+ 		data += size_size + 1;
++		data_len -= (size_size + 1);
++		if (size > data_len) {
++			LOG_FUNC_RETURN(ctx, SC_ERROR_INVALID_DATA);
++		}
+ 		data_len = size;
+ 		sc_log(ctx,
+ 		       "IASECC_SDO_TEMPLATE: size %"SC_FORMAT_LEN_SIZE_T"u, size_size %d",
+ 		       size, size_size);
+ 	}
+ 
+-	if (*data != IASECC_SDO_TAG_HEADER)
++	if (data_len < 4 || *data != IASECC_SDO_TAG_HEADER)
+ 		LOG_FUNC_RETURN(ctx, SC_ERROR_INVALID_DATA);
+ 
+ 	if (sdo->sdo_class != (*(data + 1) & 0x7F))
diff -Nru opensc-0.26.1/debian/patches/CVE-2025-13763-7.patch opensc-0.26.1/debian/patches/CVE-2025-13763-7.patch
--- opensc-0.26.1/debian/patches/CVE-2025-13763-7.patch	1970-01-01 01:00:00.000000000 +0100
+++ opensc-0.26.1/debian/patches/CVE-2025-13763-7.patch	2026-12-04 15:37:59.000000000 +0100
@@ -0,0 +1,32 @@
+From: Jakub Jelen <jjelen@redhat.com>
+Date: Wed, 24 Sep 2025 10:18:09 +0200
+Subject: iasecc: Fix the length check to avoid usage of uninitialized memory
+ (fuzz_pkcs15_encode/6)
+
+Signed-off-by: Jakub Jelen <jjelen@redhat.com>
+(cherry picked from commit a89dff3271da2eccd834553a4c0dfb7c543657c5)
+---
+ src/libopensc/iasecc-sdo.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/libopensc/iasecc-sdo.c b/src/libopensc/iasecc-sdo.c
+index f25f659..c72fea1 100644
+--- a/src/libopensc/iasecc-sdo.c
++++ b/src/libopensc/iasecc-sdo.c
+@@ -317,6 +317,7 @@ iasecc_se_parse(struct sc_card *card, unsigned char *data, size_t data_len, stru
+ 	int rv;
+ 
+ 	LOG_FUNC_CALLED(ctx);
++	sc_log(ctx, "data_len %"SC_FORMAT_LEN_SIZE_T"u", data_len);
+ 
+ 	if (data_len < 1)
+ 		LOG_FUNC_RETURN(ctx, SC_ERROR_INVALID_DATA);
+@@ -325,7 +326,7 @@ iasecc_se_parse(struct sc_card *card, unsigned char *data, size_t data_len, stru
+ 		size_size = iasecc_parse_size(data + 1, data_len - 1, &size);
+ 		LOG_TEST_RET(ctx, size_size, "parse error: invalid size data of IASECC_SDO_TEMPLATE");
+ 
+-		if (data_len - 1 < size)
++		if (data_len < size + size_size + 1)
+ 			LOG_FUNC_RETURN(ctx, SC_ERROR_INVALID_DATA);
+ 
+ 		data += size_size + 1;
diff -Nru opensc-0.26.1/debian/patches/CVE-2025-13763-8.patch opensc-0.26.1/debian/patches/CVE-2025-13763-8.patch
--- opensc-0.26.1/debian/patches/CVE-2025-13763-8.patch	1970-01-01 01:00:00.000000000 +0100
+++ opensc-0.26.1/debian/patches/CVE-2025-13763-8.patch	2026-12-04 15:37:59.000000000 +0100
@@ -0,0 +1,30 @@
+From: Jakub Jelen <jjelen@redhat.com>
+Date: Wed, 4 Jun 2025 17:08:20 +0200
+Subject: iasecc: Properly set resplen when emulating fcp (1)
+
+Previously, this could lead to use uninitialized memory as
+the caller would handle the returned apdu buffer as longer
+than it actually is.
+
+Thanks Matteo Marini for the report!
+
+Signed-off-by: Jakub Jelen <jjelen@redhat.com>
+(cherry picked from commit ab568f0a420931d5372bc8657f4024ca6d0e3285)
+---
+ src/libopensc/card-iasecc.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/libopensc/card-iasecc.c b/src/libopensc/card-iasecc.c
+index 4ecadc8..75c2315 100644
+--- a/src/libopensc/card-iasecc.c
++++ b/src/libopensc/card-iasecc.c
+@@ -892,7 +892,8 @@ iasecc_emulate_fcp(struct sc_context *ctx, struct sc_apdu *apdu)
+ 	memcpy(dummy_df_fcp + 16, apdu->data, apdu->datalen);
+ 	dummy_df_fcp[15] = apdu->datalen;
+ 	dummy_df_fcp[1] = apdu->datalen + 14;
+-	memcpy(apdu->resp, dummy_df_fcp, apdu->datalen + 16);
++	apdu->resplen = apdu->datalen + 16;
++	memcpy(apdu->resp, dummy_df_fcp, apdu->resplen);
+ 
+ 	LOG_FUNC_RETURN(ctx, SC_SUCCESS);
+ }
diff -Nru opensc-0.26.1/debian/patches/CVE-2025-13763-9.patch opensc-0.26.1/debian/patches/CVE-2025-13763-9.patch
--- opensc-0.26.1/debian/patches/CVE-2025-13763-9.patch	1970-01-01 01:00:00.000000000 +0100
+++ opensc-0.26.1/debian/patches/CVE-2025-13763-9.patch	2026-12-04 15:37:59.000000000 +0100
@@ -0,0 +1,23 @@
+From: Jakub Jelen <jjelen@redhat.com>
+Date: Tue, 23 Sep 2025 14:33:39 +0200
+Subject: gemsafeV1: Avoid use of uninitialized memory (fuzz_pkcs15_crypt/1)
+
+Signed-off-by: Jakub Jelen <jjelen@redhat.com>
+(cherry picked from commit 267111f2e3b766e5ad985105cd1a3416d569ff89)
+---
+ src/libopensc/card-gemsafeV1.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/libopensc/card-gemsafeV1.c b/src/libopensc/card-gemsafeV1.c
+index 984563f..19c9137 100644
+--- a/src/libopensc/card-gemsafeV1.c
++++ b/src/libopensc/card-gemsafeV1.c
+@@ -373,7 +373,7 @@ static int gemsafe_process_fci(struct sc_card *card, struct sc_file *file,
+ 	sc_log(ctx,  "file type: %s\n", type);
+ 
+ 	tag = sc_asn1_find_tag(ctx, p, len, 0x8C, &tlen);
+-	if (tag) {
++	if (tag && tlen > 1) {
+ 		r = gemsafe_setacl(card, file, tag, strcmp(type, "DF") ? 0 : 1);
+ 		if (r < 0) {
+ 			sc_log(ctx,  "unable to set ACL\n");
diff -Nru opensc-0.26.1/debian/patches/CVE-2025-49010.patch opensc-0.26.1/debian/patches/CVE-2025-49010.patch
--- opensc-0.26.1/debian/patches/CVE-2025-49010.patch	1970-01-01 01:00:00.000000000 +0100
+++ opensc-0.26.1/debian/patches/CVE-2025-49010.patch	2026-12-04 15:37:59.000000000 +0100
@@ -0,0 +1,68 @@
+From: Frank Morgner <frankmorgner@gmail.com>
+Date: Thu, 22 May 2025 00:24:32 +0200
+Subject: fixed Stack-buffer-overflow WRITE in GET RESPONSE
+
+The do-while loop in apdu.c requires the output data to be set in any
+case, otherwise non existent data may be copied to the output data.
+
+fixes https://issues.oss-fuzz.com/issues/416351800
+fixes https://issues.oss-fuzz.com/issues/416295951
+
+(cherry picked from commit 953986f65db61871bbbff72788d861d67d5140c6)
+---
+ src/libopensc/card-nqApplet.c | 11 ++++++-----
+ src/libopensc/iso7816.c       |  5 +++--
+ 2 files changed, 9 insertions(+), 7 deletions(-)
+
+diff --git a/src/libopensc/card-nqApplet.c b/src/libopensc/card-nqApplet.c
+index f9075b9..90706f4 100644
+--- a/src/libopensc/card-nqApplet.c
++++ b/src/libopensc/card-nqApplet.c
+@@ -190,9 +190,10 @@ static int nqapplet_finish(struct sc_card *card)
+ 	LOG_FUNC_RETURN(card->ctx, SC_SUCCESS);
+ }
+ 
+-static int nqapplet_get_response(struct sc_card *card, size_t *cb_resp, u8 *resp)
++static int
++nqapplet_get_response(struct sc_card *card, size_t *cb_resp, u8 *resp)
+ {
+-	struct sc_apdu apdu;
++	struct sc_apdu apdu = {0};
+ 	int rv;
+ 	size_t resplen;
+ 
+@@ -204,12 +205,12 @@ static int nqapplet_get_response(struct sc_card *card, size_t *cb_resp, u8 *resp
+ 
+ 	rv = sc_transmit_apdu(card, &apdu);
+ 	LOG_TEST_RET(card->ctx, rv, "APDU transmit failed");
+-	if (apdu.resplen == 0) {
+-		LOG_FUNC_RETURN(card->ctx, sc_check_sw(card, apdu.sw1, apdu.sw2));
+-	}
+ 
+ 	*cb_resp = apdu.resplen;
+ 
++	if (apdu.resplen == 0) {
++		LOG_FUNC_RETURN(card->ctx, sc_check_sw(card, apdu.sw1, apdu.sw2));
++	}
+ 	if (apdu.sw1 == 0x90 && apdu.sw2 == 0x00) {
+ 		rv = SC_SUCCESS;
+ 	} else if (apdu.sw1 == 0x61) {
+diff --git a/src/libopensc/iso7816.c b/src/libopensc/iso7816.c
+index e17549c..8535ea1 100644
+--- a/src/libopensc/iso7816.c
++++ b/src/libopensc/iso7816.c
+@@ -920,11 +920,12 @@ iso7816_get_response(struct sc_card *card, size_t *count, u8 *buf)
+ 
+ 	r = sc_transmit_apdu(card, &apdu);
+ 	LOG_TEST_RET(card->ctx, r, "APDU transmit failed");
+-	if (apdu.resplen == 0)
+-		LOG_FUNC_RETURN(card->ctx, sc_check_sw(card, apdu.sw1, apdu.sw2));
+ 
+ 	*count = apdu.resplen;
+ 
++	if (apdu.resplen == 0) {
++		LOG_FUNC_RETURN(card->ctx, sc_check_sw(card, apdu.sw1, apdu.sw2));
++	}
+ 	if (apdu.sw1 == 0x90 && apdu.sw2 == 0x00)
+ 		r = 0;					/* no more data to read */
+ 	else if (apdu.sw1 == 0x61)
diff -Nru opensc-0.26.1/debian/patches/CVE-2025-66037.patch opensc-0.26.1/debian/patches/CVE-2025-66037.patch
--- opensc-0.26.1/debian/patches/CVE-2025-66037.patch	1970-01-01 01:00:00.000000000 +0100
+++ opensc-0.26.1/debian/patches/CVE-2025-66037.patch	2026-12-04 15:37:59.000000000 +0100
@@ -0,0 +1,30 @@
+From: Jakub Jelen <jjelen@redhat.com>
+Date: Tue, 25 Nov 2025 15:58:02 +0100
+Subject: pkcs15: Avoid buffer overrun on invalid data
+
+Invalid data can contain zero-length buffer, which after copying
+was dereferenced without length check
+
+Credit: Aldo Ristori
+
+Signed-off-by: Jakub Jelen <jjelen@redhat.com>
+(cherry picked from commit 65fc211015cfcac27b10d0876054156c97225f50)
+---
+ src/libopensc/pkcs15-pubkey.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/libopensc/pkcs15-pubkey.c b/src/libopensc/pkcs15-pubkey.c
+index ab9ea41..9bcfadb 100644
+--- a/src/libopensc/pkcs15-pubkey.c
++++ b/src/libopensc/pkcs15-pubkey.c
+@@ -1328,6 +1328,10 @@ sc_pkcs15_pubkey_from_spki_fields(struct sc_context *ctx, struct sc_pkcs15_pubke
+ 	       "sc_pkcs15_pubkey_from_spki_fields() called: %p:%"SC_FORMAT_LEN_SIZE_T"u\n%s",
+ 	       buf, buflen, sc_dump_hex(buf, buflen));
+ 
++	if (buflen < 1) {
++		LOG_TEST_RET(ctx, SC_ERROR_INVALID_DATA, "subjectPublicKeyInfo can not be empty");
++	}
++
+ 	tmp_buf = malloc(buflen);
+ 	if (!tmp_buf) {
+ 		r = SC_ERROR_OUT_OF_MEMORY;
diff -Nru opensc-0.26.1/debian/patches/CVE-2025-66038.patch opensc-0.26.1/debian/patches/CVE-2025-66038.patch
--- opensc-0.26.1/debian/patches/CVE-2025-66038.patch	1970-01-01 01:00:00.000000000 +0100
+++ opensc-0.26.1/debian/patches/CVE-2025-66038.patch	2026-12-04 15:37:59.000000000 +0100
@@ -0,0 +1,38 @@
+From: David Fort <contact@hardening-consulting.com>
+Date: Wed, 1 Oct 2025 21:50:52 +0200
+Subject: idprime: fix pin padding for SafeNet eToken 5100 [eToken 5110 SC]
+
+As discussed in https://github.com/OpenSC/OpenSC/issues/3488 , it seems like my card
+with ATR 3b:ff:96:00:00:81:31:fe:43:80:31:80:65:b0:85:59:56:fb:12:01:78:82:90:00:88
+needs to be identified as SC_CARD_TYPE_IDPRIME_940 to have padding for the pin.
+
+(cherry picked from commit 6db171bcb6fd7cb3b51098fefbb3b28e44f0a79c)
+---
+ src/libopensc/card-idprime.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/src/libopensc/card-idprime.c b/src/libopensc/card-idprime.c
+index 531ac04..7296ad7 100644
+--- a/src/libopensc/card-idprime.c
++++ b/src/libopensc/card-idprime.c
+@@ -70,7 +70,7 @@ static const struct sc_atr_table idprime_atrs[] = {
+ 	 * 3b:ff:96:00:00:81:31:fe:43:80:31:80:65:b0:84:65:66:fb:12:01:78:82:90:00:85    metsma
+ 	 */
+ 	{ "3b:ff:96:00:00:81:31:fe:43:80:31:80:65:b0:84:65:66:fb:12:01:78:82:90:00:85",
+-	  "ff:ff:00:ff:ff:ff:ff:00:ff:ff:ff:ff:ff:ff:00:00:00:00:ff:ff:ff:ff:ff:ff:00",
++	  "ff:ff:00:ff:ff:ff:ff:00:ff:ff:ff:ff:ff:ff:ff:00:00:00:ff:ff:ff:ff:ff:ff:00",
+ 	  "based Gemalto IDPrime 930 (eToken 5110+ FIPS)",
+ 	  SC_CARD_TYPE_IDPRIME_930, 0, NULL },
+ 	/* known ATR for IDPrime 940: Placing in front of the 940 as its mask overlaps this one!
+@@ -96,9 +96,10 @@ static const struct sc_atr_table idprime_atrs[] = {
+ 	  SC_CARD_TYPE_IDPRIME_940, 0, NULL },
+ 	/* Known ATRs for IDPrime 940 (eToken 5110)
+ 	 * 3b:ff:96:00:00:81:31:fe:43:80:31:80:65:b0:85:59:56:fb:12:0f:fe:82:90:00:00    metsma, jurajsarinay
++	 * 3b:ff:96:00:00:81:31:fe:43:80:31:80:65:b0:85:59:56:fb:12:01:78:82:90:00:88    hardening
+ 	 */
+ 	{ "3b:ff:96:00:00:81:31:fe:43:80:31:80:65:b0:85:59:56:fb:12:0f:fe:82:90:00:00",
+-	  "ff:ff:00:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:00:00:00:00:ff:ff:ff:ff:ff:ff:00",
++	  "ff:ff:00:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:00:00:00:00:ff:f0:00:ff:ff:ff:00",
+ 	  "Gemalto IDPrime MD 940 (eToken 5110)",
+ 	  SC_CARD_TYPE_IDPRIME_940, 0, NULL },
+ 	{ "3b:7f:96:00:00:80:31:80:65:b0:84:41:3d:f6:12:0f:fe:82:90:00",
diff -Nru opensc-0.26.1/debian/patches/CVE-2025-66215-0.patch opensc-0.26.1/debian/patches/CVE-2025-66215-0.patch
--- opensc-0.26.1/debian/patches/CVE-2025-66215-0.patch	1970-01-01 01:00:00.000000000 +0100
+++ opensc-0.26.1/debian/patches/CVE-2025-66215-0.patch	2026-12-04 15:37:59.000000000 +0100
@@ -0,0 +1,32 @@
+From: Frank Morgner <frankmorgner@gmail.com>
+Date: Wed, 4 Jun 2025 01:07:56 +0200
+Subject: oberthur: fixed potential Stack-buffer-overflow WRITE
+
+(cherry picked from commit 3402a90d8c9be223d4cf6abe009a4707117d7972)
+---
+ src/libopensc/card-oberthur.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/src/libopensc/card-oberthur.c b/src/libopensc/card-oberthur.c
+index 5920c2c..a966652 100644
+--- a/src/libopensc/card-oberthur.c
++++ b/src/libopensc/card-oberthur.c
+@@ -2250,14 +2250,16 @@ auth_read_record(struct sc_card *card, unsigned int nr_rec, unsigned int idx,
+ 	if (flags & SC_RECORD_BY_REC_NR)
+ 		apdu.p2 |= 0x04;
+ 
+-	apdu.le = count;
+-	apdu.resplen = count;
++	apdu.le = count > SC_MAX_APDU_BUFFER_SIZE ? SC_MAX_APDU_BUFFER_SIZE : count;
++	apdu.resplen = SC_MAX_APDU_BUFFER_SIZE;
+ 	apdu.resp = recvbuf;
+ 
+ 	rv = sc_transmit_apdu(card, &apdu);
+ 	LOG_TEST_RET(card->ctx, rv, "APDU transmit failed");
+ 	if (apdu.resplen == 0)
+ 		LOG_FUNC_RETURN(card->ctx, sc_check_sw(card, apdu.sw1, apdu.sw2));
++	if (count < apdu.resplen)
++		LOG_FUNC_RETURN(card->ctx, SC_ERROR_WRONG_LENGTH);
+ 	memcpy(buf, recvbuf, apdu.resplen);
+ 
+ 	rv = sc_check_sw(card, apdu.sw1, apdu.sw2);
diff -Nru opensc-0.26.1/debian/patches/CVE-2025-66215-1.patch opensc-0.26.1/debian/patches/CVE-2025-66215-1.patch
--- opensc-0.26.1/debian/patches/CVE-2025-66215-1.patch	1970-01-01 01:00:00.000000000 +0100
+++ opensc-0.26.1/debian/patches/CVE-2025-66215-1.patch	2026-12-04 15:37:59.000000000 +0100
@@ -0,0 +1,40 @@
+From: Frank Morgner <frankmorgner@gmail.com>
+Date: Thu, 5 Jun 2025 13:18:15 +0200
+Subject: oberthur: use MIN where possible
+
+(cherry picked from commit a4bbf8a631537a4c0083b264095ed1cd36d307ab)
+---
+ src/libopensc/card-oberthur.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/libopensc/card-oberthur.c b/src/libopensc/card-oberthur.c
+index a966652..e06efff 100644
+--- a/src/libopensc/card-oberthur.c
++++ b/src/libopensc/card-oberthur.c
+@@ -603,7 +603,7 @@ auth_list_files(struct sc_card *card, unsigned char *buf, size_t buflen)
+ 	if (apdu.resplen == 0x100 && rbuf[0]==0 && rbuf[1]==0)
+ 		LOG_FUNC_RETURN(card->ctx, 0);
+ 
+-	buflen = buflen < apdu.resplen ? buflen : apdu.resplen;
++	buflen = MIN(buflen, apdu.resplen);
+ 	memcpy(buf, rbuf, buflen);
+ 
+ 	LOG_FUNC_RETURN(card->ctx, (int)buflen);
+@@ -1130,7 +1130,7 @@ auth_compute_signature(struct sc_card *card, const unsigned char *in, size_t ile
+ 	apdu.datalen = ilen;
+ 	apdu.data = in;
+ 	apdu.lc = ilen;
+-	apdu.le = olen > 256 ? 256 : olen;
++	apdu.le = MIN(olen, 256);
+ 	apdu.resp = resp;
+ 	apdu.resplen = olen;
+ 
+@@ -2250,7 +2250,7 @@ auth_read_record(struct sc_card *card, unsigned int nr_rec, unsigned int idx,
+ 	if (flags & SC_RECORD_BY_REC_NR)
+ 		apdu.p2 |= 0x04;
+ 
+-	apdu.le = count > SC_MAX_APDU_BUFFER_SIZE ? SC_MAX_APDU_BUFFER_SIZE : count;
++	apdu.le = MIN(count, SC_MAX_APDU_BUFFER_SIZE);
+ 	apdu.resplen = SC_MAX_APDU_BUFFER_SIZE;
+ 	apdu.resp = recvbuf;
+ 
diff -Nru opensc-0.26.1/debian/patches/CVE-2025-66215-2.patch opensc-0.26.1/debian/patches/CVE-2025-66215-2.patch
--- opensc-0.26.1/debian/patches/CVE-2025-66215-2.patch	1970-01-01 01:00:00.000000000 +0100
+++ opensc-0.26.1/debian/patches/CVE-2025-66215-2.patch	2026-12-04 15:37:59.000000000 +0100
@@ -0,0 +1,57 @@
+From: Frank Morgner <frankmorgner@gmail.com>
+Date: Thu, 5 Jun 2025 14:04:35 +0200
+Subject: oberthur: use SC_MAX_APDU_RESP_SIZE where possible
+
+(cherry picked from commit 56bc5e9575965461d99a274be45d71c18ab6eae0)
+---
+ src/libopensc/card-oberthur.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/libopensc/card-oberthur.c b/src/libopensc/card-oberthur.c
+index e06efff..86f2336 100644
+--- a/src/libopensc/card-oberthur.c
++++ b/src/libopensc/card-oberthur.c
+@@ -1130,7 +1130,7 @@ auth_compute_signature(struct sc_card *card, const unsigned char *in, size_t ile
+ 	apdu.datalen = ilen;
+ 	apdu.data = in;
+ 	apdu.lc = ilen;
+-	apdu.le = MIN(olen, 256);
++	apdu.le = MIN(olen, SC_MAX_APDU_RESP_SIZE);
+ 	apdu.resp = resp;
+ 	apdu.resplen = olen;
+ 
+@@ -1177,14 +1177,14 @@ auth_decipher(struct sc_card *card, const unsigned char *in, size_t inlen,
+ 	}
+ 
+ 	_inlen = inlen;
+-	if (_inlen == 256)   {
++	if (_inlen == SC_MAX_APDU_RESP_SIZE)   {
+ 		apdu.cla |= 0x10;
+ 		apdu.data = in;
+ 		apdu.datalen = 8;
+ 		apdu.resp = resp;
+ 		apdu.resplen = SC_MAX_APDU_BUFFER_SIZE;
+ 		apdu.lc = 8;
+-		apdu.le = 256;
++		apdu.le = SC_MAX_APDU_RESP_SIZE;
+ 
+ 		rv = sc_transmit_apdu(card, &apdu);
+ 		sc_log(card->ctx, "rv %i", rv);
+@@ -1508,7 +1508,7 @@ auth_read_component(struct sc_card *card, enum SC_CARDCTL_OBERTHUR_KEY_TYPE type
+ {
+ 	struct sc_apdu apdu;
+ 	int rv;
+-	unsigned char resp[256];
++	unsigned char resp[SC_MAX_APDU_RESP_SIZE];
+ 
+ 	LOG_FUNC_CALLED(card->ctx);
+ 	sc_log(card->ctx, "num %i, outlen %"SC_FORMAT_LEN_SIZE_T"u, type %i",
+@@ -2164,7 +2164,7 @@ auth_read_binary(struct sc_card *card, unsigned int offset,
+ 	if (auth_current_ef->magic==SC_FILE_MAGIC &&
+ 			auth_current_ef->ef_structure == SC_CARDCTL_OBERTHUR_KEY_RSA_PUBLIC)   {
+ 		int jj;
+-		unsigned char resp[256];
++		unsigned char resp[SC_MAX_APDU_RESP_SIZE];
+ 		size_t resp_len, out_len;
+ 		struct sc_pkcs15_pubkey_rsa key;
+ 
diff -Nru opensc-0.26.1/debian/patches/CVE-2026-10275.patch opensc-0.26.1/debian/patches/CVE-2026-10275.patch
--- opensc-0.26.1/debian/patches/CVE-2026-10275.patch	1970-01-01 01:00:00.000000000 +0100
+++ opensc-0.26.1/debian/patches/CVE-2026-10275.patch	2026-12-04 15:37:59.000000000 +0100
@@ -0,0 +1,26 @@
+From: Frank Morgner <frankmorgner@gmail.com>
+Date: Mon, 11 May 2026 11:00:28 +0200
+Subject: pkcs11-tool: prevent buffer overflow
+
+Reported by @HMF2021 hippofu999
+
+(cherry picked from commit 814f745b3b6d100295f65f1935edd33d520d33ab)
+---
+ src/tools/pkcs11-tool.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/tools/pkcs11-tool.c b/src/tools/pkcs11-tool.c
+index eacc19d..c8e136c 100644
+--- a/src/tools/pkcs11-tool.c
++++ b/src/tools/pkcs11-tool.c
+@@ -8390,6 +8390,10 @@ static CK_SESSION_HANDLE test_kpgen_certwrite(CK_SLOT_ID slot, CK_SESSION_HANDLE
+ 		return session;
+ 	}
+ 	opt_object_id_len = (size_t) i;
++	if (opt_object_id_len > sizeof(opt_object_id)) {
++		fprintf(stderr, "ERR: object ID too long\n");
++		return session;
++	}
+ 	memcpy(opt_object_id, tmp, opt_object_id_len);
+ 
+ 	/* This is done in NSS */
diff -Nru opensc-0.26.1/debian/patches/CVE-2026-103531.patch opensc-0.26.1/debian/patches/CVE-2026-103531.patch
--- opensc-0.26.1/debian/patches/CVE-2026-103531.patch	1970-01-01 01:00:00.000000000 +0100
+++ opensc-0.26.1/debian/patches/CVE-2026-103531.patch	2026-12-04 15:37:59.000000000 +0100
@@ -0,0 +1,49 @@
+From: wanglanlan <wanglanlan@users.noreply.github.com>
+Date: Wed, 2 Sep 2026 08:36:47 +0000
+Subject: setcos: Fix buffer overflow in setcos_construct_fci_44
+
+The FCI construction copied type_attr, sec_attr and prop_attr of the
+file into a fixed 64-byte stack buffer without checking the length.
+Malicious or corrupted attribute lengths (e.g. prop_attr_len > 64,
+reachable through fuzz_pkcs15init and attacker-controlled card
+responses) caused a stack buffer overflow (write).
+
+Return SC_ERROR_INVALID_DATA if any attribute exceeds the buffer size.
+
+Found with the fuzz_pkcs15init fuzzer.
+
+Co-Authored-By: Claude <noreply@anthropic.com>
+(cherry picked from commit ad730304052937c32b4eb489a06835ac6123632c)
+---
+ src/libopensc/card-setcos.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/src/libopensc/card-setcos.c b/src/libopensc/card-setcos.c
+index 3a624e0..507426a 100644
+--- a/src/libopensc/card-setcos.c
++++ b/src/libopensc/card-setcos.c
+@@ -248,6 +248,8 @@ static int setcos_construct_fci_44(sc_card_t *card, const sc_file_t *file, u8 *o
+ 
+ 	/* Type */
+ 	if (file->type_attr_len) {
++		if (file->type_attr_len > sizeof(buf))
++			LOG_FUNC_RETURN(card->ctx, SC_ERROR_INVALID_DATA);
+ 		memcpy(buf, file->type_attr, file->type_attr_len);
+ 		sc_asn1_put_tag(0x82, buf, file->type_attr_len, p, *outlen - (p - out), &p);
+ 	} else {
+@@ -301,11 +303,15 @@ static int setcos_construct_fci_44(sc_card_t *card, const sc_file_t *file, u8 *o
+ 	}
+ 
+ 	/* Security Attributes */
++	if (file->sec_attr_len > sizeof(buf))
++		LOG_FUNC_RETURN(card->ctx, SC_ERROR_INVALID_DATA);
+ 	memcpy(buf, file->sec_attr, file->sec_attr_len);
+ 	sc_asn1_put_tag(0x86, buf, file->sec_attr_len, p, *outlen - (p - out), &p);
+ 
+ 	/* Life cycle status */
+ 	if (file->prop_attr_len) {
++		if (file->prop_attr_len > sizeof(buf))
++			LOG_FUNC_RETURN(card->ctx, SC_ERROR_INVALID_DATA);
+ 		memcpy(buf, file->prop_attr, file->prop_attr_len);
+ 		sc_asn1_put_tag(0x8A, buf, file->prop_attr_len, p, *outlen - (p - out), &p);
+ 	}
diff -Nru opensc-0.26.1/debian/patches/series opensc-0.26.1/debian/patches/series
--- opensc-0.26.1/debian/patches/series	2025-06-06 12:09:05.000000000 +0200
+++ opensc-0.26.1/debian/patches/series	2026-12-04 15:37:59.000000000 +0100
@@ -1,3 +1,24 @@
 0001-Use-sysconfdir-opensc-for-opensc.conf.patch
 0002-Drop-non-functional-ENABLE_AUTOSTART.patch
 0003-pkcs11-register-app-config.patch
+CVE-2025-13763-1.patch
+CVE-2025-13763-2.patch
+CVE-2025-13763-3.patch
+CVE-2025-13763-4.patch
+CVE-2025-13763-5.patch
+CVE-2025-13763-6.patch
+CVE-2025-13763-7.patch
+CVE-2025-13763-8.patch
+CVE-2025-13763-9.patch
+CVE-2025-13763-10.patch
+CVE-2025-13763-11.patch
+CVE-2025-13763-12.patch
+CVE-2025-13763-13.patch
+CVE-2025-49010.patch
+CVE-2025-66037.patch
+CVE-2025-66038.patch
+CVE-2025-66215-0.patch
+CVE-2025-66215-1.patch
+CVE-2025-66215-2.patch
+CVE-2026-103531.patch
+CVE-2026-10275.patch

--zf5pz3e3x4nbjh44--
Technical Details
Message-ID: <O6CLM-fX4M-15@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!news-fra.pugleaf.net!news.tcpreset.net!newsfeed.bofh.team!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod
References: <O6nMJ-fOYI-1@gated-at.bofh.it> <O6nMJ-fOYI-1@gated-at.bofh.it>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-fra.pugleaf.net!news.tcpreset.net!newsfeed.bofh.team!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod
From: Andreas Henriksson <andreas@fatal.se>
Newsgroups: linux.debian.bugs.dist,linux.debian.devel.release
Subject: Bug#1156304: trixie-pu: package opensc/0.26.1-2+deb13u1
Date: Fri, 04 Dec 2026 15:50:02 +0100
Message-ID: <O6CLM-fX4M-15@gated-at.bofh.it>
References: <O6nMJ-fOYI-1@gated-at.bofh.it> <O6nMJ-fOYI-1@gated-at.bofh.it>
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org  Fri Dec  4 14:47:19 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -1.651
Reply-To: Andreas Henriksson <andreas@fatal.se>, 1156304@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: debian-release@lists.debian.org
X-Debian-Pr-Message: followup 1156304
X-Debian-Pr-Package: release.debian.org
X-Debian-Pr-Keywords: trixie
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="zf5pz3e3x4nbjh44"
Content-Disposition: inline
X-Debian-User: ah
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/2006945
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 887
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Fri, 4 Dec 2026 15:46:00 +0100
X-Original-Message-ID: <5iyz6hjb2ii73lqebiwupr7cq2ahl7bioseygblzex2tstvefj@lm7qopnenvw4>
X-Original-References: <179633787082.254702.11974380261207922690.reportbug@localhost> <179633787082.254702.11974380261207922690.reportbug@localhost>