基础概念
DEP(Data Execution Prevention):防止一些内存位置执行代码的一种保护机制,特别是堆栈,因此在windows中利用栈返回技术攻击溢出的方法已不再适用了。
ROP(Return Oriented Programming):连续调用程序代码本身的内存地址,以逐步地创建一连串欲执行的指令序列。
WPM(Write Process Memory):利用微软在kernel32.dll中定义的函数比如:WriteProcess Memory函数可将数据写入到指定进程的内存中。但整个内存区域必须是可访问的,否则将操作失败。函数原型:
WriteProcessMemory: procedure
(
hProcess: dword;
// Handle to the process whose memory is to be modified
var lpBaseAddress: var;
// Pointer to the base address in the specified process to which data will be written
var lpBuffer: var;
// Pointer to the buffer that contains data to be written into the address space of the specified process
nSize: dword;
// Specifies the requested number of bytes to write into the specified process
var lpNumberOfBytesWritten: dword
// Pointer to a variable that receives the number of bytes transferred.
);
BlackHat USA 2010:
404K9s2c8@1M7q4)9K6b7g2)9J5c8W2)9J5c8X3u0D9j5h3y4C8K9r3q4@1i4K6u0W2j5$3!0E0i4K6u0r3K9s2c8E0L8q4)9J5c8X3u0Z5i4K6u0V1N6i4y4Q4x3X3b7I4x3q4)9J5c8X3u0Z5i4K6u0V1N6i4y4Q4x3X3b7I4x3q4)9J5k6r3q4J5j5$3S2A6N6X3g2K6i4K6u0W2K9s2c8E0L8l9`.`.
关于ShellCode的布局:
第一次:
my $buffer = “A” x 4436 . “\x2F\x37\x01\x10” . “A” x 10000;
第二次:
my $buffer = “A” x 280 . “\x01\x00\x00\x00” . “B” x (4436 – 280) . “\x2F\x37\x01\x10” . “A” x 10000;
第二次是不是应该是
my $buffer = “A” x 280 . “\x01\x00\x00\x00” . “B” x (4436 – 280 - 4) . “\x2F\x37\x01\x10” . “A” x 10000;