Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 645 Vote(s) - 3.47 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to run assembly in gdb directly?

#1
I can use `call` to run c functions ,but how to run assembly or even shell code directly?
Reply

#2
I don't think gdb includes an assembler, so I wouldn't expect to be able to enter assembly directly.

You can use the <code>[shell][1]</code> gdb command to run shell commands:

(gdb) shell uname -m
x86_64



[1]:

[To see links please register here]

Reply

#3
To execute shell code, you can edit a function's contents directly:

(gdb) b foo
Breakpoint 1 at 0x400608
(gdb) run
Breakpoint 1, 0x0000000000400608 in foo ()
(gdb) x/16bx foo
0x400604 <foo>: 0x55 0x48 0x89 0xe5 0x53 0x48 0x81 0xec
(gdb) set ((unsigned char *)foo)[6] = 0x85
(gdb) x/16bx foo
0x400604 <foo>: 0x55 0x48 0x89 0xe5 0x53 0x48 0x85 0xec
(gdb) cont

I don't know how to execute opcodes from within `gdb`, but you can certainly do whatever you want with registers. For instance, instead of `mov %rbx, %rax` you can use `set $rax = $rbx`:

(gdb) p $rax
$1 = 3671197290184
(gdb) set $rax = $rbx
(gdb) p $rax
$2 = 0
(gdb)
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through