GDB - see what have accessed the address/break on it

-1

I am trying to overwrite the function vtable:

Here it is done:

Before memcpy

(gdb) x/100x 0xb7993150
0xb7993150:     0xb6eae130      0xb6eae130      0x41414141      0x41414141
0xb7993160:     0x41414141      0x41414141      0x41414141      0x41414141
0xb7993170:     0x00000000      0x00000000      0x00000030      0x00000023
0xb7993180:     0x6c707061      0x74616369      0x2f6e6f69      0x6574636f
0xb7993190:     0x74732d74      0x6d616572      0x00000000      0x0000001b
0xb79931a0:     0x00000001      0x00000001      0xb7993078      0x00000000
0xb79931b0:     0x00000000      0x0000002b      0xb6727688      0xb79931e0
0xb79931c0:     0x00000000      0xb6727678      0xb79931f8      0xb6727678
0xb79931d0:     0xb7993208      0x00000000      0x00000000      0x0000001b
0xb79931e0:     0x00000001      0x00000001      0xb79931b8      0x00000000
0xb79931f0:     0x66657463      0x00000013      0x00000000      0xb79932c8
0xb7993200:     0xb7993218      0x00000013      0x00000000      0xb79932d8
0xb7993210:     0xb79932d8      0x00000013      0xb666ee65      0xb79931f8
0xb7993220:     0xb7993228      0x00000013      0xb66b6971      0xb7993218
0xb7993230:     0xb7993238      0x00000013      0xb6693c11      0xb7993228
0xb7993240:     0xb7993248      0x00000013      0xb669ba79      0xb7993238

after memcpy

0xb7993150:     0x7d000000      0x67337874      0x41414141      0x41414141
0xb7993160:     0x41414141      0x41414141      0x41414141      0x41414141
0xb7993170:     0x99999999      0x42424242      0x42424242      0x42424242
0xb7993180:     0x42424242      0x42424242      0x42424242      0x42424242
0xb7993190:     0x42424242      0x42424242      0x42424242      0x42424242
0xb79931a0:     0x42424242      0x42424242      0x42424242      0x42424242
0xb79931b0:     0x42424242      0x42424242      0x42424242      0x46454443
0xb79931c0:     0x4a494847      0x0000204b      0xe8919cb3      0xb67276b6
0xb79931d0:     0xb7993208      0x00000000      0x00000000      0x0000001b
0xb79931e0:     0x00000001      0x00000001      0xb79931b8      0x00000000
0xb79931f0:     0x66657463      0x00000013      0x00000000      0xb79932c8
0xb7993200:     0xb7993218      0x00000013      0x00000000      0xb79932d8
0xb7993210:     0xb79932d8      0x00000013      0xb666ee65      0xb79931f8
0xb7993220:     0xb7993228      0x00000013      0xb66b6971      0xb7993218
0xb7993230:     0xb7993238      0x00000013      0xb6693c11      0xb7993228
0xb7993240:     0xb7993248      0x00000013      0xb669ba79      0xb7993238
0xb7993250:     0xb7993258      0x00000013      0xb666990d      0xb7993248
0xb7993260:     0xb7993268      0x00000013      0xb665ad61      0xb7993258
0xb7993270:     0xb7993278      0x00000013      0xb66c83b5      0xb7993268
0xb7993280:     0xb7993288      0x00000013      0xb666adad      0xb7993278

How Can I stop/make breakpoint when 0x99999999 is accessed/read as a vtable pointer?

Will just

b *0xb7993170 

work?

gdb
exploit
asked on Stack Overflow Mar 28, 2017 by dev

1 Answer

1

I am trying to overwrite the function vtable:

There is no such thing. Perhaps you mean class vtable?

Will just b *0xb7993170 work?

No. b *0xb7993170 will only work IF 0xb7993170 contains executable code. If it actually contains a vtable (i.e. a pointer to code), you'll want:

awatch *(int**)0xb7993170

Or you can just continue the binary and let it crash when it tries to dereference 0x42424242.

P.S. Given that 0xb7993170 contained 0 before the memcpy, it was certainly not a function pointer (but could still be part of vtable).

You need to set a watch point on the actual pointer location (i.e. 0xb7993170 will not work, you need 0xb7993178 or something like that).

answered on Stack Overflow Mar 29, 2017 by Employed Russian

User contributions licensed under CC BY-SA 3.0