Guest User

Untitled

a guest
Feb 12th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     #  _    _                           ____      _               _   _   _
  2.     # | |  | |                         |  _ \    | |             | | | | | |
  3.     # | |__| | __ _ _ __  _ __  _   _  | |_) | __| | __ _ _   _  | | | | | |
  4.     # |  __  |/ _` | '_ \| '_ \| | | | |  _ < / _` |/ _` | | | | | | | | | |
  5.     # | |  | | (_| | |_) | |_) | |_| | | |_) | (_| | (_| | |_| | |_| |_| |_|
  6.     # |_|  |_|\__,_| .__/| .__/ \__, | |____/ \__,_|\__,_|\__, | (_) (_) (_)
  7.     #              | |   | |     __/ |                     __/ |            
  8.     #              |_|   |_|    |___/                     |___/
  9.     #
  10.     #  
  11.     #
  12.     # char z3f_bday_shellcode[] =
  13.     # "\xeb\x12\x59\x48\x31\xc0\x48\x31"
  14.     # "\xdb\x48\x31\xd2\xb0\x04\xfe\xc3"
  15.     # "\xb2\x19\xcd\x80\xe8\xe9\xff\xff"
  16.     # "\xff\x7c\x2d\x7c\x34\x70\x70\x59"
  17.     # "\x20\x62\x2d\x44\x40\x79\x20\x5a"
  18.     # "\x43\x46\x20\x3d\x44\x20\x21\x21"
  19.     # "\x21\x0a";
  20.     #
  21.     # $ gcc -c z3f_bday.s
  22.     # $ objdump -d ./z3f_bday.o
  23.     # Disassembly of section .text:
  24.     # 0000000000000000 <main>:
  25.     #    0:   eb 12                   jmp    14 <happy>
  26.     # 0000000000000002 <birthday>:
  27.     #    2:   59                      pop    %rcx
  28.     #    3:   48 31 c0                xor    %rax,%rax
  29.     #    6:   48 31 db                xor    %rbx,%rbx
  30.     #    9:   48 31 d2                xor    %rdx,%rdx
  31.     #    c:   b0 04                   mov    $0x4,%al
  32.     #    e:   fe c3                   inc    %bl
  33.     #   10:   b2 00                   mov    $0x0,%dl
  34.     #   12:   cd 80                   int    $0x80
  35.     # 0000000000000014 <happy>:
  36.     #   14:   e8 e9 ff ff ff          callq  2 <birthday>
  37.     # 0000000000000019 <CAKE>:
  38.     #   19:   7c 2d                   jl     48 <CAKE+0x2f>
  39.     #   1b:   7c 34                   jl     51 <CAKE+0x38>
  40.     #   1d:   70 70                   jo     8f <CAKE+0x76>
  41.     #   1f:   59                      pop    %rcx
  42.     #   20:   20 62 2d                and    %ah,0x2d(%rdx)
  43.     #   23:   44                      rex.R
  44.     #   24:   40 79 20                rex jns 47 <CAKE+0x2e>
  45.     #   27:   48                      rex.W
  46.     #   28:   4b                      rex.WXB
  47.     #   29:   4d 20 3d 44 20 21 21    rex.WRB and %r15b,0x21212044(%rip)        # 21212074 <CAKE+0x2121205b>
  48.     #   30:   21 0a                   and    %ecx,(%rdx)
  49.     #
  50.     # $ gcc z3f_bday.o -o z3f_bday
  51.     # $ ./z3f_bday
  52.     #
  53.     #
  54.      
  55.     .section .text
  56.     .globl main
  57.     main:
  58.             jmp     happy
  59.      
  60.     birthday:
  61.             pop     %rcx
  62.             xorq    %rax, %rax
  63.             xorq    %rbx, %rbx
  64.             xorq    %rdx, %rdx
  65.             movb    $4, %al
  66.             incb    %bl
  67.             movb    $CAKESIZE, %dl
  68.             int     $0x80
  69.      
  70.     happy:
  71.             call    birthday
  72.      
  73.     CAKE:
  74.     .byte   0x7c,0x2d,0x7c,0x34,0x70,0x70,0x59,0x20
  75.     .byte   0x62,0x2d,0x44,0x40,0x79,0x20,0x5a,0x33
  76.     .byte   0x46,0x20,0x3d,0x44,0x20,0x21,0x21,0x21
  77.     .byte   0x0a
  78.      
  79.     CAKESIZE = . - CAKE
Add Comment
Please, Sign In to add comment