2

Is it possible to change the value of a local var within Radare2? I'm practicing with ESIL feature and now I want to set the value of local variable userInput:

[0x080484e6]> afvd
var userInput = 0x00177ffc  0x00000000  .... eflags
var var1 = 0x00177ff8  0x00000246  F...
var var2 = 0x00177ff4  0x00052b24  $+.. 

I wasn't able to catch this information from the documentation. Eventually, is it possible do the same thing while debugging the binary (-d)?

3

Sadly there's no such feature in radare2 yet.

Remember, though, that at the end these variables are data that you can manipulate by manually editing them. Thus, you can modify their value (with some restrictions of course) to meet your needs.

For example, let's see the result of afvd in some random function of a binary:

[0x00400637]> afvd
var local_10h = 0x7ffffa0c1870  0x00007ffffa0c1960   `....... r13 stack R W 0x1 -->  rdi

We have only one variable, local_10h which is located at rbp - 0x10:

[0x00400637]> afvd local_10h
pxr $w @rbp-0x10

Now, let's modify rbp-0x10 to be "ABCD":

[0x00400637]> wx 41424344 @ rbp-0x10
[0x00400637]> afvd
var local_10h = 0x7ffffa0c1870  0x00007fff44434241   `ABCD... r13 stack R W 0x1 -->  rdi

So this is a way to manipulate a value of a variable.


radare2 is an Open-Source project with great community and developers, feel free to open an issue, or even better, propose a pull-request so we all can benefit from this feature.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.