db, dc, dd, dq (read virtual memory)
Description of 'db, dc, dd, dq' commands in HyperDbg.
Command
db : read memory as Byte values and ASCII characters
dc : read memory as Double-word values (4 bytes) and ASCII characters
dd : read memory as Double-word values (4 bytes)
dq : read memory as Quad-word values (8 bytes)
Syntax
db [Address (hex)] [l Length (hex)] [pid ProcessId (hex)]
dc [Address (hex)] [l Length (hex)] [pid ProcessId (hex)]
dd [Address (hex)] [l Length (hex)] [pid ProcessId (hex)]
dq [Address (hex)] [l Length (hex)] [pid ProcessId (hex)]
Description
Shows the virtual address memory content in hex form.
Parameters
[Address (hex)]
The virtual address of where we want to read its memory.
[l Length (hex)] (optional)
The length (byte) in hex format.
[pid ProcessId (hex)] (optional)
The Process ID in hex format that we want to see the memory from its context (cr3).
If you don't specify the pid, then the default pid is the current process (HyperDbg) process layout of memory.
In the Debugger Mode, the pid (parameter) is ignored. If you want to view another process memory, use the '.process' command to switch to another process memory layout.
Examples
The following command is used when we want to read the content of memory at nt!Kd_DEFAULT_Mask
with length of 0x50
from the memory layout view of process (4
a.k.a. system process) in a hex byte format.
The following command is used when we want to read the content of memory at nt!Kd_DEFAULT_Mask+@rax+10
with length of 0x30
from the memory layout view of process (4
a.k.a. system process) in a hex byte format.
Note that @rax
is 0x10 in this case.
The following command is used when we want to read the content of memory at fffff800`3ad6f010
with length of 0x50
from the memory layout view of process (4
a.k.a. system process) in a hex byte format.
The following example shows the content of memory at fffff800`3ad6f010
from current process layout in a Double-word value (4 bytes) and ASCII characters format.
The following example shows the content of memory at fffff800`3ad6f010
from current process layout in a Double-word values (4 bytes) format with the length of 0x10
.
The following example shows the content of memory at fffff800`3ad6f010
from current process layout in a Quad-word values (8 bytes) format.
IOCTL
This function works by calling DeviceIoControl with IOCTL = IOCTL_DEBUGGER_READ_MEMORY
, you have to send it in the following structure.
Where Pid
is the process id, Address
is the target location address and size
is the length of the byte(s) that you need to read.
MemoryType
is either virtual or physical.
ReadingType
is either from the kernel or from the vmx-root. Currently, only the reading from the kernel is implemented.
If you don't want to read from the kernel directly, use the following HyperDbg Routine.
The above function fills the IOCTL structure and shows the memory content. It is also able to disassemble the memory. You can specify one of the following styles
to show the memory.
For disassembling, use the DEBUGGER_SHOW_COMMAND_DISASSEMBLE
as the Style
.
In the debugger mode, HyperDbg uses the exact same structure, you should send the above structure over serial to the debuggee which is paused in vmx-root mode.
You should send the above structure with DEBUGGER_REMOTE_PACKET_REQUESTED_ACTION_ON_VMX_ROOT_READ_MEMORY
as RequestedAction
and DEBUGGER_REMOTE_PACKET_TYPE_DEBUGGER_TO_DEBUGGEE_EXECUTE_ON_VMX_ROOT
as PacketType
.
In return, the debuggee sends the above structure with the following type.
The following function is responsible for sending reading memory in the debugger.
Remarks
If you don't specify the length, the default length for HyperDbg is 0x80 Bytes.
Please note that you should specify a space between 'l' and the length in HyperDbg. For example, 'l10' is invalid, but 'l 10' is valid. (It's opposed to windbg).
This command is guaranteed to keep debuggee in a halt state (in Debugger Mode); thus, nothing will change during its execution.
Requirements
None
Related
Last updated