Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>My initial guess was to modify the return address, the eip, of the function in order to locate and execute what is in the shellcode file, but i realized I have no address to the file I can represent in a hexadecimal value.</p> </blockquote> <p>You want to modify the RET address so that when the function ends it doesn't return to its caller but to the beginning of your shellcode.</p> <p>((As a brief overview of what a shellcode is, it's a set of assembly instructions (so heavily dependent on the platform you execute the vulnerable process) that execute a shell (usually a root shell) thus dropping you off in a nice environment that you can exploit.))</p> <p>Now back, what you want is to point the RET at the first assembly instruction in your shellcode. The weird bit is that you have it in a separate file. Is that required?</p> <p>How it's usually done is that you have something like this:</p> <pre><code>char shellcode[] = "\x90\x90\x90..."; int main() { /* * huge string (like your 72 A's) that appends the address of the * shellcode at the right address (in your case I think it's 64 + 4) */ char evilstring[100]; /* Fill the buf and the EBP with A's */ for (int i = 0; i &lt; 64 + 4; i++) { evilstring[i] = 'A'; } /* And the RET with the address of your shellcode */ sprintf(&amp;evilstring[68], "%p", &amp;shellcode[0]); vuln(evilstring); /* you should have a shell now */ /* NOTREACHED */ return 0; } </code></pre> <p>So now, when your function returns, it returns at the address of the shellcode[] string and it continues executing instructions from there. Which is what you want. Because those instructions give you the root shell (or whatever it is that your shellcode does).</p> <p>Please note that the above is just example code, it's not even compile tested.</p> <p>If I didn't understand your problem or if I didn't explain well enough, please feel free to ask.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload