CVE-2022-31115

8.8 HIGH

📋 TL;DR

This vulnerability in opensearch-ruby allows remote code execution through unsafe YAML deserialization when connecting to a malicious OpenSearch server. Attackers controlling an OpenSearch server can execute arbitrary code on client systems that connect to it. Only users of opensearch-ruby gem versions before 2.0.1 are affected.

💻 Affected Systems

Products:
  • opensearch-ruby gem
Versions: All versions prior to 2.0.1
Operating Systems: All operating systems running Ruby
Default Config Vulnerable: ⚠️ Yes
Notes: Vulnerability requires client to connect to malicious OpenSearch server; not exploitable against standard OpenSearch deployments.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full remote code execution on client systems, allowing attackers to install malware, steal data, or pivot to other systems.

🟠

Likely Case

Arbitrary code execution on client machines when users connect to attacker-controlled OpenSearch servers.

🟢

If Mitigated

No impact if clients only connect to trusted OpenSearch servers or have upgraded to patched version.

🌐 Internet-Facing: MEDIUM
🏢 Internal Only: LOW

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires attacker to control OpenSearch server that victim connects to; YAML deserialization RCE techniques are well-documented for Ruby.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 2.0.1

Vendor Advisory: https://github.com/opensearch-project/opensearch-ruby/security/advisories/GHSA-977c-63xq-cgw3

Restart Required: No

Instructions:

1. Update Gemfile to specify 'gem "opensearch-ruby", ">= 2.0.1"' 2. Run 'bundle update opensearch-ruby' 3. Verify update with 'bundle list | grep opensearch-ruby'

🔧 Temporary Workarounds

Restrict OpenSearch server connections

all

Only allow connections to trusted, internal OpenSearch servers to prevent connecting to malicious servers.

🧯 If You Can't Patch

  • Implement network controls to restrict outbound connections to OpenSearch servers
  • Monitor for connections to unknown or external OpenSearch servers

🔍 How to Verify

Check if Vulnerable:

Check Gemfile.lock or run 'bundle list | grep opensearch-ruby' and verify version is below 2.0.1

Check Version:

bundle list | grep opensearch-ruby

Verify Fix Applied:

Confirm opensearch-ruby version is 2.0.1 or higher using 'bundle list | grep opensearch-ruby'

📡 Detection & Monitoring

Log Indicators:

  • Unexpected YAML parsing errors
  • Connections to unknown OpenSearch servers

Network Indicators:

  • Outbound connections to non-standard OpenSearch servers
  • YAML content in HTTP responses from OpenSearch

SIEM Query:

source="application.log" AND "YAML.load" AND "opensearch"

🔗 References

📤 Share & Export