fix(detector): catch LAST_CALL_REPLAY via captured-state subscript/attribute#11
Closed
SinatrasC wants to merge 1 commit into
Closed
fix(detector): catch LAST_CALL_REPLAY via captured-state subscript/attribute#11SinatrasC wants to merge 1 commit into
SinatrasC wants to merge 1 commit into
Conversation
…tribute slots
The first three passes in detect_last_call_replay only key off module-level
Name storage with a stateful-looking name or a None initializer. They miss
the same identity-keyed exploit when the saved input/output live one level
removed — as a dict key on a captured object, or as an attribute on a
captured instance. Add a fourth pass that flags
if state["last"] is data: return state["out"]
if _ctx.last is data: return _ctx.out
when the captured root is also written via Subscript/Attribute targets in
the entrypoint body, and the if-body returns a value rooted on a
non-parameter (captured) name.
KernelGuard Blue Evaluation
|
This was referenced Apr 30, 2026
Collaborator
Author
|
Thanks for the KernelGuard Flywheel Campaign contribution. This PR is now superseded by the consolidated rule-family implementation in #273, which folds this detector coverage together with the related passing-eval variants. |
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.
Summary
Targets red submission #9 (
DICT_KEYED_IDENTITY_REPLAY) — a real false negative on production KG: the existing detector keys off module-levelNamestorage with a stateful-looking name or aNoneinitializer, and misses the semantically identical exploit when the saved slot lives one level removed (dict key on a captured object, or attribute on a captured instance).KG classified this
valid(no patterns matched) prior to this patch.Approach
Add a quaternary pass to
detect_last_call_replay:SubscriptorAttributetargets inside the entrypoint.Ifwhose body has no real compute. Trigger when itstestcontains aniscomparison whose two sides pair up asThis catches the dict-key shape and the attribute shape without relying on the stateful-name heuristic. False-positive guards: the captured root must actually be subscripted/attribute-stored inside the entrypoint, and the if-body must be call-free.
KernelGuard-Red-Submission: 9
Test plan
dict_subscript_replay(red E2E auto-trigger smoke test (workflow_run) #9) → flaggedLAST_CALL_REPLAY,classification=hacked,should_filter=Truegetattr_identity_replay(instance attribute variant) → flaggedLAST_CALL_REPLAYlast_call_replay(existing test) → still flaggedworkspace_helper, plain Triton kernel, dtypeis-compare against config dict → all stayvalid