Skip to contentSkip to conversation

package/busybox: add patch for CVE-2025-46394

PATCH Applied Thomas Perale via buildroot 2 participants 3 messages Feb 2 – Feb 13

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/busybox: add patch for CVE-2025-46394

Fixes the following vulnerability:

- CVE-2025-46394

In tar in BusyBox through 1.37.0, a TAR archive can have filenames hidden from a listing through the use of terminal escape sequences.

For more informations, see:
- https://nvd.nist.gov//vuln/detail/CVE-2025-46394
- https://git.busybox.net/busybox/commit/?id=f5e1bf966b19ea1821f00a8c9ecd7774598689b4
- https://patchwork.yoctoproject.org/project/oe-core/patch/[email protected]/#31415
- https://lists.busybox.net/pipermail/busybox/2025-October/091743.html

---
 ...archive-sanitize-filenames-on-output.patch | 58 +++++++++++++++++++
 ...-tests-fix-test-after-cve-2025-46394.patch | 33 +++++++++++
 package/busybox/busybox.mk                    |  4 ++
 3 files changed, 95 insertions(+)
 create mode 100644 package/busybox/0012-archival-libarchive-sanitize-filenames-on-output.patch
 create mode 100644 package/busybox/0013-testsuite-tar-tests-fix-test-after-cve-2025-46394.patch
package/busybox/0012-archival-libarchive-sanitize-filenames-on-output.patch new file +58 -0
new file mode 100644
index 0000000000..6af55c38c8
@@ -0,0 +1,58 @@
+From f5e1bf966b19ea1821f00a8c9ecd7774598689b4 Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <[email protected]>
+Date: Wed, 24 Sep 2025 03:28:47 +0200
+Subject: archival/libarchive: sanitize filenames on output (prevent control
+ sequence attacks
+
+This fixes CVE-2025-46394 (terminal escape sequence injection)
+
+Original credit: Ian.Norton at entrust.com
+
+function                                             old     new   delta
+header_list                                            9      15      +6
+header_verbose_list                                  239     244      +5
+------------------------------------------------------------------------------
+(add/remove: 0/0 grow/shrink: 2/0 up/down: 11/0)               Total: 11 bytes
+
+Signed-off-by: Denys Vlasenko <[email protected]>
+CVE: CVE-2025-46394
+Upstream: https://git.busybox.net/busybox/patch/?id=f5e1bf966b19ea1821f00a8c9ecd7774598689b4
+Signed-off-by: Thomas Perale <[email protected]>
+---
+ archival/libarchive/header_list.c         | 2 +-
+ archival/libarchive/header_verbose_list.c | 4 ++--
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/archival/libarchive/header_list.c b/archival/libarchive/header_list.c
+index 0621aa406..9490b3635 100644
+--- a/archival/libarchive/header_list.c
++++ b/archival/libarchive/header_list.c
+@@ -8,5 +8,5 @@
+ void FAST_FUNC header_list(const file_header_t *file_header)
+ {
+ //TODO: cpio -vp DIR should output "DIR/NAME", not just "NAME" */
+-	puts(file_header->name);
++	puts(printable_string(file_header->name));
+ }
+diff --git a/archival/libarchive/header_verbose_list.c b/archival/libarchive/header_verbose_list.c
+index a575a08a0..e7a09430d 100644
+--- a/archival/libarchive/header_verbose_list.c
++++ b/archival/libarchive/header_verbose_list.c
+@@ -57,13 +57,13 @@ void FAST_FUNC header_verbose_list(const file_header_t *file_header)
+ 		ptm->tm_hour,
+ 		ptm->tm_min,
+ 		ptm->tm_sec,
+-		file_header->name);
++		printable_string(file_header->name));
+ 
+ #endif /* FEATURE_TAR_UNAME_GNAME */
+ 
+ 	/* NB: GNU tar shows "->" for symlinks and "link to" for hardlinks */
+ 	if (file_header->link_target) {
+-		printf(" -> %s", file_header->link_target);
++		printf(" -> %s", printable_string(file_header->link_target));
+ 	}
+ 	bb_putchar('\n');
+ }
+-- 
+cgit v1.2.3
package/busybox/0013-testsuite-tar-tests-fix-test-after-cve-2025-46394.patch new file +33 -0
new file mode 100644
index 0000000000..bb56b846cf
@@ -0,0 +1,33 @@
+From 7378db981d87b4a2264e14d60340a7fb5c67ae59 Mon Sep 17 00:00:00 2001
+From: Peter Marko <[email protected]>
+Date: Fri, 3 Oct 2025 16:12:56 +0200
+Subject: [PATCH] testsuite/tar.tests: fix test after CVE-2025-46394
+
+tar now sanitizes output and this test needs to expect that.
+
+Signed-off-by: Peter Marko <[email protected]>
+
+CVE: CVE-2025-46394
+Signed-off-by: Peter Marko <[email protected]>
+Upstream: https://lists.busybox.net/pipermail/busybox/2025-October/091743.html
+Signed-off-by: Thomas Perale <[email protected]>
+---
+ testsuite/tar.tests | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/testsuite/tar.tests b/testsuite/tar.tests
+index 0f2e89112..48fc38114 100755
+--- a/testsuite/tar.tests
++++ b/testsuite/tar.tests
+@@ -325,9 +325,9 @@ unset LANG
+ rm -rf etc usr
+ ' "\
+ etc/ssl/certs/3b2716e5.0
+-etc/ssl/certs/EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.pem
++etc/ssl/certs/EBG_Elektronik_Sertifika_Hizmet_Sa??lay??c??s??.pem
+ etc/ssl/certs/f80cc7f6.0
+-usr/share/ca-certificates/mozilla/EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.crt
++usr/share/ca-certificates/mozilla/EBG_Elektronik_Sertifika_Hizmet_Sa??lay??c??s??.crt
+ 0
+ etc/ssl/certs/3b2716e5.0 -> EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.pem
+ etc/ssl/certs/EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.pem -> /usr/share/ca-certificates/mozilla/EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.crt
package/busybox/busybox.mk +4 -0
index 446f93c36c..7ae9c1d41e 100644
@@ -15,6 +15,10 @@ BUSYBOX_CPE_ID_VENDOR = busybox
 # 0004-nslookup-sanitize-all-printed-strings-with-printable.patch
 BUSYBOX_IGNORE_CVES += CVE-2022-28391
 
+# 0012-archival-libarchive-sanitize-filenames-on-output.patch
+# 0013-testsuite-tar-tests-fix-test-after-cve-2025-46394.patch
+BUSYBOX_IGNORE_CVES += CVE-2025-46394
+
 BUSYBOX_CFLAGS = \
 	$(TARGET_CFLAGS)
 
Signature · 6 lines
2.52.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 14 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Perale via buildroot <[email protected]> writes:

Fixes the following vulnerability:
- CVE-2025-46394

In tar in BusyBox through 1.37.0, a TAR archive can have filenames hidden from a listing through the use of terminal escape sequences.

For more informations, see:
- https://nvd.nist.gov//vuln/detail/CVE-2025-46394
- https://git.busybox.net/busybox/commit/?id=f5e1bf966b19ea1821f00a8c9ecd7774598689b4
- https://patchwork.yoctoproject.org/project/oe-core/patch/[email protected]/#31415
- https://lists.busybox.net/pipermail/busybox/2025-October/091743.html

Quoted 4 lines
---
 ...archive-sanitize-filenames-on-output.patch | 58 +++++++++++++++++++
 ...-tests-fix-test-after-cve-2025-46394.patch | 33 +++++++++++

I guess the testsuite patch is not strictly needed, but it also does not really hurt - So committed, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
In reply to Thomas Perale via buildroot

In reply of:

Quoted 7 lines

Fixes the following vulnerability:

- CVE-2025-46394

In tar in BusyBox through 1.37.0, a TAR archive can have filenames hidden from a listing through the use of terminal escape sequences.

Quoted 7 lines

For more informations, see:
- https://nvd.nist.gov//vuln/detail/CVE-2025-46394
- https://git.busybox.net/busybox/commit/?id=f5e1bf966b19ea1821f00a8c9ecd7774598689b4
- https://patchwork.yoctoproject.org/project/oe-core/patch/[email protected]/#31415
- https://lists.busybox.net/pipermail/busybox/2025-October/091743.html

Applied to 2025.02.x & 2025.11.x. Thanks

Quoted 133 lines
---
 ...archive-sanitize-filenames-on-output.patch | 58 +++++++++++++++++++
 ...-tests-fix-test-after-cve-2025-46394.patch | 33 +++++++++++
 package/busybox/busybox.mk                    |  4 ++
 3 files changed, 95 insertions(+)
 create mode 100644 package/busybox/0012-archival-libarchive-sanitize-filenames-on-output.patch
 create mode 100644 package/busybox/0013-testsuite-tar-tests-fix-test-after-cve-2025-46394.patch
package/busybox/0012-archival-libarchive-sanitize-filenames-on-output.patch new file +58 -0
new file mode 100644
index 0000000000..6af55c38c8
@@ -0,0 +1,58 @@
+From f5e1bf966b19ea1821f00a8c9ecd7774598689b4 Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <[email protected]>
+Date: Wed, 24 Sep 2025 03:28:47 +0200
+Subject: archival/libarchive: sanitize filenames on output (prevent control
+ sequence attacks
+
+This fixes CVE-2025-46394 (terminal escape sequence injection)
+
+Original credit: Ian.Norton at entrust.com
+
+function                                             old     new   delta
+header_list                                            9      15      +6
+header_verbose_list                                  239     244      +5
+------------------------------------------------------------------------------
+(add/remove: 0/0 grow/shrink: 2/0 up/down: 11/0)               Total: 11 bytes
+
+Signed-off-by: Denys Vlasenko <[email protected]>
+CVE: CVE-2025-46394
+Upstream: https://git.busybox.net/busybox/patch/?id=f5e1bf966b19ea1821f00a8c9ecd7774598689b4
+Signed-off-by: Thomas Perale <[email protected]>
+---
+ archival/libarchive/header_list.c         | 2 +-
+ archival/libarchive/header_verbose_list.c | 4 ++--
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/archival/libarchive/header_list.c b/archival/libarchive/header_list.c
+index 0621aa406..9490b3635 100644
+--- a/archival/libarchive/header_list.c
++++ b/archival/libarchive/header_list.c
+@@ -8,5 +8,5 @@
+ void FAST_FUNC header_list(const file_header_t *file_header)
+ {
+ //TODO: cpio -vp DIR should output "DIR/NAME", not just "NAME" */
+-	puts(file_header->name);
++	puts(printable_string(file_header->name));
+ }
+diff --git a/archival/libarchive/header_verbose_list.c b/archival/libarchive/header_verbose_list.c
+index a575a08a0..e7a09430d 100644
+--- a/archival/libarchive/header_verbose_list.c
++++ b/archival/libarchive/header_verbose_list.c
+@@ -57,13 +57,13 @@ void FAST_FUNC header_verbose_list(const file_header_t *file_header)
+ 		ptm->tm_hour,
+ 		ptm->tm_min,
+ 		ptm->tm_sec,
+-		file_header->name);
++		printable_string(file_header->name));
+ 
+ #endif /* FEATURE_TAR_UNAME_GNAME */
+ 
+ 	/* NB: GNU tar shows "->" for symlinks and "link to" for hardlinks */
+ 	if (file_header->link_target) {
+-		printf(" -> %s", file_header->link_target);
++		printf(" -> %s", printable_string(file_header->link_target));
+ 	}
+ 	bb_putchar('\n');
+ }
+-- 
+cgit v1.2.3
package/busybox/0013-testsuite-tar-tests-fix-test-after-cve-2025-46394.patch new file +33 -0
new file mode 100644
index 0000000000..bb56b846cf
@@ -0,0 +1,33 @@
+From 7378db981d87b4a2264e14d60340a7fb5c67ae59 Mon Sep 17 00:00:00 2001
+From: Peter Marko <[email protected]>
+Date: Fri, 3 Oct 2025 16:12:56 +0200
+Subject: [PATCH] testsuite/tar.tests: fix test after CVE-2025-46394
+
+tar now sanitizes output and this test needs to expect that.
+
+Signed-off-by: Peter Marko <[email protected]>
+
+CVE: CVE-2025-46394
+Signed-off-by: Peter Marko <[email protected]>
+Upstream: https://lists.busybox.net/pipermail/busybox/2025-October/091743.html
+Signed-off-by: Thomas Perale <[email protected]>
+---
+ testsuite/tar.tests | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/testsuite/tar.tests b/testsuite/tar.tests
+index 0f2e89112..48fc38114 100755
+--- a/testsuite/tar.tests
++++ b/testsuite/tar.tests
+@@ -325,9 +325,9 @@ unset LANG
+ rm -rf etc usr
+ ' "\
+ etc/ssl/certs/3b2716e5.0
+-etc/ssl/certs/EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.pem
++etc/ssl/certs/EBG_Elektronik_Sertifika_Hizmet_Sa??lay??c??s??.pem
+ etc/ssl/certs/f80cc7f6.0
+-usr/share/ca-certificates/mozilla/EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.crt
++usr/share/ca-certificates/mozilla/EBG_Elektronik_Sertifika_Hizmet_Sa??lay??c??s??.crt
+ 0
+ etc/ssl/certs/3b2716e5.0 -> EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.pem
+ etc/ssl/certs/EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.pem -> /usr/share/ca-certificates/mozilla/EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.crt
package/busybox/busybox.mk +4 -0
index 446f93c36c..7ae9c1d41e 100644
@@ -15,6 +15,10 @@ BUSYBOX_CPE_ID_VENDOR = busybox
 # 0004-nslookup-sanitize-all-printed-strings-with-printable.patch
 BUSYBOX_IGNORE_CVES += CVE-2022-28391
 
+# 0012-archival-libarchive-sanitize-filenames-on-output.patch
+# 0013-testsuite-tar-tests-fix-test-after-cve-2025-46394.patch
+BUSYBOX_IGNORE_CVES += CVE-2025-46394
+
 BUSYBOX_CFLAGS = \
 	$(TARGET_CFLAGS)
 
Signature · 6 lines
2.52.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot