Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mov eax, large fs:30h

I was analyzing some x86 binary and found the following instruction which I can not understand. Can someone please explain me following instruction?

mov     eax, large fs:30h

I googled this, and it turns out it is some anti-debugging stuff... but that's all I know.

what does large means?? And what does fs:30 means??

I know about segmentation but I don't know when the fs register is used. For say cs:, ds: are implicitly skipped when instruction is referencing code or data. But what is fs, and what is gs?

like image 304
daehee Avatar asked Jan 24 '13 08:01

daehee


1 Answers

Looks like it's Windows code, loading the address of the Process Environment Block (PEB), via the Thread Information Block, which can be accessed via the FS segment.

The PEB contains, amongest other things, a flag indicating if the process is being debugged.

MSDN has a page about it here

like image 151
JasonD Avatar answered Oct 13 '22 21:10

JasonD