Binary protection mechanism

Here it is primarily concerned with the protection mechanism ELF binaries under the CTF linux. There is a script checksec command to view current protection mechanism in linux binaries. Any install a plug-gdb will put checksec script included.

Execution in gdb: 
gdb> checksec the Test 
Canary: No 
NX: Yes 
PIE: No 
Fortify: No 
RelRO: Partial 

execution directly in the shell: 
$ checksec the Test 
Arch: i386-32-Little 
RELRO: Partial RELRO 
Stack: No Canary found 
NX : NX Enabled 
PIE: No PIE (0x8048000)

You can see checksec instruction architecture can view the current binary file and taken to protection mechanisms.

1.Canary (stack protection)

This option means that stack protection function is not enabled.

Stack overflow protection is a buffer overflow attack mitigation means, when there is a function of buffer overflow vulnerabilities, an attacker can overwrite the return address on the stack to make shellcode can be implemented. When the stack protection is enabled, when the function will begin to insert cookie information to the stack when the function returns true cookie will verify the information is legitimate, if not legally stop running. An attacker overwrite the return address, it tends to cookie information will be overwritten, resulting stack protection check fails and prevent the execution of the shellcode. In Linux we will be called cookie information canary.

2.NX / DEP (the stack is not performed)

NX That No-eXecute (unenforceable) the meaning of the basic principles of NX (DEP) where the data is marked as non-executable memory pages, when the program successfully into the overflow shellcode, the program will try to execute commands on the data page, this when the CPU will throw an exception, rather than to execute malicious commands.

3.PIE / ASLR (address randomization)

 

4.Fortify 

This protection mechanism to check for a long time are not very good Chinese describe it in fact and stack protection according to my understanding of the new gcc are a mechanism for enhanced protection against buffer overflow attacks. Because not too common, without much understanding.

5.RelRO

Setting the table is read-only or redirection symbol parsing and binding on all dynamic symbols, thereby reducing the GOT (Global Offset Table) attacks when the program starts.

 

Guess you like

Origin www.cnblogs.com/nul1/p/10944265.html