I have a global variable stored in the data section:
data:00007FF7DDBF78E4 00 00 00 00 dword_7FF7DDBF78E4 dd 0
Is there a way to change its value?
Patching in IDA is pretty simple and well documented here and here.
First, you need to make the change by selecting a portion of data in the main view and then use the Edit -> Patch program -> Change word
submenu item. Note that at that point the change was only made to the IDB you're working on and not to the actual binary you loaded.
Before applying the patches made to the original binary, I recommend you review them using the Edit -> Patch program -> Patched bytes
option. To apply the changes, you need to use the Edit -> Patch program -> Apply patches to input file...
. You should probably create a backup (the option's available in the dialog).
Note that this is only possible if the segment you're trying to edit is not a BSS
segment. Executables don't contain data for BSS
segments because BSS
segments are completely initialized to all zeroes by the executable loader.
Note that in earlier versions of IDA the Patch program
submenu was hidden by default and you had to set the DISPLAY_PATCH_SUBMENU
configuration in idagui.cfg
to YES
.