Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not all nops in ZydisEncoderNopFill #545

Open
Nitr0-G opened this issue Dec 18, 2024 · 1 comment
Open

Not all nops in ZydisEncoderNopFill #545

Nitr0-G opened this issue Dec 18, 2024 · 1 comment

Comments

@Nitr0-G
Copy link

Nitr0-G commented Dec 18, 2024

The maximum length we have is 9, although we have much larger instructions for nop

zydis/src/Encoder.c

Lines 4759 to 4770 in bffbb61

static const ZyanU8 nops[9][9] =
{
{ 0x90 },
{ 0x66, 0x90 },
{ 0x0F, 0x1F, 0x00 },
{ 0x0F, 0x1F, 0x40, 0x00 },
{ 0x0F, 0x1F, 0x44, 0x00, 0x00 },
{ 0x66, 0x0F, 0x1F, 0x44, 0x00, 0x00 },
{ 0x0F, 0x1F, 0x80, 0x00, 0x00, 0x00, 0x00 },
{ 0x0F, 0x1F, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x66, 0x0F, 0x1F, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00 },
};

    3 byte — 0F1F00h,
    4 byte — 0F1F4000h,
    5 byte — 0F1F440000h,
    6 byte — 660F1F440000h,
    7 byte — 0F1F8000000000h,
    8 byte — 0F1F84000000000h,
    9 byte — 660F1F840000000000h,
    10 byte — 662E0F1F840000000000h,
    11 byte — 66662E0F1F840000000000h,
    12 byte — 6666662E0F1F840000000000h,
    13 byte — 666666662E0F1F840000000000h,
    14 byte — 66666666662E0F1F840000000000h,
    15 byte — 6666666666662E0F1F840000000000h.
@mappzor
Copy link
Contributor

mappzor commented Dec 18, 2024

As indicated by the comment right above this table, ZydisEncoderNopFill uses recommended sequences only and that's a deliberate choice. Of course adding repeated prefixes should remain safe in the future but it's not guaranteed.

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

No branches or pull requests

2 participants