Repository navigation
Conversation
The Remote code row named the Python a loader imports when trust_remote_code is given. Two published transformers vulnerabilities run code from a field of config.json with trust_remote_code=False, and the row did not read either. - An attention field (_attn_implementation_internal, or _attn_implementation, whose setter writes it) naming a Hub kernel repository: transformers 4.56.0 to 5.2.x download and run that kernel in a plain from_pretrained once the kernels package is installed (CVE-2026-4372). save_pretrained never writes either field, so a kernel outside kernels-community is a FAIL, the row's first. A kernels-community kernel, which 5.3.0 and later still load from _attn_implementation, is a LEAD. - A truthy trust_remote_code: LightGlue's config passed it to the nested AutoConfig.from_pretrained for its keypoint detector before 5.5.0 (CVE-2026-5241). The published LightGlue DISK checkpoint sets it on purpose and other loaders ignore it, so it is a LEAD. Both read every config.json at any depth. On 403 real repositories (the 400 most-downloaded and 100 most-liked transformers models plus 48 named), no result changed: 357 PASS and 46 LEAD before and after. Check set tier1/0.12. Signed-off-by: Christopher Maher <chris@mahercode.io>
Signed-off-by: Christopher Maher <chris@mahercode.io>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Remote code row names the Python a loader imports when the caller gives
trust_remote_code. Two published transformers vulnerabilities run code from a field ofconfig.jsonwhen the caller settrust_remote_code=False. The row read neither field, so a repository that used one with no.pyfile and noauto_mapPASSed.What it reads
Every
config.jsonin the directory, at any depth. A composite model builds each sub-config from its dict the same way.PreTrainedConfig.__init__applies every unknown key withsetattr. That covers_attn_implementation_internal, and_attn_implementation, whose property setter writes the internal field.is_kerneltakes forowner/repo[@rev][:fn]is downloaded and run when the model loads. This happens in 4.56.0 to 5.2.x oncekernelsis installed.to_dictdrops the internal field and never writes the property. Sosave_pretrainedwrites neither.config-kernel-injection, critical) for a kernel from any owner other thankernels-community.config-hub-kernel) for akernels-communitykernel. 5.3.0 and later still load those from_attn_implementation, without asking.trust_remote_codeset in the config (CVE-2026-5241).LightGlueConfigpassed this field to the nestedAutoConfig.from_pretrainedfor its keypoint detector. That imported another repository's code.config-trust-remote-code). The evidence names the repository thatkeypoint_detector_config._name_or_pathpoints at.Why FAIL for one and LEAD for the other
FAIL needs positive evidence.
trust_remote_code: true. The publishedETH-CVG/lightglue_disksets it on purpose, and loaders other than LightGlue ignore it. So it is a lead for review, likeauto_map.Not read (stated in the package doc and the baseline)
attn_implementation:from_dictreplaces it with the caller's own value.attn_implementationin a sub-config.trust_remote_codeintokenizer_config.jsonorsentence_bert_config.json: no loader's handling of those copies was read for this change._experts_implementation*: 5.2.0 accepts onlyeager,grouped_mm, orbatched_mmthere, with no kernel path.Measured: false positives
I scanned 403 real repositories with the gate from
mainand from this branch. JSON only, at pinned commits: the 400 most-downloaded and 100 most-liked transformers models on 2026-10-19, plus 48 named ones, including both LightGlue checkpoints.lightglue_disk'strust_remote_code: true, which adds a finding to a row that is already a LEAD through itsauto_map;_attn_implementation: "flash_attention_2", which is not a kernel.The table is in
docs/false-positive-baseline.md.Tests and benchmark
fields_test.gocovers every shape the loader reads: internal and property field, sub-config, per-sub-config map,paged|,@rev:fn. It also covers the curated LEAD, the LightGlue LEAD, and the limits pinned as PASS. Withoverridesneutered, the four detection tests fail.dir-config-kernel-injection(FAIL),dir-config-trust-remote-code(LEAD), and the controlcontrol-dir-attention-field. Remote code now detects 10 of 11; overall 69 of 75; 0 of 18 controls flagged. Under tier1/0.11 both new cases PASSed.auto_map.tier1/0.12, with a row indocs/check-set.md. The Remote code PASS statement, "looks for" text, severities, anddocs/dev.mdare updated.go test ./...,gofmt -l cmd internal, andgo mod verifyare clean.