CVE-2022-31115
JSON

8.8high

Unsafe YAML deserialization in opensearch-ruby

Severity
8.8high CVSS:3.1 by GitHub_M
Exploit likelihood
1.64% (higher than 77% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-977c-63xq-cgw3

Description

opensearch-ruby is a community-driven, open source fork of elasticsearch-ruby. In versions prior to 2.0.1 the ruby `YAML.load` function was used instead of `YAML.safe_load`. As a result opensearch-ruby 2.0.0 and prior can lead to unsafe deserialization using YAML.load if the response is of type YAML. An attacker must be in control of an opensearch server and convince the victim to connect to it in order to exploit this vulnerability. The problem has been patched in opensearch-ruby gem version 2.0.1. Users are advised to upgrade. There are no known workarounds for this issue.

Affected

Product or packageVersionsReported by
opensearch-project opensearch-ruby< 2.0.1CVE List
opensearch-ruby (RubyGems)from 2.0.0 before 2.0.2GitHub Advisory Database
amazon opensearchbefore 2.0.2NVD

All scores

GitHub_M8.8high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
GitHub8.8high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
NVD8.8high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
NVD6.8medium CVSS:2.0AV:N/AC:M/Au:N/C:P/I:P/A:P

Classification

CWE-502

SSVC (CISA-ADP): exploitation poc, automatable no, technical impact total.

What each source says

CVE List

opensearch-ruby is a community-driven, open source fork of elasticsearch-ruby. In versions prior to 2.0.1 the ruby `YAML.load` function was used instead of `YAML.safe_load`. As a result opensearch-ruby 2.0.0 and prior can lead to unsafe deserialization using YAML.load if the response is of type YAML. An attacker must be in control of an opensearch server and convince the victim to connect to it in order to exploit this vulnerability. The problem has been patched in opensearch-ruby gem version 2.0.1. Users are advised to upgrade. There are no known workarounds for this issue.

GitHub Advisory Database
Impact

A YAML deserialization in opensearch-ruby 2.0.0 can lead to unsafe deserialization using YAML.load if the response is of type YAML.

Patches

The problem has been patched in opensearch-ruby gem version 2.0.2.

Workarounds

No viable workaround. Please upgrade to 2.0.2

References

https://github.com/opensearch-project/opensearch-ruby/pull/77 https://staaldraad.github.io/post/2021-01-09-universal-rce-ruby-yaml-load-updated/

For more information

If you have any questions or comments about this advisory:

NVD (es)

opensearch-ruby es una bifurcación de código abierto impulsada por la comunidad de elasticsearch-ruby. En versiones anteriores a 2.0.1 era usada la función ruby "YAML.load" en lugar de "YAML.safe_load". Como resultado, opensearch-ruby versiones 2.0.0 y anteriores, pueden conllevar a una deserialización no segura usando YAML.load si la respuesta es de tipo YAML. Un atacante debe tener el control de un servidor opensearch y convencer a la víctima de que sea conectado a él para poder explotar esta vulnerabilidad. El problema ha sido parcheado en versión 2.0.1 de la gema opensearch-ruby. Es recomendado a usuarios actualizar. No se presentan mitigaciones conocidas para este problema

References

https://github.com/opensearch-project/opensearch-ruby/security/advisories/GHSA-977c-63xq-cgw3third-party-advisory, web
https://github.com/opensearch-project/opensearch-ruby/pull/77patch, third-party-advisory, web
https://staaldraad.github.io/post/2021-01-09-universal-rce-ruby-yaml-load-updated/exploit, third-party-advisory
https://nvd.nist.gov/vuln/detail/CVE-2022-31115advisory
https://github.com/opensearch-project/opensearch-ruby/commit/d74a98b45c037671e8819fa87f6a6423458ab08aweb
https://github.com/opensearch-project/opensearch-rubypackage
https://github.com/opensearch-project/opensearch-ruby/compare/v2.0.1...v2.0.2web
https://github.com/rubysec/ruby-advisory-db/blob/master/gems/opensearch-ruby/CVE-2022-31115.ymlweb
https://staaldraad.github.io/post/2021-01-09-universal-rce-ruby-yaml-load-updatedweb

Sources

SourceRecordLicence
CVE ListCVE-2022-31115 changed 2025-04-22CVE Terms of Use
GitHub Advisory DatabaseGHSA-977c-63xq-cgw3 changed 2024-02-22CC-BY-4.0
NVDCVE-2022-31115 changed 2026-06-17Public domain