Repository navigation
Conversation
A stack trial whose value is a global XORed with the stack or frame pointer (/GS and EH: mov eax,[___security_cookie]; xor eax,esp; push eax) is no-use at every call. Pushed in an SEH prologue, the cookie sat right below the frame's slots and became the trailing argument of the first call that took more than its own pushes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…iable number The fixture's /GS cookie no longer becomes sub_401400's argument, so the registration record is the first local and its name moves from v2 to v1. Assertion-change: verify_pebnames: the record's name follows the dropped cookie variable Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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
/GScookie an MSVC SEH prologue pushes becomes a stack argument of calls in the body:With this change:
Fix
checkInputTrialUsemarks a stack trial no-use at every call when its value is the frame cookie (p4_calls/kuna_stackcookie.rs). On every path, the value must be anINT_XORof a value read from a fixed data address with the stack pointer, or an offset from it. The check follows the value back through copies, the INDIRECTs of earlier calls, and joins. That coversxor eax,esp; push eaxandxor eax,ebp; mov [ebp-4],eax. Only the epilogue reads the slot back, in ECX. This is a correctness fix, so there is no option.Tests
tests/stages/kuna-stackcookie.xmluses the new clean-room fixturestackcookie_pe_i386.exe:this-only method;[ebp-4]and checking it.On
main,STACKCOOKIE #1and#2fail.STACKCOOKIE #3and#4pin the EBP frame, which already printed right, and the cookie still reaching the check in ECX.verify_pebnamesmatched its SEH record by the namev2. Onmainthe fixture's cookie wasv1, assub_401400's stray argument, so the record is nowv1. The test now matches the record's shape, not its number.python -m scripts.prepr.aritydiffagainstmain:WinHelloCPP.exeMoveToExgoes from 5 to 4 arguments, dropping the cookie.operator new(0x178)called aspush 0x178; call; add esp,4, which went from 3 arguments to 1;this-only calls with no push.this-only destructor takes three stack slots the upstream trial test now accepts; those trials used to stop at the cookie slot.decompile-alltime is unchanged.Fixes #1593
🤖 Generated with Claude Code