pickle/yaml.unsafe_load/vm.runInContext with attacker-controlled data leads to RCE.
Python’s `pickle`, `yaml.unsafe_load`, and Node.js `vm.runInNewContext` with serialized data can invoke arbitrary code during deserialization. Even JSON-based formats like `jsonpickle` can reconstruct Python objects with side effects. An attacker who can plant malicious serialized data (cached sessions, message queues, inter-service communication) achieves RCE.
# VULNERABLE — pickle deserializes untrusted data import pickle, os data = request.form['payload'] # attacker-controlled obj = pickle.loads(data) # RCE: __reduce__ can call os.system()
# FIXED — never deserialize untrusted data with pickle import json data = request.form['payload'] # Use JSON with strict schema validation obj = json.loads(data) # For YAML: use yaml.safe_load (not yaml.unsafe_load) # For jsonpickle: use a safe_unpickler that disallows import of dangerous classes
pool.query(`SELECT * FROM users WHERE id = ${req.params.id}`)