VYPR
Critical severityNVD Advisory· Published Sep 28, 2023· Updated Sep 23, 2024

CVE-2023-26145

CVE-2023-26145

Description

This affects versions of the package pydash before 6.0.0. A number of pydash methods such as pydash.objects.invoke() and pydash.collections.invoke_map() accept dotted paths (Deep Path Strings) to target a nested Python object, relative to the original source object. These paths can be used to target internal class attributes and dict items, to retrieve, modify or invoke nested Python objects. Note: The pydash.objects.invoke() method is vulnerable to Command Injection when the following prerequisites are satisfied: 1) The source object (argument 1) is not a built-in object such as list/dict (otherwise, the __init__.__globals__ path is not accessible) 2) The attacker has control over argument 2 (the path string) and argument 3 (the argument to pass to the invoked method) The pydash.collections.invoke_map() method is also vulnerable, but is harder to exploit as the attacker does not have direct control over the argument to be passed to the invoked function.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

pydash versions before 6.0.0 allow command injection via dotted paths in invoke() and invoke_map() methods when attacker controls path and argument.

Overview

The pydash library (versions before 6.0.0) suffers from a command injection vulnerability in methods like pydash.objects.invoke() and pydash.collections.invoke_map(). These methods accept dotted path strings (Deep Path Strings) to navigate nested object attributes. By crafting a malicious path such as __init__.__globals__, an attacker can access the global namespace of a class and invoke arbitrary functions, including os.system [1], [2].

Exploitation

Exploitation of invoke() requires three conditions: (1) the first argument (source object) is not a built-in list/dict (which lack the __globals__ path), (2) the attacker controls the second argument (the path string), and (3) the attacker controls the third argument (the argument to the invoked method) [1], [3]. For invoke_map(), exploitation is more difficult as the attacker does not directly control the function argument, but it remains a vector if the collection can be manipulated [2].

Impact

Successful exploitation leads to arbitrary command execution on the host running the vulnerable pydash instance. An attacker can execute system commands, potentially leading to full compromise of the application and underlying system [1], [3].

Mitigation

The vulnerability has been fixed in pydash version 6.0.0 [4]. Users are advised to upgrade immediately. No workarounds are available for older versions [2].

AI Insight generated on May 20, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
pydashPyPI
< 6.0.06.0.0

Affected products

3

Patches

1
6ff0831ad285

fix: don't allow object paths that reference dunder-method attributes for functions like get()

https://github.com/dgilland/pydashDerrick GillandJan 29, 2023via ghsa
2 files changed · +33 0
  • src/pydash/helpers.py+9 0 modified
    @@ -178,6 +178,7 @@ def _base_get_item(obj, key, default=UNSET):
     def _base_get_object(obj, key, default=UNSET):
         value = _base_get_item(obj, key, default=UNSET)
         if value is UNSET:
    +        _raise_if_restricted_key(key)
             value = default
             try:
                 value = getattr(obj, key)
    @@ -186,6 +187,13 @@ def _base_get_object(obj, key, default=UNSET):
         return value
     
     
    +def _raise_if_restricted_key(key):
    +    # Prevent access to dunder-methods since this could expose access to globals through leaky
    +    # attributes such as obj.__init__.__globals__.
    +    if len(key) > 4 and key.isascii() and key.startswith("__") and key.endswith("__"):
    +        raise KeyError(f"access to restricted key {key!r} is not allowed")
    +
    +
     def base_set(obj, key, value, allow_override=True):
         """
         Set an object's `key` to `value`. If `obj` is a ``list`` and the `key` is the next available
    @@ -213,6 +221,7 @@ def base_set(obj, key, value, allow_override=True):
                     obj[:] = (obj + [None] * key)[:key]
                 obj.append(value)
         elif (allow_override or not hasattr(obj, key)) and obj is not None:
    +        _raise_if_restricted_key(key)
             setattr(obj, key, value)
     
         return obj
    
  • tests/test_objects.py+24 0 modified
    @@ -380,6 +380,30 @@ def test_get__should_not_populate_defaultdict():
         assert data == {}
     
     
    +@parametrize(
    +    "obj,path",
    +    [
    +        (helpers.Object(), "__init__"),
    +        (helpers.Object(subobj=helpers.Object()), "subobj.__init__"),
    +        (namedtuple("a", ["a"])(a=1), "__len__"),
    +    ],
    +)
    +def test_get__raises_for_objects_when_path_restricted(obj, path):
    +    with pytest.raises(KeyError, match="access to restricted key"):
    +        _.get(obj, path)
    +
    +
    +@parametrize(
    +    "obj,path",
    +    [
    +        ({}, "__init__"),
    +        ([], "__contains__"),
    +    ],
    +)
    +def test_get__does_not_raise_for_dict_or_list_when_path_restricted(obj, path):
    +    assert _.get(obj, path) is None
    +
    +
     @parametrize(
         "case,expected",
         [
    

Vulnerability mechanics

Generated on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

6

News mentions

0

No linked articles in our index yet.