/

CVE-2026-129784

Severity:

HIGH RISK

(8.5)

Unsafe JSON Deserialization (CWE-502) in HTTPX Ruby

CVE-2026-129784

Received

Vulnerability type

Category:

Unsafe Deserialization

CWE:

CWE-502

Impact:

Arbitrary Object Instantiation, Potential Remote Code Execution

Severity:

HIGH RISK

(8.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

HTTPX can deserialize JSON responses unsafely when its decoder uses Oj in the default object mode. If an attacker can influence a URL the application fetches and parses with HTTPX::Response#json, they may cause Ruby objects to be instantiated; with a suitable gadget chain, this could lead to remote code execution.

Affected context

The issue affects applications using the HTTPX Ruby gem's JSON response parsing when Oj is loaded and multi_json is absent, causing the decoder to fall back to Oj.load without a restricted mode. Risk arises when an attacker can influence the fetched response and the application calls .json on it. The vulnerability is reported in HTTPX 1.9.0.

Exploit preconditions

  • Attack surface: An application fetches and parses an HTTP response using HTTPX.
  • Required access: The attacker must be able to control or influence the URL or the response returned from it.
  • Trigger point: The application parses the response by calling HTTPX::Response#json.
  • Why exploitation is possible: With Oj loaded and multi_json absent, the decoder uses Oj.load in its default object mode, which can instantiate loaded Ruby classes and resolve class or module references. Remote code execution may require a suitable gadget chain.

Why this happens

The decoder passes response content to a general-purpose deserializer without selecting a restricted parsing mode. Oj's default object mode can interpret serialized data as instructions to instantiate Ruby objects and populate their instance variables. This is CWE-502: Deserialization of Untrusted Data: attacker-influenced input is processed in a way that permits unsafe object construction.

Potential impact

  • Attacker-influenced responses could cause unexpected Ruby objects to be instantiated in the application process.
  • A suitable gadget chain could allow arbitrary code execution.
  • The application's data or runtime could be compromised, depending on its privileges and accessible resources.

General mitigation guidance

Mitigation centers on treating remote response bodies as untrusted data and preventing general-purpose object construction during parsing.

Common defensive patterns include:

  • Use JSON parsing modes or libraries that produce only basic data types, such as hashes, arrays, strings, numbers, booleans, and null values.
  • Avoid deserializing network responses into arbitrary application objects.
  • Validate parsed data against an explicit schema before using it.
  • Reduce the influence untrusted parties have over fetched URLs and response sources.
  • Run applications with least privilege to limit the consequences of a parser compromise.

How teams detect issues like this

High-level detection approaches include:

  • Static analysis for deserialization calls that use untrusted response bodies without a restricted mode.
  • Code review of HTTP client flows that pass response content directly to object-capable parsers.
  • Dependency and configuration checks for combinations where Oj is loaded and alternative JSON decoder paths are unavailable.
  • Policy checks requiring network data to be parsed into basic data types and validated before use.

Automated code review tools may help identify risky parser usage and data flows.

Sources

SourceLink
github.comgithub.com/HoneyryderChuck/httpx
github.comgithub.com/HoneyryderChuck/httpx/commit/eeb785d3250eee9379494fb62c37c315a31e327c
github.comgithub.com/HoneyryderChuck/httpx/releases/tag/v1.9.1
github.comgithub.com/ohler55/oj/blob/develop/pages/Security.md
gitlab.comgitlab.com/os85/httpx
gitlab.comgitlab.com/os85/httpx/-/commit/eeb785d3250eee9379494fb62c37c315a31e327c
rubygems.orgrubygems.org/gems/httpx

Frequently asked

questions

It may be exploitable when an attacker can influence a response that an application fetches and parses. Remote code execution depends on a suitable gadget chain being available.

The attacker must be able to influence the URL or the response content processed by the application. The vulnerable parsing path also depends on Oj being loaded and multi_json being absent.

Parse JSON into basic data types using a restricted parser mode, then validate the resulting structure against an explicit schema.

Treat network responses as untrusted, avoid general-purpose object deserialization for JSON, constrain URL and response sources, and run the application with least privilege.

Find out what's already
exploitable in your codebase.