Kontrollierter Buffer Overflow

Dieses Thema im Forum "Programmierung & Entwicklung" wurde erstellt von GodKilla, 11. September 2005 .

Schlagworte:
  1. 11. September 2005
    Hey,

    also ich lerne ben den stack zu exploiten und hab da eben ein kleienr c prog geschrieben:
    Code:
    void function() {
     char buffer1[5];
     int *ret;
    
     ret = buffer1 + 12;
     (*ret) += 15; 
    }
    
     void main() {
     int x;
     x = 0;
     function();
     x = 1;
     printf("%d\n",x);
     }
    
    der Disassemble Code für main:
    Code:
    0x080483a2 <main+0>: push %ebp
    0x080483a3 <main+1>: mov %esp,%ebp
    0x080483a5 <main+3>: sub $0x18,%esp
    0x080483a8 <main+6>: and $0xfffffff0,%esp
    0x080483ab <main+9>: mov $0x0,%eax
    0x080483b0 <main+14>: sub %eax,%esp
    0x080483b2 <main+16>: movl $0x0,0xfffffffc(%ebp)
    0x080483b9 <main+23>: call 0x8048384 <function>
    0x080483be <main+28>: movl $0x1,0xfffffffc(%ebp)
    0x080483c5 <main+35>: mov 0xfffffffc(%ebp),%eax
    0x080483c8 <main+38>: mov %eax,0x4(%esp)
    0x080483cc <main+42>: movl $0x80484f4,(%esp)
    0x080483d3 <main+49>: call 0x80482b0 <_init+56>
    0x080483d8 <main+54>: leave
    0x080483d9 <main+55>: ret
    0x080483da <main+56>: nop
    0x080483db <main+57>: nop
    0x080483dc <main+58>: nop
    0x080483dd <main+59>: nop
    0x080483de <main+60>: nop
    0x080483df <main+61>: nop
    

    also ich möchte die return adresse so manipulieren das es die anweisung "x=1;" uebspringt und zu x ausgeben geht, dh muesste es 0 ausgeben, tuts aber mit dem code oben nicht

    Ich weiss nicht was ich falsch mache... bitte helfen wer helfen kann
     
  2. Video Script

    Videos zum Themenbereich

    * gefundene Videos auf YouTube, anhand der Überschrift.