intermediate code before and after it is irrelevant to this example)39: void winapi input (Int M, Int N)40 :{00401110 push EBP00401111 mov EBP, ESP00401113 sub ESP, 48 h00401116 push EBX00401117 push ESI00401118 push EDI00401119 Lea EDI, [ebp-48h]0040111c mov ECx, 12 h00401121 mov eax, 0 cccccccch00401126 rep STOs dword ptr [EDI]41: int S, I;42:43: While (1)00401128 mov eax, 10040112d test eax, eax0040112f je input + 0c1h (004011d1)44 :{45: printf ("" nplease input the first number M :");0040
, % eax12. mov % ax, % FS13. incl jiffies14. movb $0x20, % Al15. outb % Al, $0x2016. movl CS (% ESP), % eax17. Andl $3, % eax18. pushl % eax19. Call do_timer20. Andl $4, % ESP21. JMP ret_from_sys_call
From 1 to 7 behavior-based stack operation, this is what we care about! 16-18 is to apply CPL (CPL = cs 3) to the stack for the do_tiemr (long CPL) function. So what about the stack when it is executed into do_timer? Let's see:
| Return address |-------
8086cpu starts from memory m x 16 + N Units, reads and executes a command.
10. Modify the commands for CS and IP addresses.
Most 8086cpu registers can be changed using mov commands. mov commands are calledTransfer command
The mov command cannot modify the Cs or IP value because 8086cpu does not provide such a function.
Commands that can change the content of CS and IP registers are calledTransfer Instruction.
A simplest command that can modify the value of CS and IP registers:
1. Use the ESP Law
After the OD is loaded, right-click the ESP content in the register window (for example, 0012ffa4) at F8 once, and choose "follow in the data window" to go to the memory data window, display the memory data window in the form of Hex data. Right-click the address starting position (for example, 0012ffa4) and choose "breakpoint"> "Hardware access"> "word ", f9 runs directly. If it is F8 again or twice, the code push EBP is usually used. The address of this Code is OEP.
2. Secon
instruction and corresponding machine code:NOP : The NOP instruction is the "null instruction". When executing to the NOP instruction, the CPU does nothing, just as an instruction to execute the past and continue executing a command behind NOP. (Machine code: 90)JNE : Conditional transfer directives, if not equal, jumps. (Machine code: 75)JE : The conditional transfer instruction, if equal, jumps. (Machine code: 74)JMP : Unconditional transfer instruc
instruction and corresponding machine code:NOP : The NOP instruction is the "null instruction". When executing to the NOP instruction, the CPU does nothing, just as an instruction to execute the past and continue executing a command behind NOP. (Machine code: 90)JNE : Conditional transfer directives, if not equal, jumps. (Machine code: 75)JE : The conditional transfer instruction, if equal, jumps. (Machine code: 74)JMP : Unconditional transfer instruc
table size
Push edx; file pointer
Add ebp, esi; after ebp points to the block table of the virus data area (the first block)
Push ebp; buffer address
; Set the size of the first virus code block
Lea eax, [ebp + edi-04h]
Mov [eax], ebx
; Set the first virus block
Push ebx; the size of the first part of the virus code
Add edx, edi
Push edx; file pointer
Lea edi, (MyVirusStart-@ 9) [esi]
Push edi; buffer address
; Modify the AddressOfEntryPoint entry to the virus entry
Mov (NewAddre
{ 0x1093a10 ebfe JMP main.deadloop(SB) 0x1093a12 cc INT $0x3 0x1093a13 cc INT $0x3 0x1093a14 cc INT $0x3 0x1093a15 cc INT $0x3 ... ... 0x1093a1f cc INT $0x3
We see that the call to add in Deadloop also disappears. This is obviously the result of Go c
::onbnclickedsub () {ASSERT (hinst); mysub = (m_sub):: GetProcAddress (hinst, "sub"); int a = n, b = 6;int Res = MySub (A, b); CString Str;str. Format (_t ("a-b=%d"), res); AfxMessageBox (str);} void Cmathtestdlg::onbnclickedmod () {ASSERT (hinst); mymod = (m_mod):: GetProcAddress (hinst, "mod"); int a = n, b = 6;int Res = Mymod (A, b); CString Str;str. Format (_t ("A for remainder b=%d"), res); AfxMessageBox (str);}Second, Mfc-dll1. Mfc-dll will call code in InitInstance when loading, exit loa
the specified memory address, instead it must use instructions that change the instruction pointer to change the next instruction of the pre-access cache, which is called the branch instruction. The branch instruction can change the value of the EIP register, either unconditionally or by conditional change. when a program encounters a jump, call, or interrupt, the instruction pointer automatically jumps to another location.
Jump Instructions
The jump instruction uses a single ins
table entry 0000:0634-Dec CX. # entries left 0000:0635 jz short Loc_tabok, all entries look OK 0000:0637 2C CMP [Si],ch; Other entries = 0? 0000:0639 F6 JE Loc_nextrpe; Yes, this one is OK 0000:063b Loc_bad:; Found a invalid entry: ; A). From 0624:boot ID!=0 and!=80h ; B. From 0639:multi entries with id=80h 0000:063b. is 0710 mov si,offset msg1+1; ' Invalid partition '
0000:063e loc_halt:; show msg then halt 0000:063e 4E Dec si 0000:063f loc_msg:; xref 064B, 06BA 0000:063f AC LODSB
entering the sub-call (used for the stack balance of the sub-call), after exiting, the original ebp value will be restored according to * pop EBP.
Taking this sentence as a breakthrough means that as long as we can break through the "top-Layer Program", we can observe the ESP value of EBP when the shell is between JMP and OEP.
3. Practice
Let's take a look at the pespin1.1 shell. In the pespin1.0 shell, we can easily find the place of stolen code usi
enlighten us!
[Cracking tool]: Modified TRW2000 doll version, Ollydbg1.09, PEiD, LordPE, ImportREC, W32Dasm 9.0 platinum Edition
---------------------------------[Process ]:This is the first easy-to-use language written in my opinion. ^ O ^ all the operations and comparisons are completed in the easy-to-run library. This version was obtained a long time ago and has been available for trial recently.---------------------------------I. shelling
Chaoshi.exe is the ASPack 2.12 shell, which can be d
pixel. --------------------------------------------------------------------------- Example: [cpp] # This program draws a straight line in graphics mode. #2012-12-24 # guzhoudiaoke@126.com. section. text. global _ start. code16 _ start: jmp main clear_screen: # clear screen function movb $0x06, % ah # function no. 0x06 movb $0, % al # Roll up all rows, movb $0, % ch # movb $0 in the upper left corner of the screen, % ch # movb $24 in the upper left co
unconditional transfer commands, JMP, and so on, that can be used to judge the condition of if, for, and while in a high-level language. Some directives that change status flags, such as CMP, are usually used before these instructions.Among them, what can be learned in this experiment is. The student variable is defined in the data segment and contains 100-byte elements. This is the same as the concept of arrays in high-level languages. In fact, reca
the size of the first virus code block
Lea EAX, [ebp+edi-04h]
mov [EAX], ebx
; Set the first block of viruses
Push ebx; The size of the first block of the virus code
Add edx, EDI
push edx; file pointer
Lea EDI, (myvirusstart-@9) [esi]
Push EDI; buffer address
Modify the entrance of the addressofentrypoint for the virus entrance
MOV (NEWADDRESSOFENTRYPOINT-@9) [esi], edx; Save a new program entry (virus text)
; Set Initial data
Lea edx, [esi-sizeofscetiontable]; EdX first min
Shelling software: MultiTranse 4.1.1: Http://www.tialsoft.com/download/Software Description: MultiTranse is a software that employs free online resources to translate to/from 13 different ages.Shelling method: Execryptor 2.xAuthor's statement: I am only interested. If you make mistakes, please correct them.
1. Use HidaOD to hide the OLLYDBG_Execryptor (for debugging the OD of Execryptor, see the link below). After stopping the system breakpoint, run the BypassAnti script and there will be some e
Ad removal principle:
Here, of course, the middlebeer method MoveWindow (hwndChild, true) is used );The advertisement bar class is TGradualPanel.
Ad Analysis1. peidcheck main program: thunder.exe, no shell, Borland Delphi 6.0-7.0 compilation.
2. Use ollydbg to load Thunder.exe and then run the breakpoint bpx ShowWindow
00495474. 50 push eax00495475. 8B45 FC mov eax, dword ptr ss: [ebp-4]00495478. E8 F38DFEFF call Thunder1.0047E2700049547D. 50 push eax; | hWnd is disconnected under this0049547E.
Instructions:Push ebpMov ebp, espInc ecxPush edxNopPop edxDec ecxPop ebpInc ecxOriginal jmp entry
1. Disguised vc
The entry code of the VC ++ program:PUSH EBPMov ebp, ESPPUSH-1Push 415448 -\___PUSH 4021A8-/in this Code, operations similar to this can be left blankMov eax, dword ptr fs: [0]PUSH EAXMov dword ptr fs: [0], ESPAdd esp,-6CPUSH EBXPUSH ESIPUSH EDIAdd byte ptr ds: [EAX], AL/this command can be left blank!
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.