elf 变异upx 脱壳
生活随笔
收集整理的這篇文章主要介紹了
elf 变异upx 脱壳
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
題目
是某ctf題
首先使用IDA打開:
函數極少,有殼。
查看函數
這個跳轉比較可疑
下面進行IDA動態調試
進入loc_52D516
再進入
直到找到jmp r13
運行到這里,F8跳轉
直接retn下斷點F9,直接retn下斷點F9重復,
直到遇到一個大跳轉
單步,然后return
來到了程序入口
下面dump脫殼(轉儲的意思)。
dump要使用腳本,因為我是個菜雞,直接在網上找的腳本,通用的。
idc腳本下載
可以存放在ida里面有個腳本的文件夾idc,源碼后面會附上
首先
在D盤下創建一個dumpfile無后綴文件,不然要提示錯誤
當然也可以改文件目錄和地址,見源文件
運行到程序入口點。
使用alt+F7載入腳本,選擇dump_elf64
等待
加載
成功以后,剛剛創建的dumpfile就是脫殼后的文件了。
源碼:
#include <idc.idc> #define PT_LOAD 1 #define PT_DYNAMIC 2 static main(void) {auto ImageBase,StartImg,EndImg;auto e_phoff;auto e_phnum,p_offset;auto i,dumpfile;ImageBase=0x400000;StartImg=0x400000;EndImg=0x0;if (Dword(ImageBase)==0x7f454c46 || Dword(ImageBase)==0x464c457f ){if(dumpfile=fopen("D:\\dumpfile","wb"))//這路可以更改路徑{e_phoff=ImageBase+Qword(ImageBase+0x20);Message("e_phoff = 0x%x\n", e_phoff);e_phnum=Word(ImageBase+0x38);Message("e_phnum = 0x%x\n", e_phnum);for(i=0;i<e_phnum;i++){if (Dword(e_phoff)==PT_LOAD || Dword(e_phoff)==PT_DYNAMIC){ p_offset=Qword(e_phoff+0x8);StartImg=Qword(e_phoff+0x10);EndImg=StartImg+Qword(e_phoff+0x28);Message("start = 0x%x, end = 0x%x, offset = 0x%x\n", StartImg, EndImg, p_offset);dump(dumpfile,StartImg,EndImg,p_offset);Message("dump segment %d ok.\n",i);} e_phoff=e_phoff+0x38;}fseek(dumpfile,0x3c,0);fputc(0x00,dumpfile);fputc(0x00,dumpfile);fputc(0x00,dumpfile);fputc(0x00,dumpfile);fseek(dumpfile,0x28,0);fputc(0x00,dumpfile);fputc(0x00,dumpfile);fputc(0x00,dumpfile);fputc(0x00,dumpfile);fputc(0x00,dumpfile);fputc(0x00,dumpfile);fputc(0x00,dumpfile);fputc(0x00,dumpfile);fclose(dumpfile);}else Message("dump err.");} } static dump(dumpfile,startimg,endimg,offset) {auto i;auto size;size=endimg-startimg;fseek(dumpfile,offset,0);for ( i=0; i < size; i=i+1 ) {fputc(Byte(startimg+i),dumpfile);} }這個題脫殼后就全是地址了,用了很多方法,沒找著主函數,我太菜了
總結
以上是生活随笔為你收集整理的elf 变异upx 脱壳的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 一个好用的数学公式编辑器的下载安装(La
- 下一篇: CHD5安装升级