Skip to content

Commit ffac347

Browse files
Expand UNSAFE_IMPORTS blocklist (GHSA-5hwf-rc88-82xm) (#240)
Add uuid, _osx_support, and _aix_support to the UNSAFE_IMPORTS blocklist. These stdlib modules internally call subprocess.Popen or os.system. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9cc89b9 commit ffac347

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed

fickling/fickle.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@
151151
"zipfile",
152152
# Shelve (opens database files)
153153
"shelve",
154+
# Stdlib modules with hidden subprocess/os.system calls
155+
"uuid",
156+
"_osx_support",
157+
"_aix_support",
154158
]
155159
)
156160

test/test_bypasses.py

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,73 @@ def test_obj_pop_call_invisibility(self):
616616
Severity.LIKELY_SAFE,
617617
)
618618

619+
# https://github.com/trailofbits/fickling/security/advisories/GHSA-5hwf-rc88-82xm
620+
def test_missing_uuid(self):
621+
"""uuid._get_command_stdout calls subprocess.Popen internally."""
622+
pickled = Pickled(
623+
[
624+
op.Proto.create(4),
625+
op.ShortBinUnicode("uuid"),
626+
op.ShortBinUnicode("_get_command_stdout"),
627+
op.StackGlobal(),
628+
op.ShortBinUnicode("echo"),
629+
op.ShortBinUnicode("PROOF_OF_CONCEPT"),
630+
op.TupleTwo(),
631+
op.Reduce(),
632+
op.Stop(),
633+
]
634+
)
635+
res = check_safety(pickled)
636+
self.assertGreater(res.severity, Severity.LIKELY_SAFE)
637+
self.assertEqual(
638+
res.detailed_results()["AnalysisResult"].get("UnsafeImports"),
639+
"from uuid import _get_command_stdout",
640+
)
641+
642+
# https://github.com/trailofbits/fickling/security/advisories/GHSA-5hwf-rc88-82xm
643+
def test_missing_aix_support(self):
644+
"""_aix_support._read_cmd_output calls os.system internally."""
645+
pickled = Pickled(
646+
[
647+
op.Proto.create(4),
648+
op.ShortBinUnicode("_aix_support"),
649+
op.ShortBinUnicode("_read_cmd_output"),
650+
op.StackGlobal(),
651+
op.ShortBinUnicode("echo PROOF_OF_CONCEPT"),
652+
op.TupleOne(),
653+
op.Reduce(),
654+
op.Stop(),
655+
]
656+
)
657+
res = check_safety(pickled)
658+
self.assertGreater(res.severity, Severity.LIKELY_SAFE)
659+
self.assertEqual(
660+
res.detailed_results()["AnalysisResult"].get("UnsafeImports"),
661+
"from _aix_support import _read_cmd_output",
662+
)
663+
664+
# https://github.com/trailofbits/fickling/security/advisories/GHSA-5hwf-rc88-82xm
665+
def test_missing_osx_support(self):
666+
"""_osx_support._find_build_tool allows command injection via os.system."""
667+
pickled = Pickled(
668+
[
669+
op.Proto.create(4),
670+
op.ShortBinUnicode("_osx_support"),
671+
op.ShortBinUnicode("_find_build_tool"),
672+
op.StackGlobal(),
673+
op.ShortBinUnicode("x; echo INJECTED #"),
674+
op.TupleOne(),
675+
op.Reduce(),
676+
op.Stop(),
677+
]
678+
)
679+
res = check_safety(pickled)
680+
self.assertGreater(res.severity, Severity.LIKELY_SAFE)
681+
self.assertEqual(
682+
res.detailed_results()["AnalysisResult"].get("UnsafeImports"),
683+
"from _osx_support import _find_build_tool",
684+
)
685+
619686

620687
class TestUnsafeModuleCoverage(TestCase):
621688
"""Verify every entry in UNSAFE_MODULES and UNSAFE_IMPORTS triggers detection."""

0 commit comments

Comments
 (0)