Aller au contenu

Insecure Deserialization (ARCH6109)

Ce contenu n’est pas encore disponible dans votre langue.

Key ruby.security.insecure-deserialization · Severity critical · Category security · CWE CWE-502

Deserializing untrusted data with Marshal.load or unsafe YAML loading lets attackers instantiate arbitrary objects via gadget chains and achieve remote code execution. Use data-only formats.

def restore(blob)
Marshal.load(blob)
end
restore(request.body.read)
require "json"
def restore(blob)
JSON.parse(blob, symbolize_names: true)
end
restore(request.body.read)

Avoid Marshal.load/unsafe YAML; prefer JSON or YAML.safe_load for untrusted data.