diff mbox series

[kirkstone,1/1] perl: Fix CVE-2023-31486

Message ID 20230605032300.2325425-1-soumya.sambu@windriver.com
State New, archived
Headers show
Series [kirkstone,1/1] perl: Fix CVE-2023-31486 | expand

Commit Message

ssambu June 5, 2023, 3:23 a.m. UTC
HTTP::Tiny 0.082, 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.

Signed-off-by: Soumya <soumya.sambu@windriver.com>
---
 .../perl/files/CVE-2023-31486.patch           | 89 +++++++++++++++++++
 meta/recipes-devtools/perl/perl_5.34.1.bb     |  1 +
 2 files changed, 90 insertions(+)
 create mode 100644 meta/recipes-devtools/perl/files/CVE-2023-31486.patch

Comments

Randy MacLeod June 6, 2023, 6:24 p.m. UTC | #1
On 2023-06-04 23:23, Soumya via lists.openembedded.org wrote:
> HTTP::Tiny 0.082, 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.
>
> Signed-off-by: Soumya<soumya.sambu@windriver.com>
> ---
>   .../perl/files/CVE-2023-31486.patch           | 89 +++++++++++++++++++
>   meta/recipes-devtools/perl/perl_5.34.1.bb     |  1 +
>   2 files changed, 90 insertions(+)
>   create mode 100644 meta/recipes-devtools/perl/files/CVE-2023-31486.patch
>
> diff --git a/meta/recipes-devtools/perl/files/CVE-2023-31486.patch b/meta/recipes-devtools/perl/files/CVE-2023-31486.patch
> new file mode 100644
> index 0000000000..55c4bd1d47
> --- /dev/null
> +++ b/meta/recipes-devtools/perl/files/CVE-2023-31486.patch
> @@ -0,0 +1,89 @@
> +From 1490431e40e22052f75a0b3449f1f53cbd27ba92 Mon Sep 17 00:00:00 2001
> +From: Dominic Hargreaves<dom@earth.li>
> +Date: Thu, 21 May 2020 22:53:37 +0100
> +Subject: [PATCH] Enable SSL by default in HTTP::Tiny
> +
> +Gbp-Pq: Topic debian
> +Gbp-Pq: Name http-tiny-ssl.diff
> +
> +CVE: CVE-2023-31486
> +
> +Upstream-Status: Backport [https://salsa.debian.org/perl-team/interpreter/perl/-/commit/1490431e40e22052f75a0b3449f1f53cbd27ba92.patch]


The upstream for the YP Perl recipe is not Debian but rather:

https://layers.openembedded.org/layerindex/branch/master/recipes/?q=perl

-> https://www.perl.org/get.html

-> https://dev.perl.org/perl5/source.html

   git clone https://github.com/Perl/perl5.git perl


Please find the equivalent patch if it's available there and re-submit.

If the patch isn't there, there is a (not very active) maint-5.34 branch so
we should send a PR there and change the Upstream-Status for the oe-core 
commit as needed.

../Randy

> +
> +Signed-off-by: Soumya<soumya.sambu@windriver.com>
> +---
> + cpan/HTTP-Tiny/lib/HTTP/Tiny.pm | 20 +++++++++-----------
> + 1 file changed, 9 insertions(+), 11 deletions(-)
> +
> +diff --git a/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm b/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm
> +index 5803e45..88ba514 100644
> +--- a/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm
> ++++ b/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm
> +@@ -40,7 +40,7 @@ sub _croak { require Carp; Carp::croak(@_) }
> + #pod * C<timeout> — Request timeout in seconds (default is 60) If a socket open,
> + #pod   read or write takes longer than the timeout, an exception is thrown.
> + #pod * C<verify_SSL> — A boolean that indicates whether to validate the SSL
> +-#pod   certificate of an C<https> — connection (default is false)
> ++#pod   certificate of an C<https> — connection (default is true)
> + #pod * C<SSL_options> — A hashref of C<SSL_*> — options to pass through to
> + #pod   L<IO::Socket::SSL>
> + #pod
> +@@ -112,7 +112,7 @@ sub new {
> +         max_redirect => 5,
> +         timeout      => defined $args{timeout} ? $args{timeout} : 60,
> +         keep_alive   => 1,
> +-        verify_SSL   => $args{verify_SSL} || $args{verify_ssl} || 0, # no verification by default
> ++        verify_SSL   => $args{verify_SSL} // $args{verify_ssl} // 1, # verification by default
> +         no_proxy     => $ENV{no_proxy},
> +     };
> +
> +@@ -1038,7 +1038,7 @@ sub new {
> +         timeout          => 60,
> +         max_line_size    => 16384,
> +         max_header_lines => 64,
> +-        verify_SSL       => 0,
> ++        verify_SSL       => 1,
> +         SSL_options      => {},
> +         %args
> +     }, $class;
> +@@ -1765,7 +1765,7 @@ C<timeout> — Request timeout in seconds (default is 60) If a socket open, read
> +
> + =item *
> +
> +-C<verify_SSL> — A boolean that indicates whether to validate the SSL certificate of an C<https> — connection (default is false)
> ++C<verify_SSL> — A boolean that indicates whether to validate the SSL certificate of an C<https> — connection (default is true)
> +
> + =item *
> +
> +@@ -2035,7 +2035,7 @@ Verification of server identity
> +
> + =back
> +
> +-B<By default, HTTP::Tiny does not verify server identity>.
> ++B<By default, HTTP::Tiny in Debian verifies server identity.
> +
> + Server identity verification is controversial and potentially tricky because it
> + depends on a (usually paid) third-party Certificate Authority (CA) trust model
> +@@ -2043,16 +2043,14 @@ to validate a certificate as legitimate.  This discriminates against servers
> + with self-signed certificates or certificates signed by free, community-driven
> + CA's such as L<CAcert.org|http://cacert.org>.
> +
> +-By default, HTTP::Tiny does not make any assumptions about your trust model,
> +-threat level or risk tolerance.  It just aims to give you an encrypted channel
> +-when you need one.
> +-
> + Setting the C<verify_SSL> attribute to a true value will make HTTP::Tiny verify
> + that an SSL connection has a valid SSL certificate corresponding to the host
> + name of the connection and that the SSL certificate has been verified by a CA.
> + Assuming you trust the CA, this will protect against a L<man-in-the-middle
> +-attack|http://en.wikipedia.org/wiki/Man-in-the-middle_attack>.  If you are
> +-concerned about security, you should enable this option.
> ++attack|http://en.wikipedia.org/wiki/Man-in-the-middle_attack>.
> ++
> ++If you are not concerned about security, and this default in Debian causes
> ++problems, you should disable this option.
> +
> + Certificate verification requires a file containing trusted CA certificates.
> +
> +--
> +2.40.0
> diff --git a/meta/recipes-devtools/perl/perl_5.34.1.bb b/meta/recipes-devtools/perl/perl_5.34.1.bb
> index 42bcb8b1bc..af4660091b 100644
> --- a/meta/recipes-devtools/perl/perl_5.34.1.bb
> +++ b/meta/recipes-devtools/perl/perl_5.34.1.bb
> @@ -18,6 +18,7 @@ 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-31486.patch \ "
>   SRC_URI:append:class-native = " \
>              file://perl-configpm-switch.patch  \
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#182370):https://lists.openembedded.org/g/openembedded-core/message/182370
> Mute This Topic:https://lists.openembedded.org/mt/99333636/3616765
> Group Owner:openembedded-core+owner@lists.openembedded.org
> Unsubscribe:https://lists.openembedded.org/g/openembedded-core/unsub  [randy.macleod@windriver.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta/recipes-devtools/perl/files/CVE-2023-31486.patch b/meta/recipes-devtools/perl/files/CVE-2023-31486.patch
new file mode 100644
index 0000000000..55c4bd1d47
--- /dev/null
+++ b/meta/recipes-devtools/perl/files/CVE-2023-31486.patch
@@ -0,0 +1,89 @@ 
+From 1490431e40e22052f75a0b3449f1f53cbd27ba92 Mon Sep 17 00:00:00 2001
+From: Dominic Hargreaves <dom@earth.li>
+Date: Thu, 21 May 2020 22:53:37 +0100
+Subject: [PATCH] Enable SSL by default in HTTP::Tiny
+
+Gbp-Pq: Topic debian
+Gbp-Pq: Name http-tiny-ssl.diff
+
+CVE: CVE-2023-31486
+
+Upstream-Status: Backport [https://salsa.debian.org/perl-team/interpreter/perl/-/commit/1490431e40e22052f75a0b3449f1f53cbd27ba92.patch]
+
+Signed-off-by: Soumya <soumya.sambu@windriver.com>
+---
+ cpan/HTTP-Tiny/lib/HTTP/Tiny.pm | 20 +++++++++-----------
+ 1 file changed, 9 insertions(+), 11 deletions(-)
+
+diff --git a/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm b/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm
+index 5803e45..88ba514 100644
+--- a/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm
++++ b/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm
+@@ -40,7 +40,7 @@ sub _croak { require Carp; Carp::croak(@_) }
+ #pod * C<timeout> — Request timeout in seconds (default is 60) If a socket open,
+ #pod   read or write takes longer than the timeout, an exception is thrown.
+ #pod * C<verify_SSL> — A boolean that indicates whether to validate the SSL
+-#pod   certificate of an C<https> — connection (default is false)
++#pod   certificate of an C<https> — connection (default is true)
+ #pod * C<SSL_options> — A hashref of C<SSL_*> — options to pass through to
+ #pod   L<IO::Socket::SSL>
+ #pod
+@@ -112,7 +112,7 @@ sub new {
+         max_redirect => 5,
+         timeout      => defined $args{timeout} ? $args{timeout} : 60,
+         keep_alive   => 1,
+-        verify_SSL   => $args{verify_SSL} || $args{verify_ssl} || 0, # no verification by default
++        verify_SSL   => $args{verify_SSL} // $args{verify_ssl} // 1, # verification by default
+         no_proxy     => $ENV{no_proxy},
+     };
+
+@@ -1038,7 +1038,7 @@ sub new {
+         timeout          => 60,
+         max_line_size    => 16384,
+         max_header_lines => 64,
+-        verify_SSL       => 0,
++        verify_SSL       => 1,
+         SSL_options      => {},
+         %args
+     }, $class;
+@@ -1765,7 +1765,7 @@ C<timeout> — Request timeout in seconds (default is 60) If a socket open, read
+
+ =item *
+
+-C<verify_SSL> — A boolean that indicates whether to validate the SSL certificate of an C<https> — connection (default is false)
++C<verify_SSL> — A boolean that indicates whether to validate the SSL certificate of an C<https> — connection (default is true)
+
+ =item *
+
+@@ -2035,7 +2035,7 @@ Verification of server identity
+
+ =back
+
+-B<By default, HTTP::Tiny does not verify server identity>.
++B<By default, HTTP::Tiny in Debian verifies server identity.
+
+ Server identity verification is controversial and potentially tricky because it
+ depends on a (usually paid) third-party Certificate Authority (CA) trust model
+@@ -2043,16 +2043,14 @@ to validate a certificate as legitimate.  This discriminates against servers
+ with self-signed certificates or certificates signed by free, community-driven
+ CA's such as L<CAcert.org|http://cacert.org>.
+
+-By default, HTTP::Tiny does not make any assumptions about your trust model,
+-threat level or risk tolerance.  It just aims to give you an encrypted channel
+-when you need one.
+-
+ Setting the C<verify_SSL> attribute to a true value will make HTTP::Tiny verify
+ that an SSL connection has a valid SSL certificate corresponding to the host
+ name of the connection and that the SSL certificate has been verified by a CA.
+ Assuming you trust the CA, this will protect against a L<man-in-the-middle
+-attack|http://en.wikipedia.org/wiki/Man-in-the-middle_attack>.  If you are
+-concerned about security, you should enable this option.
++attack|http://en.wikipedia.org/wiki/Man-in-the-middle_attack>.
++
++If you are not concerned about security, and this default in Debian causes
++problems, you should disable this option.
+
+ Certificate verification requires a file containing trusted CA certificates.
+
+--
+2.40.0
diff --git a/meta/recipes-devtools/perl/perl_5.34.1.bb b/meta/recipes-devtools/perl/perl_5.34.1.bb
index 42bcb8b1bc..af4660091b 100644
--- a/meta/recipes-devtools/perl/perl_5.34.1.bb
+++ b/meta/recipes-devtools/perl/perl_5.34.1.bb
@@ -18,6 +18,7 @@  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-31486.patch \
            "
 SRC_URI:append:class-native = " \
            file://perl-configpm-switch.patch \