Open
Conversation
Correctly reads 2 bytes instead of 1 byte from the SSN - previously, if the SSN was larger than 255 the incorrect SSN would be read, leading to an exception at runtime.
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.
Hey,
I noticed your GetSSN function was reading only the first byte (index position 4) for the SSN number - however SSNs are two bytes in length meaning if you were to make a syscall of a SSN larger than 255, you would get a runtime exception as you are calling the wrong function in the Kernel.
Demonstrated as below:
Choosing an NT function at random where SSN > 255:
You can also see it here in x64dbg:
Original call would resolve this to decimal 205 (0xcd)
However, the correct SSN for this on my current Windows build is 461 (0x1cd) - fixing the bug:
Tested with both direct and indirect syscall projects:
Direct
Indirect
Hopefully this makes sense! Happy to answer any other questions or engage further!