Analysis of McAfee's "buffer overflow protection" and bypass methods [anxio Leven]

Source: Internet
Author: User
[McAfee's "buffer overflow protection"]
If the shellcode in the stack calls functions such as getprocaddress, McAfee terminates the current process and generates an alarm.

[Analysis principle]
McAfee intercepts API functions such as loadlibrarya, loadlibraryw, and getprocaddress for all processes. The method is similar to API Interception: change the first several bytes of these functions to call detectapiret, that is, call entapi. detectapiret in DLL. This function checks whether the parent function that calls functions such as getprocaddress is in the heap or stack. If yes, it generates an alarm and exits the current process; otherwise, return to functions such as getprocaddress.

[Bypass Method]
Detectapiret simply regards the value of [esp + 0x04] As the return address of the parent function, so you only need to treat it as a valid return address, then forge a function call environment.
For example, if we want to call getprocaddress in shellcode and call detectapiret, the normal Stack is like this.

------------
0x0013aaaa // return address
Parameter 1
Parameter 2
------------

Construct such an environment

------------
0x7c9231db // the address in Ntdll. dll. The content is 0xc3 (RET)
Parameter 1
Parameter 2
0x0013aaaa // the actual return address
------------

Therefore, when shellcode calls getprocaddress, it first pushes 0x0013aaaa, then pushes two parameters, finally pushes 0x7c9231db, and then JMP getprocaddress.
Here, 0x0013aaaa needs to be obtained by calculating the relative offset address.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.