Shellcode encoded with XOR
To evade detection, ready-made shellcode is often encoded with a repeating XOR key and only decrypts itself before execution ("self-decoding shellcode"). However, ALMOST ALL real shellcodes begin with a "NOP slide" consisting of several 0x90 (NOP) bytes at the start — which creates a very convenient opportunity for a known-plaintext attack.
The following encoded shellcode is provided (XOR key length is exactly: 3 bytes), in hex format:
0287D7025506CB4508C36C17C55918C15F02DE5B04DD5302CD2F7EA1213A5E
To find the key: XOR the first 3 bytes of the encrypted file with the known NOP slide (0x90 0x90 0x90) — the result will be the key itself. Once the key is found, apply it to the entire ciphertext (repeatedly) — the result will be a NOP slide, followed by readable text (including the flag), and then a single 0xCC (INT3 — breakpoint) byte.