Skip to content

Read 2 bytes for SSN#14

Open
0xflux wants to merge 1 commit intocr-0w:mainfrom
0xflux:read-two-bytes
Open

Read 2 bytes for SSN#14
0xflux wants to merge 1 commit intocr-0w:mainfrom
0xflux:read-two-bytes

Conversation

@0xflux
Copy link
Copy Markdown

@0xflux 0xflux commented May 27, 2024

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:

table

You can also see it here in x64dbg:

NtSystemDebugControl

Original call would resolve this to decimal 205 (0xcd)

before

However, the correct SSN for this on my current Windows build is 461 (0x1cd) - fixing the bug:

after

Tested with both direct and indirect syscall projects:

Direct

1byte

Indirect

indirect

Hopefully this makes sense! Happy to answer any other questions or engage further!

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant