bitdefender / bddisasm

bddisasm is a fast, lightweight, x86/x64 instruction decoder. The project also features a fast, basic, x86/x64 instruction emulator, designed specifically to detect shellcode-like behavior.
Apache License 2.0
874 stars 112 forks source link

False-positive decoding on AMD64: INTO #22

Closed woodruffw closed 3 years ago

woodruffw commented 3 years ago

Hi there, mishegos maintainer here.

It looks like bddisasm currently treats CEh as a valid decoding for INTO (i.e., interrupt level 4 if FLAGS.OF=1) in 64-bit mode. This is incorrect -- CEh is only INTO in 32-bit mode, and is invalid in 64-bit mode.

Some examples (the first two columns are XED and Zydis reporting that the decoding is invalid; the third is bddisasm incorrectly reporting a valid decoding):

ce (0 / 0) (0 / 0) INTO (1 / 4)

Similarly, prefixed versions should also be treated as invalid in 64-bit mode:

6667f365ce (0 / 0) (0 / 0) INTO (5 / 4)

From the AMD developer's manual:

Screen Shot 2020-11-07 at 4 16 27 PM