Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I change EIP in a different process?
    primarykey
    data
    text
    <p>I'm trying to hack another program by changing the EIP of it. There are two programs running, one is the target, that tells where the function that is the "core-function"(e.g. a function that receive a password string as a parameter and returns true or false) is in memory. Then now that I know where the core-function is I wanna modify the EIP with the other program so the target program can call my function and simply get a true out of it and print out a beautiful "access granted".</p> <p>My code is now like this:</p> <p>Target Program:</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; #include &lt;stdlib.h&gt; int checkPwd(char *pwd) { printf("\nstill in the function\n"); if(strcmp(pwd, "patrick") == 0) return true; else return false; } int main() { char pwd[16]; printf("%d", checkPwd); scanf("%s", &amp;pwd); system("pause"); if(checkPwd(pwd)) printf("Granted!\n"); else printf("Not granted\n"); system("pause"); } </code></pre> <p>Attacker Program:</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt; #include &lt;memory.h&gt; int returnTrue() { return true; } int main() { int hex; scanf("%d", &amp;hex); memcpy((void*)hex, (void*)returnTrue, sizeof(char)*8); system("pause"); } </code></pre> <p>I wanna add that I tried to put the hex code directly(without the scanf part) in the attacker program and did not work, it crashed.</p> <p>So I think I'm missing some part of the theory in here. I'd be glad to know what is it.</p> <p>Thanks in advance.</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.
 

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