pwn 进阶(3)

0x01 Stack migration

leave;ret;

leave
mov esp,ebp
pop ebp
ret
pop eip

if we deploy stack

stack bss
fake_ebp1 esp–> fake ebp1 mem is here/ fake_ebp2
read fake_fun
leave_ret ebp–> fake_ebp2 mem is here

control eip return to read fake_eb2 as fake ebp1

if a func call another func , when it return ,it execute leave;ret;

mov esp,ebp  --> esp <=> ebp
pop ebp  --> ebp <=> fake epb1
pop eip --> return read --> write fake_ebp2 to fake ebp1
then leave_ret
mov esp,ebp  --> esp <=> ebp
pop ebp  --> ebp <=> fake epb2
pop eip --> return fake_fun

now we finish Stack migration.

sometimes we need migrate stack to bss segment.

0x02 ida keypatch

g 0042AA98
keypatch --> patcher --> assemble 
edit --> patch program --> ...input file

0x03 Encryption & Deencryption

Why ?

Because i don‘t want to learn windows pwn ,yeah f**k b++c that pwn ,so I want to learn something about reverse. therefore,i start to learn Encryption & Deencryption.Who know it ,hahahahfahahfafa i don’t like study anymore.

Chapter I basic knowledge

1.Two byte storage sequences

Little-endian:high high ,low low

Big-endian:low high,high low

2.Windows OS
win32 API
windows application
win32 API
OS
device

The core of windows is dynamic link. Windows provides a wealth of application programs to use function calls, which are implemented by dynamic link library (DLL). The main parts of early windows only need to be implemented in three dynamic link libraries, which respectively represent the three main subsystems of windows, namely kernel, user and GDI

kernel, user and GDI:

kernel:implemented by kernel32.DLL, core function services of os.

user:handle user interface, including keyboard and mouse input, window and menu management, etc

GDI:a graphical device interface that allows programs to display text and graphics on screens and printers.

Windows also provides other DLLs to support more functions

The 64 bit system files of windows are placed in a folder called system32, which contains the native 64 bit image files. In order to be compatible with 32-bit operating system, the folder \ windows \ sysWOW64 is added, in which 32-bit system files are stored

Windows message mechanism

Windows is a message driven system. Windows messages provide a means of communication between applications and windows systems. There are two kinds of message queues in Windows system: one is system message queue, the other is application message queue

SendMessage function: call the window function of a window to send a message to that window. The function does not return until the message has been processed.

WM COMMAND: when a user selects a command or control from a menu or button, the message is sent to its parent window, or when a shortcut key is released. Return value: non-zero for processing

WM Destroy: when a window is destroyed, the message is sent, and the hexadecimal number of the message is 02h. Return value: non-zero if processed

WM gettext: copies the text of a corresponding window to a buffer provided by the caller. Return value: number of characters copied

WM qui

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值