Unsafe NumPy pickle deserialization in cluster_faces.py (allow_pickle=True) #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
cluster_faces.pyloadsfaces_raw.npzusingnumpy.load(..., allow_pickle=True)in two places: insidedetect_pass()andcluster_pass(). NumPy's pickle path allows arbitrary Python objects to be embedded in.npzfiles; deserializing a crafted file executes whatever code the pickle payload contains.Location
cluster_faces.py—detect_pass()function (incremental-resume block):And
cluster_pass():Risk
allow_pickle=Trueis required here because the arrays are stored withdtype=object(jagged lists of varying-length vectors). If an attacker can place or replacefaces_raw.npzin the export directory — e.g., by supplying a specially crafted BeReal export archive — runningpython3 cluster_faces.pywould execute arbitrary code on the operator's machine with the user's privileges.Suggested fix direction
Avoid
dtype=objectarrays and pickle altogether. Store embeddings as a flatfloat32array with a separate integer offset/length array, and metadata as a JSON sidecar file. That letsnp.loadbe called withoutallow_pickle.Severity
moderate
Found by
Automated audit by Claude Code