You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 15, 2024. It is now read-only.
Let's try to overwrite it in gdb. For this, you need to do the same as above in the exploitation of vulnerability:
1125
+
1126
+
1. Determine the function that is similar to system() or execve() and in which program puts the arguments that you can control.
1127
+
2. Determine the address of the system or execve.
1128
+
3. Specify the address within GOT table.
1129
+
4. Overwrite it with the address of the system or execve.
1130
+
1131
+
### Determine the function as a target
1132
+
1133
+
In my program `got-overwrite.c`, you can find the place where it takes another output interactively in another buffer `buff2`. So, the printf is a nice candidate for overwriting within GOT table. But here the problem - the address of printf within GOT is placed above the address of puts. So, if you will overwrite printf, you also overwrite the next 2 bytes of puts address and it will not allow you to exploit the program. Thus, you also need to overwrite the puts address with it.
1134
+
1135
+
### Determine the address of system or execve
1136
+
1137
+
In gdb:
1138
+
```bash
1139
+
gef➤ print system
1140
+
$1 = {<text variable, no debug info>} 0xf7e02830 <system>
1141
+
```
1142
+
1143
+
So, this is the address which you will write in GOT.
1144
+
1145
+
### Specify the address within GOT table
1146
+
1147
+
Let's try to exploit it without overwriting puts. I'll not specify how to determine the address and direct parameter number, you can do it yourself.
Here, you see that the printf now has another address, but `puts` has too. That's why you need the next overwrite.
1181
+
1182
+
### Overwrite it with the address of the system
1183
+
1184
+
Now, after the first write in GOT, do next write. I can't show you all output, because the format string just places the large empty space between the command and result:
0 commit comments