Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wen Does nothing #16210

Closed
sab24 opened this issue Mar 13, 2020 · 4 comments
Closed

wen Does nothing #16210

sab24 opened this issue Mar 13, 2020 · 4 comments

Comments

@sab24
Copy link

sab24 commented Mar 13, 2020

Hi,

Running wen in r2 should insert num null bytes at current offset. It does nothing when running the commands. All commands in we do nothing. This is on Linux

Work environment

Questions Answers
OS/arch/bits (mandatory) Linux Archlinux x86_64
File format of the file you reverse (mandatory) ELF
Architecture/bits of the file (mandatory) x86/64
r2 -v full output, not truncated (mandatory) radare2 4.4.0-git 23959 @ linux-x86-64 git.4.3.1-39-g247b28731
commit: 247b287 build: 2020-03-13__09:56:17

Expected behavior

wen to expand a few bytes so hex code can be inserted without overwriting code

Actual behavior

No changes in the binary, no increase in file size

Steps to reproduce the behavior

$ r2 -v
radare2 4.4.0-git 23959 @ linux-x86-64 git.4.3.1-39-g247b28731
commit: 247b2873199143f767ecf8892f23ff35bbfbbc9c build: 2020-03-13__09:56:17
$ r2 ./hi
[0x00400078]> oo+
[0x00400078]> aa
[x] Analyze all flags starting with sym. and entry0 (aa)
[0x00400078]> pdf
            ;-- rip:
/ 45: entry0 ();
|           ; var int64_t var_4h @ rsp+0x4
|       ,=< 0x00400078      eb0e           jmp 0x400088
..
|       |   ; CODE XREF from entry0 @ 0x400078
|       `-> 0x00400088      50             push rax
|           0x00400089      bf01000000     mov edi, 1
|           0x0040008e      488d359d0000.  lea rsi, [0x00400132]       ; "Hello!\n"
|           0x00400095      ba07000000     mov edx, 7
|           0x0040009a      e819000000     call fcn.004000b8
|           0x0040009f      31ff           xor edi, edi
|           0x004000a1      89442404       mov dword [var_4h], eax
|           0x004000a5      e85e000000     call fcn.00400108
|           0x004000aa      31c9           xor ecx, ecx
|           0x004000ac      890424         mov dword [rsp], eax
|           0x004000af      89c8           mov eax, ecx
|           0x004000b1      59             pop rcx
\           0x004000b2      c3             ret
[0x00400078]> px
- offset -   0 1  2 3  4 5  6 7  8 9  A B  C D  E F  0123456789ABCDEF
0x00400078  eb0e 662e 0f1f 8400 0000 0000 0f1f 4000  ..f...........@.
0x00400088  50bf 0100 0000 488d 359d 0000 00ba 0700  P.....H.5.......
0x00400098  0000 e819 0000 0031 ff89 4424 04e8 5e00  .......1..D$..^.
0x004000a8  0000 31c9 8904 2489 c859 c30f 1f44 0000  ..1...$..Y...D..
0x004000b8  897c 24fc 4889 7424 f089 5424 ec8b 4424  .|$.H.t$..T$..D$
0x004000c8  fc89 4424 dc48 8b4c 24f0 4889 4c24 d08b  ..D$.H.L$.H.L$..
0x004000d8  4424 ec89 4424 cc8b 7c24 dc48 8b74 24d0  D$..D$..|$.H.t$.
0x004000e8  8b54 24cc b801 0000 000f 0548 8944 24e0  .T$........H.D$.
0x004000f8  488b 4424 e089 4424 c88b 4424 c8c3 6690  H.D$..D$..D$..f.
0x00400108  897c 24fc 8b44 24fc 8944 24ec 8b7c 24ec  .|$..D$..D$..|$.
0x00400118  b83c 0000 000f 0548 8944 24f0 488b 4424  .<.....H.D$.H.D$
0x00400128  f089 4424 e88b 4424 e8c3 4865 6c6c 6f21  ..D$..D$..Hello!
0x00400138  0a00 ffff ffff ffff ffff ffff ffff ffff  ................
0x00400148  ffff ffff ffff ffff ffff ffff ffff ffff  ................
0x00400158  ffff ffff ffff ffff ffff ffff ffff ffff  ................
0x00400168  ffff ffff ffff ffff ffff ffff ffff ffff  ................
[0x00400078]> r
490
[0x00400078]> r+10
[0x00400078]> r
500
[0x00400078]> 0x0040009f
[0x0040009f]> wen 10
[0x0040009f]> r
500
[0x0040009f]> pdf
            ;-- rip:
/ 45: entry0 ();
|           ; var int64_t var_4h @ rsp+0x4
|       ,=< 0x00400078      eb0e           jmp 0x400088
..
|       |   ; CODE XREF from entry0 @ 0x400078
|       `-> 0x00400088      50             push rax
|           0x00400089      bf01000000     mov edi, 1
|           0x0040008e      488d359d0000.  lea rsi, [0x00400132]       ; "Hello!\n"
|           0x00400095      ba07000000     mov edx, 7
|           0x0040009a      e819000000     call fcn.004000b8
|           0x0040009f      31ff           xor edi, edi
|           0x004000a1      89442404       mov dword [var_4h], eax
|           0x004000a5      e85e000000     call fcn.00400108
|           0x004000aa      31c9           xor ecx, ecx
|           0x004000ac      890424         mov dword [rsp], eax
|           0x004000af      89c8           mov eax, ecx
|           0x004000b1      59             pop rcx
\           0x004000b2      c3             ret
[0x0040009f]> px
- offset -   0 1  2 3  4 5  6 7  8 9  A B  C D  E F  0123456789ABCDEF
0x0040009f  31ff 8944 2404 e85e 0000 0031 c989 0424  1..D$..^...1...$
0x004000af  89c8 59c3 0f1f 4400 0089 7c24 fc48 8974  ..Y...D...|$.H.t
0x004000bf  24f0 8954 24ec 8b44 24fc 8944 24dc 488b  $..T$..D$..D$.H.
0x004000cf  4c24 f048 894c 24d0 8b44 24ec 8944 24cc  L$.H.L$..D$..D$.
0x004000df  8b7c 24dc 488b 7424 d08b 5424 ccb8 0100  .|$.H.t$..T$....
0x004000ef  0000 0f05 4889 4424 e048 8b44 24e0 8944  ....H.D$.H.D$..D
0x004000ff  24c8 8b44 24c8 c366 9089 7c24 fc8b 4424  $..D$..f..|$..D$
0x0040010f  fc89 4424 ec8b 7c24 ecb8 3c00 0000 0f05  ..D$..|$..<.....
0x0040011f  4889 4424 f048 8b44 24f0 8944 24e8 8b44  H.D$.H.D$..D$..D
0x0040012f  24e8 c348 656c 6c6f 210a 00ff ffff ffff  $..Hello!.......
0x0040013f  ffff ffff ffff ffff ffff ffff ffff ffff  ................
0x0040014f  ffff ffff ffff ffff ffff ffff ffff ffff  ................
0x0040015f  ffff ffff ffff ffff ffff ffff ffff ffff  ................
0x0040016f  ffff ffff ffff ffff ffff ffff ffff ffff  ................
0x0040017f  ffff ffff ffff ffff ffff ffff ffff ffff  ................
0x0040018f  ffff ffff ffff ffff ffff ffff ffff ffff  ................

hi.zip

@karliss
Copy link
Contributor

karliss commented Mar 13, 2020

Did you opened the file in write mode?

@sab24
Copy link
Author

sab24 commented Mar 14, 2020

Did you opened the file in write mode?

Hi karliss, Yes the file is opened in write mode. I will update the issue with all commands

@karliss
Copy link
Contributor

karliss commented Mar 14, 2020

Please fill out all the data requested in issue template and list all the steps including command you use for opening the binary.

@sab24
Copy link
Author

sab24 commented Mar 14, 2020

Please fill out all the data requested in issue template and list all the steps including command you use for opening the binary.

Done, don't know why I did not see the template before when creating the issue.

@radare radare added this to the 4.4.0 - pangolin milestone Mar 14, 2020
@radare radare closed this as completed in a52506a Apr 8, 2020
Emi1305 pushed a commit to Emi1305/radare2 that referenced this issue Jul 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants