Описание
Nokogiri::XML::Schema trusts input by default, exposing risk of XXE vulnerability
Severity
Nokogiri maintainers have evaluated this as Low Severity (CVSS3 2.6).
Description
In Nokogiri versions <= 1.11.0.rc3, XML Schemas parsed by Nokogiri::XML::Schema are trusted by default, allowing external resources to be accessed over the network, potentially enabling XXE or SSRF attacks.
This behavior is counter to the security policy followed by Nokogiri maintainers, which is to treat all input as untrusted by default whenever possible.
Please note that this security fix was pushed into a new minor version, 1.11.x, rather than a patch release to the 1.10.x branch, because it is a breaking change for some schemas and the risk was assessed to be "Low Severity".
Affected Versions
Nokogiri <= 1.10.10 as well as prereleases 1.11.0.rc1, 1.11.0.rc2, and 1.11.0.rc3
Mitigation
There are no known workarounds for affected versions. Upgrade to Nokogiri 1.11.0.rc4 or later.
If, after upgrading to 1.11.0.rc4 or later, you wish to re-enable network access for resolution of external resources (i.e., return to the previous behavior):
- Ensure the input is trusted. Do not enable this option for untrusted input.
- When invoking the
Nokogiri::XML::Schemaconstructor, pass as the second parameter an instance ofNokogiri::XML::ParseOptionswith theNONETflag turned off.
So if your previous code was:
Then you can add the second parameter to indicate that the input is trusted by changing it to:
References
- This issue's public advisory
- Original Hackerone report (private)
- OWASP description of XXE attack
- OWASP description of SSRF attack
Credit
This vulnerability was independently reported by @eric-therond and @gucki.
The Nokogiri maintainers would like to thank HackerOne for providing a secure, responsible mechanism for reporting, and for providing their fantastic service to us.
Ссылки
- https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-vr8q-g5c7-m54m
- https://nvd.nist.gov/vuln/detail/CVE-2020-26247
- https://github.com/sparklemotion/nokogiri/commit/9c87439d9afa14a365ff13e73adc809cb2c3d97b
- https://hackerone.com/reports/747489
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/nokogiri/CVE-2020-26247.yml
- https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md#v1110--2021-01-03
- https://github.com/sparklemotion/nokogiri/releases/tag/v1.11.0.rc4
- https://lists.debian.org/debian-lts-announce/2021/06/msg00007.html
- https://lists.debian.org/debian-lts-announce/2022/10/msg00018.html
- https://rubygems.org/gems/nokogiri
- https://security.gentoo.org/glsa/202208-29
Пакеты
nokogiri
<= 1.10.10
1.11.0
Связанные уязвимости
Nokogiri is a Rubygem providing HTML, XML, SAX, and Reader parsers with XPath and CSS selector support. In Nokogiri before version 1.11.0.rc4 there is an XXE vulnerability. XML Schemas parsed by Nokogiri::XML::Schema are trusted by default, allowing external resources to be accessed over the network, potentially enabling XXE or SSRF attacks. This behavior is counter to the security policy followed by Nokogiri maintainers, which is to treat all input as untrusted by default whenever possible. This is fixed in Nokogiri version 1.11.0.rc4.
Nokogiri is a Rubygem providing HTML, XML, SAX, and Reader parsers with XPath and CSS selector support. In Nokogiri before version 1.11.0.rc4 there is an XXE vulnerability. XML Schemas parsed by Nokogiri::XML::Schema are trusted by default, allowing external resources to be accessed over the network, potentially enabling XXE or SSRF attacks. This behavior is counter to the security policy followed by Nokogiri maintainers, which is to treat all input as untrusted by default whenever possible. This is fixed in Nokogiri version 1.11.0.rc4.
Nokogiri is a Rubygem providing HTML, XML, SAX, and Reader parsers with XPath and CSS selector support. In Nokogiri before version 1.11.0.rc4 there is an XXE vulnerability. XML Schemas parsed by Nokogiri::XML::Schema are trusted by default, allowing external resources to be accessed over the network, potentially enabling XXE or SSRF attacks. This behavior is counter to the security policy followed by Nokogiri maintainers, which is to treat all input as untrusted by default whenever possible. This is fixed in Nokogiri version 1.11.0.rc4.
Nokogiri is a Rubygem providing HTML, XML, SAX, and Reader parsers wit ...
Уязвимость программной библиотеки Nokogiri, связанная с неверным ограничением XML-ссылок на внешние объекты, позволяющая нарушителю провести SSRF-атаку или XXE-атаку