The vulnerability, CVE-2022-41529, is a deserialization flaw in Apache Arrow's pyarrow.serialization.ReduceSerializer. The root cause was that the security policy (DeserializationPolicy) was not being enforced for all deserialization paths. Specifically, the custom Unpickler used by ReduceSerializer only overrode the find_class method but not the find_global method. This created a loophole where an attacker could craft a malicious pickle object that uses the GLOBAL opcode to load and execute arbitrary code, bypassing the intended security restrictions of the policy. The vulnerability also allowed bypassing the policy during the restoration of an object's state via the __reduce__ method.
The patch addresses this by:
- Explicitly passing the
DeserializationPolicy to the Unpickler instance within ReduceSerializer.loads.
- Overriding the
find_global method within the Unpickler to ensure that it checks any requested global against the DeserializationPolicy before loading it.
- Ensuring that the policy is also checked when restoring an object's state via
__reduce__.
The identified vulnerable functions are central to this process. ReduceSerializer.loads is the main entry point for the vulnerable operation. The original ReduceSerializer.find_global was insufficient, and the lack of a ReduceSerializer.Unpickler.find_global implementation was the primary flaw. Any runtime profile during exploitation would show calls flowing through ReduceSerializer.loads and involving the pickle.Unpickler.