The vulnerability exists in how the fickling library translates pickle bytecode into an Abstract Syntax Tree (AST) for security analysis. Specifically, the run methods within the Global, StackGlobal, and Inst opcode handler classes in fickling/fickle.py contained a conditional check that explicitly prevented the creation of ImportFrom AST nodes for any modules named __builtin__, __builtins__, or builtins.
The root cause of the vulnerability is this intentional omission. The developers likely assumed that imports from builtins were always safe and did not need to be represented in the AST to reduce noise. However, the builtins module contains dangerous functions like __import__ and eval. By crafting a pickle payload that uses opcodes like GLOBAL (c) to import builtins.__import__, an attacker could execute arbitrary code, and fickling's analysis would be completely blind to it because no corresponding import node was ever generated for inspection.
The patch rectifies this by removing the conditional check entirely. Now, an ImportFrom AST node is generated for every import, regardless of the module. This ensures that the security analysis phase has full visibility into all imports, including those from builtins, and can correctly flag them as unsafe.