[ANN] Nokogiri security update v1.13.2

Nokogiri v1.13.2 was released today, upgrading the packaged libraries
(libxml2 to v2.9.13 and libxslt to v1.1.35).

Those upgraded versions address CVE-2022-23308 and CVE-2021-30560 which are
described in

.

That security advisory is reproduced here for your convenience.

Summary

Nokogiri v1.13.2
<Release 1.13.2 / 2022-02-21 · sparklemotion/nokogiri · GitHub> upgrades
two of its packaged dependencies:

   - vendored libxml2 from v2.9.12 to v2.9.13
   <https://download.gnome.org/sources/libxml2/2.9/libxml2-2.9.13.news>
   - vendored libxslt from v1.1.34 to v1.1.35
   <https://download.gnome.org/sources/libxslt/1.1/libxslt-1.1.35.news>

Those library versions address the following upstream CVEs:

   - libxslt: CVE-2021-30560
   <NVD - CVE-2021-30560> (CVSS 8.8, High
   severity)
   - libxml2: CVE-2022-23308
   <NVD - CVE-2022-23308> (Unspecified severity,
   see more information below)

Those library versions also address numerous other issues including
performance improvements, regression fixes, and bug fixes, as well as
memory leaks and other use-after-free issues that were not assigned CVEs.

Please note that this advisory only applies to the CRuby implementation of
Nokogiri < 1.13.2, and only if the *packaged* libraries are being used. If
you've overridden defaults at installation time to use *system* libraries
instead of packaged libraries, you should instead pay attention to your
distro's libxml2 and libxslt release announcements.
Mitigation

Upgrade to Nokogiri >= 1.13.2.

Users who are unable to upgrade Nokogiri may also choose a more complicated
mitigation: compile and link an older version Nokogiri against external
libraries libxml2 >= 2.9.13 and libxslt >= 1.1.35, which will also address
these same CVEs.
Impactlibxslt CVE-2021-30560
<NVD - CVE-2021-30560>

   - CVSS3 score: 8.8 (High)
   - Fixed by https://gitlab.gnome.org/GNOME/libxslt/-/commit/50f9c9c

All versions of libxslt prior to v1.1.35 are affected.

Applications using untrusted XSL stylesheets to transform XML are
vulnerable to a denial-of-service attack and should be upgraded immediately.
libxml2 CVE-2022-23308 <NVD - CVE-2022-23308>

   - As of the time this security advisory was published, there is no
   officially published information available about this CVE's severity. The
   above NIST link does not yet have a published record, and the libxml2
   maintainer has declined to provide a severity score.
   - Fixed by https://gitlab.gnome.org/GNOME/libxml2/-/commit/652dd12
   - Further explanation is at
   Re: [xml] Release of libxml2 2.9.13

The upstream commit and the explanation linked above indicate that an
application may be vulnerable to a denial of service, memory disclosure, or
code execution if it parses an untrusted document with parse options
DTDVALID set to true, and NOENT set to false.

An analysis of these parse options:

   - While NOENT is off by default for Document, DocumentFragment, Reader,
   and Schema parsing, it is on by default for XSLT (stylesheet) parsing in
   Nokogiri v1.12.0 and later.
   - DTDVALID is an option that Nokogiri does not set for any operations,
   and so this CVE applies only to applications setting this option explicitly.

It seems reasonable to assume that any application explicitly setting the
parse option DTDVALID when parsing untrusted documents is vulnerable and
should be upgraded immediately.

Quick update: this version of libxml2 introduces what appear to be
regressions around entity handling, and so if you're not parsing untrusted
content, you may want to hold off on upgrading for a day or two while I
investigate.

Feel free to follow along at
[bug] libxml 2.9.13 breaks HTML4 parser recovery from ill-formed `<` character · Issue #2461 · sparklemotion/nokogiri · GitHub if you're impacted.

···

On Mon, Feb 21, 2022 at 2:02 PM Mike Dalessio <mike.dalessio@gmail.com> wrote:

Nokogiri v1.13.2 was released today, upgrading the packaged libraries
(libxml2 to v2.9.13 and libxslt to v1.1.35).

Those upgraded versions address CVE-2022-23308 and CVE-2021-30560 which
are described in
Update packaged libxml2 (2.9.12 → 2.9.13) and libxslt (1.1.34 → 1.1.35) · Advisory · sparklemotion/nokogiri · GitHub
.

That security advisory is reproduced here for your convenience.

Summary

Nokogiri v1.13.2
<https://github.com/sparklemotion/nokogiri/releases/tag/v1.13.2&gt; upgrades
two of its packaged dependencies:

   - vendored libxml2 from v2.9.12 to v2.9.13
   <https://download.gnome.org/sources/libxml2/2.9/libxml2-2.9.13.news&gt;
   - vendored libxslt from v1.1.34 to v1.1.35
   <https://download.gnome.org/sources/libxslt/1.1/libxslt-1.1.35.news&gt;

Those library versions address the following upstream CVEs:

   - libxslt: CVE-2021-30560
   <https://nvd.nist.gov/vuln/detail/CVE-2021-30560&gt; (CVSS 8.8, High
   severity)
   - libxml2: CVE-2022-23308
   <https://nvd.nist.gov/vuln/detail/CVE-2022-23308&gt; (Unspecified
   severity, see more information below)

Those library versions also address numerous other issues including
performance improvements, regression fixes, and bug fixes, as well as
memory leaks and other use-after-free issues that were not assigned CVEs.

Please note that this advisory only applies to the CRuby implementation of
Nokogiri < 1.13.2, and only if the *packaged* libraries are being used.
If you've overridden defaults at installation time to use *system* libraries
instead of packaged libraries, you should instead pay attention to your
distro's libxml2 and libxslt release announcements.
Mitigation

Upgrade to Nokogiri >= 1.13.2.

Users who are unable to upgrade Nokogiri may also choose a more
complicated mitigation: compile and link an older version Nokogiri against
external libraries libxml2 >= 2.9.13 and libxslt >= 1.1.35, which will
also address these same CVEs.
Impactlibxslt CVE-2021-30560
<https://nvd.nist.gov/vuln/detail/CVE-2021-30560&gt;

   - CVSS3 score: 8.8 (High)
   - Fixed by Fix use-after-free in xsltApplyTemplates (50f9c9cd) · Commits · GNOME / libxslt · GitLab

All versions of libxslt prior to v1.1.35 are affected.

Applications using untrusted XSL stylesheets to transform XML are
vulnerable to a denial-of-service attack and should be upgraded immediately.
libxml2 CVE-2022-23308 <https://nvd.nist.gov/vuln/detail/CVE-2022-23308&gt;

   - As of the time this security advisory was published, there is no
   officially published information available about this CVE's severity. The
   above NIST link does not yet have a published record, and the libxml2
   maintainer has declined to provide a severity score.
   - Fixed by [CVE-2022-23308] Use-after-free of ID and IDREF attributes (652dd12a) · Commits · GNOME / libxml2 · GitLab
   - Further explanation is at
   Re: [xml] Release of libxml2 2.9.13

The upstream commit and the explanation linked above indicate that an
application may be vulnerable to a denial of service, memory disclosure, or
code execution if it parses an untrusted document with parse options
DTDVALID set to true, and NOENT set to false.

An analysis of these parse options:

   - While NOENT is off by default for Document, DocumentFragment,
   Reader, and Schema parsing, it is on by default for XSLT (stylesheet)
   parsing in Nokogiri v1.12.0 and later.
   - DTDVALID is an option that Nokogiri does not set for any operations,
   and so this CVE applies only to applications setting this option explicitly.

It seems reasonable to assume that any application explicitly setting the
parse option DTDVALID when parsing untrusted documents is vulnerable and
should be upgraded immediately.

Final update: Nokogiri v1.13.3 has been released which patches libxml2 to
address the HTML4 parsing issue introduced in libxml 2.9.13.

Please update to Nokogiri v1.13.3. Thanks for your patience.

···

On Mon, Feb 21, 2022 at 3:27 PM Mike Dalessio <mike.dalessio@gmail.com> wrote:

Quick update: this version of libxml2 introduces what appear to be
regressions around entity handling, and so if you're not parsing untrusted
content, you may want to hold off on upgrading for a day or two while I
investigate.

Feel free to follow along at
[bug] libxml 2.9.13 breaks HTML4 parser recovery from ill-formed `<` character · Issue #2461 · sparklemotion/nokogiri · GitHub if you're impacted.

On Mon, Feb 21, 2022 at 2:02 PM Mike Dalessio <mike.dalessio@gmail.com> > wrote:

Nokogiri v1.13.2 was released today, upgrading the packaged libraries
(libxml2 to v2.9.13 and libxslt to v1.1.35).

Those upgraded versions address CVE-2022-23308 and CVE-2021-30560 which
are described in
Update packaged libxml2 (2.9.12 → 2.9.13) and libxslt (1.1.34 → 1.1.35) · Advisory · sparklemotion/nokogiri · GitHub
.

That security advisory is reproduced here for your convenience.

Summary

Nokogiri v1.13.2
<https://github.com/sparklemotion/nokogiri/releases/tag/v1.13.2&gt; upgrades
two of its packaged dependencies:

   - vendored libxml2 from v2.9.12 to v2.9.13
   <https://download.gnome.org/sources/libxml2/2.9/libxml2-2.9.13.news&gt;
   - vendored libxslt from v1.1.34 to v1.1.35
   <https://download.gnome.org/sources/libxslt/1.1/libxslt-1.1.35.news&gt;

Those library versions address the following upstream CVEs:

   - libxslt: CVE-2021-30560
   <https://nvd.nist.gov/vuln/detail/CVE-2021-30560&gt; (CVSS 8.8, High
   severity)
   - libxml2: CVE-2022-23308
   <https://nvd.nist.gov/vuln/detail/CVE-2022-23308&gt; (Unspecified
   severity, see more information below)

Those library versions also address numerous other issues including
performance improvements, regression fixes, and bug fixes, as well as
memory leaks and other use-after-free issues that were not assigned CVEs.

Please note that this advisory only applies to the CRuby implementation
of Nokogiri < 1.13.2, and only if the *packaged* libraries are being
used. If you've overridden defaults at installation time to use *system* libraries
instead of packaged libraries, you should instead pay attention to your
distro's libxml2 and libxslt release announcements.
Mitigation

Upgrade to Nokogiri >= 1.13.2.

Users who are unable to upgrade Nokogiri may also choose a more
complicated mitigation: compile and link an older version Nokogiri against
external libraries libxml2 >= 2.9.13 and libxslt >= 1.1.35, which will
also address these same CVEs.
Impactlibxslt CVE-2021-30560
<https://nvd.nist.gov/vuln/detail/CVE-2021-30560&gt;

   - CVSS3 score: 8.8 (High)
   - Fixed by Fix use-after-free in xsltApplyTemplates (50f9c9cd) · Commits · GNOME / libxslt · GitLab

All versions of libxslt prior to v1.1.35 are affected.

Applications using untrusted XSL stylesheets to transform XML are
vulnerable to a denial-of-service attack and should be upgraded immediately.
libxml2 CVE-2022-23308 <https://nvd.nist.gov/vuln/detail/CVE-2022-23308&gt;

   - As of the time this security advisory was published, there is no
   officially published information available about this CVE's severity. The
   above NIST link does not yet have a published record, and the libxml2
   maintainer has declined to provide a severity score.
   - Fixed by [CVE-2022-23308] Use-after-free of ID and IDREF attributes (652dd12a) · Commits · GNOME / libxml2 · GitLab
   - Further explanation is at
   Re: [xml] Release of libxml2 2.9.13

The upstream commit and the explanation linked above indicate that an
application may be vulnerable to a denial of service, memory disclosure, or
code execution if it parses an untrusted document with parse options
DTDVALID set to true, and NOENT set to false.

An analysis of these parse options:

   - While NOENT is off by default for Document, DocumentFragment,
   Reader, and Schema parsing, it is on by default for XSLT (stylesheet)
   parsing in Nokogiri v1.12.0 and later.
   - DTDVALID is an option that Nokogiri does not set for any
   operations, and so this CVE applies only to applications setting this
   option explicitly.

It seems reasonable to assume that any application explicitly setting the
parse option DTDVALID when parsing untrusted documents is vulnerable and
should be upgraded immediately.