Skip to contentSkip to conversation

perl: Fix CVE-2023-31484 & CVE-2023-31486

PATCH New Soumya 1 participant 1 message Jun 30, 2023

lore
Share & tools
lore

Soumya

author
#0 lore raw

PATCH 1/1 perl: Fix CVE-2023-31484 & CVE-2023-31486

CPAN.pm before 2.35 does not verify TLS certificates when downloading distributions over HTTPS.

HTTP::Tiny before 0.083, a Perl core module since 5.13.9 and available standalone on CPAN, has an insecure default TLS configuration where users must opt in to verify certificates.

References:
https://nvd.nist.gov/vuln/detail/CVE-2023-31484
https://nvd.nist.gov/vuln/detail/CVE-2023-31486

Upstream patches:
https://github.com/andk/cpanpm/commit/9c98370287f4e709924aee7c58ef21c85289a7f0
https://github.com/chansen/p5-http-tiny/commit/77f557ef84698efeb6eed04e4a9704eaf85b741d
https://github.com/chansen/p5-http-tiny/commit/a22785783b17cbaa28afaee4a024d81a1903701d

---
 .../perl/files/CVE-2023-31484.patch           |  29 +++
 .../perl/files/CVE-2023-31486-0001.patch      | 217 ++++++++++++++++++
 .../perl/files/CVE-2023-31486-0002.patch      |  30 +++
 meta/recipes-devtools/perl/perl_5.36.0.bb     |   3 +
 4 files changed, 279 insertions(+)
 create mode 100644 meta/recipes-devtools/perl/files/CVE-2023-31484.patch
 create mode 100644 meta/recipes-devtools/perl/files/CVE-2023-31486-0001.patch
 create mode 100644 meta/recipes-devtools/perl/files/CVE-2023-31486-0002.patch
meta/recipes-devtools/perl/files/CVE-2023-31484.patch new file +29 -0
new file mode 100644
index 0000000000..1f7cbd0da1
@@ -0,0 +1,29 @@
+From a625ec2cc3a0b6116c1f8b831d3480deb621c245 Mon Sep 17 00:00:00 2001
+From: Stig Palmquist <[email protected]>
+Date: Tue, 28 Feb 2023 11:54:06 +0100
+Subject: [PATCH] Add verify_SSL=>1 to HTTP::Tiny to verify https server
+ identity
+
+Upstream-Status: Backport [https://github.com/andk/cpanpm/commit/9c98370287f4e709924aee7c58ef21c85289a7f0]
+
+CVE: CVE-2023-31484
+
+Signed-off-by: Soumya <[email protected]>
+---
+ cpan/CPAN/lib/CPAN/HTTP/Client.pm | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/cpan/CPAN/lib/CPAN/HTTP/Client.pm b/cpan/CPAN/lib/CPAN/HTTP/Client.pm
+index 4fc792c..a616fee 100644
+--- a/cpan/CPAN/lib/CPAN/HTTP/Client.pm
++++ b/cpan/CPAN/lib/CPAN/HTTP/Client.pm
+@@ -32,6 +32,7 @@ sub mirror {
+
+     my $want_proxy = $self->_want_proxy($uri);
+     my $http = HTTP::Tiny->new(
++        verify_SSL => 1,
+         $want_proxy ? (proxy => $self->{proxy}) : ()
+     );
+
+--
+2.40.0
meta/recipes-devtools/perl/files/CVE-2023-31486-0001.patch new file +217 -0

217 lines not on this page · raw message

meta/recipes-devtools/perl/files/CVE-2023-31486-0002.patch new file +30 -0
new file mode 100644
index 0000000000..e41e140cf9
@@ -0,0 +1,30 @@
+commit a22785783b17cbaa28afaee4a024d81a1903701d
+From: Stig Palmquist <[email protected]>
+Date:   Sun Jun 18 11:36:05 2023 +0200
+
+    Fix incorrect env var name for verify_SSL default
+
+    The variable to override the verify_SSL default differed slightly in the
+    documentation from what was checked for in the code.
+
+    This commit makes the code use `PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT`
+    as documented, instead of `PERL_HTTP_TINY_INSECURE_BY_DEFAULT` which was
+    missing `SSL_`
+
+Upstream-Status: Backport [https://github.com/chansen/p5-http-tiny/commit/a22785783b17cbaa28afaee4a024d81a1903701d]
+
+Signed-off-by: Soumya <[email protected]>
+---
+diff --git a/lib/HTTP/Tiny.pm b/lib/HTTP/Tiny.pm
+index bf455b6..7240b65 100644
+--- a/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm
++++ b/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm
+@@ -149,7 +149,7 @@ sub _verify_SSL_default {
+     my ($self) = @_;
+     # Check if insecure default certificate verification behaviour has been
+     # changed by the user by setting PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT=1
+-    return (($ENV{PERL_HTTP_TINY_INSECURE_BY_DEFAULT} || '') eq '1') ? 0 : 1;
++    return (($ENV{PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT} || '') eq '1') ? 0 : 1;
+ }
+
+ sub _set_proxies {
meta/recipes-devtools/perl/perl_5.36.0.bb +3 -0
index b8dba00f18..c3ca28ed23 100644
@@ -18,6 +18,9 @@ SRC_URI = "https://www.cpan.org/src/5.0/perl-${PV}.tar.gz;name=perl \
            file://determinism.patch \
            file://0001-cpan-Sys-Syslog-Makefile.PL-Fix-_PATH_LOG-for-determ.patch \
            file://0001-Fix-build-with-gcc-12.patch \
+           file://CVE-2023-31484.patch \
+           file://CVE-2023-31486-0001.patch \
+           file://CVE-2023-31486-0002.patch \
            "
 SRC_URI:append:class-native = " \
            file://perl-configpm-switch.patch \
Signature · 1 line
2.40.0