Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: [MASM] InjectEXE

  1. #11
    Senior Member
    Join Date
    Jan 2008
    Location
    Some where on the earth.
    Posts
    106


    - -"

    อีกหนึ่งคำุถามเพื่อเป็นการ confirm ความโง่ของตัวเอง เหอๆๆ (ก่อนหน้านี้มีอีก 1 คำถามนะครับ ยังไงช่วยดูหน่อย)

    [code]
    invoke GetFileSize,eax,0;Get file's size
    mov dwSize,eax;eax
    <div align="center">"Hacking isn’t about helping the security industry, which leeches from Hackers."</div>

    <div align="center">http://img397.imageshack.us/img397/159/cwhbannerzl0.gif</div>

  2. #12
    Senior Member
    Join Date
    Jul 2004
    Location
    Thailand
    Posts
    211


    ตรง VirtualAlloc,0 << มันไม่ไ่ด้กำหนด Address ที่จะทำ VirtualAlloc เ้อาไว้อ่ะครับ (มันกำหนดเป็น0) แล้วทีนี้ จะทำไปกำหนด access policy ของ File ที่เราเรียกด้วย CreateFile ได้หรอครับ??

    Clear แล้วครับ - -"(ถามเองตอบเอง) สรุปว่า VirtualAlloc มีเอาไว้สำหรับกำหนด Allocation ของ File ที่เราจะ Read ขึ้นมา
    ถ้าเป็นอย่างนั้นตามที่ผมเข้าใจก็คือ เราต้องทำการเรียกใช้ พวก VirtualAlloc หรือ GlobalAlloc ก่อนที่ทำเรียกใช้ ReadFile หรือ WriteFile ถูกไหมครับ?[/b]

    โค้ดทั้งหมดนี้ เดิมๆ เขียนด้วย delphi โดย aphex และ ทำการ แปลง โดย shapeless กลายเป็น Masm function เดิมๆ ของมัน คือ Getmem http://www.delphibasics.co.uk/RTL.asp?Name=GetMem อยู่ใน System.pas
    ไม่ใช้ function ที่ออกโดย microsoft เลยใช้ VirtualAlloc ทดแทน ความจริงใช้มาแต่แรกก็ได้
    ตอบไม่ตรง คำถามซ้ะงั้น

    * api หาอ่านได้ทั่วๆ ไปเลยครับ บานเลย เยอะแยะมากมาย

  3. #13
    Senior Member
    Join Date
    Jan 2008
    Location
    Some where on the earth.
    Posts
    106


    * api หาอ่านได้ทั่วๆ ไปเลยครับ บานเลย เยอะแยะมากมาย
    [/b]

    - -"
    ปัญหาของผมคือการใช้งานอ่ะครับ (อ่านพอมั่วได้) แต่พอเอาไปใช้จริงๆ กลับไม่รู้ว่าต้องใช้ยังไง อย่างเช่น เจ้า
    Virtualloc << เชื่อมะ เพิ่งรู้เมื่อวานเลยว่าใช้งานยังไง T-T

    สงสัยทำได้อย่างเดียวคือต้องฝึกเขียนบ่อยๆ กับ อ่าน code ที่ท่าน neoclassic เอามาปล่อย ... ^^"

    <div align="center">"Hacking isn’t about helping the security industry, which leeches from Hackers."</div>

    <div align="center">http://img397.imageshack.us/img397/159/cwhbannerzl0.gif</div>

  4. #14
    Senior Member
    Join Date
    Jan 2008
    Location
    Some where on the earth.
    Posts
    106


    เอาหละ อ่านจบซักที มีปัญหา มาถามอีกแล้วครับ

    Code:
    mov eax,contxt.regEbx
    add eax,8
    lea ecx,[edi].OptionalHeader.ImageBase
    invoke WriteProcessMemory,ProcInfo.hProcess,eax,ecx,4,addr BytesRead
    push [edi].OptionalHeader.ImageBase
    pop eax
    add eax,[edi].OptionalHeader.AddressOfEntryPoint
    mov contxt.regEax,eax
    invoke SetThreadContext,ProcInfo.hThread,addr contxt
    Code:
    mov eax,contxt.regEbx
    add eax,8
    ผมไม่เข้่าใจว่าทำไมต้องเอาค่าเก็บอยู่ใน EBX มา + 8 แล้ว write ค่า ImageBase กลับลงไปที่ ตำแหน่งนั้น?

    Code:
    add eax,[edi].OptionalHeader.AddressOfEntryPoint
    mov contxt.regEax,eax
    แล้วทำไมถึง move ค่า EP ของ program ไปไว้ใน EAX ?

    - -" พยายามหาอ่านใน net แต่หาคำตอบไม่ได้ซักที
    <div align="center">"Hacking isn’t about helping the security industry, which leeches from Hackers."</div>

    <div align="center">http://img397.imageshack.us/img397/159/cwhbannerzl0.gif</div>

  5. #15
    Jedi Global Moderator blackkitty's Avatar
    Join Date
    Aug 2007
    Location
    HY .. TANK.ADM..
    Posts
    216


    มา เขยิบให้นะท่าน Tummy โอเคครับ..

    <div align="left"> </div>

    สันติภาพจงสู่ปักษ์ใต้ของเรา.. สันติสุขจงสู่แผ่นดินของเรา</div>
    <div align="center">...............................................................................................................................................................</div>
    <div align="center"></div>

  6. #16
    Senior Member
    Join Date
    Jul 2004
    Location
    Thailand
    Posts
    211


    <div class='quotetop'>QUOTE
    mov eax,contxt.regEbx
    add eax,8[/b]
    ผมไม่เข้่าใจว่าทำไมต้องเอาค่าเก็บอยู่ใน EBX มา + 8 แล้ว write ค่า ImageBase กลับลงไปที่ ตำแหน่งนั้น?[/b][/quote]

    ทุกครั้งที่ run ค่า contxt.regEbx จะไม่ซ้ำกันเลยและ + ไปอีก 8 ยัง งง อยู่เลย ทั้งๆ ที่ regEax..regEdi มีค่าหมดเลย แต่ทำไม่เลือก regEbx แถมยังต้อง + 8 ถ้าไม่เป็นตามนี้ไม่เวิร์ค ยังคิดไม่ออก ไม่รู้เหมือนกันว่า aphex หาค่านี้มาได้ไง :P


    <div class='quotetop'>QUOTE
    add eax,[edi].OptionalHeader.AddressOfEntryPoint
    mov contxt.regEax,eax[/b]
    แล้วทำไมถึง move ค่า EP ของ program ไปไว้ใน EAX ?[/b][/quote]

    มุมมองง่ายๆ
    contxt.regEax = ImageBase + AddressOfEntryPoint
    เก็บค่าไว้ใน contxt เพื่อจะ ResumeThread เป็นขั้นตอนสุดท้าย ไม่เช่น นั้น bytes ใหม่ๆ ที่เขียนลง memory จะไม่มีผล

  7. #17
    Senior Member
    Join Date
    Jan 2008
    Location
    Some where on the earth.
    Posts
    106


    ผมหาคำตอบของ EBX +8 มาได้ละ ^^"
    **Hidden Content: To see this hidden content your post count must be 1 or greater.**


    แต่ผมยังหาคำตอบของ context.regEax ที่เก็บค่า EP เอาไว้ไม่ได้ว่า เพราะอะไร

    จากการมั่วของผมก็คือ context.regEax จะเก็บค่า ตำแหน่งของการ return to thread เอาไว้ถูกไหมครับ? << อันนี้ผมเดาเอาอ่ะ
    <div align="center">"Hacking isn’t about helping the security industry, which leeches from Hackers."</div>

    <div align="center">http://img397.imageshack.us/img397/159/cwhbannerzl0.gif</div>

Page 2 of 2 FirstFirst 12

Similar Threads

  1. [MASM] Unpack FSG
    By neoclassic in forum Assembly
    Replies: 0
    Last Post: 31-10-2009, 04:50 PM
  2. Replies: 0
    Last Post: 14-12-2008, 07:52 AM
  3. Replies: 0
    Last Post: 21-06-2008, 02:25 PM
  4. Replies: 0
    Last Post: 01-06-2008, 02:23 PM
  5. เทตนิค Fwb+[Masm]
    By neoclassic in forum Assembly
    Replies: 0
    Last Post: 26-12-2006, 09:11 PM

Members who have read this thread : 0

Actions : (View-Readers)

There are no names to display.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •