radare2 icon indicating copy to clipboard operation
radare2 copied to clipboard

Can't open rarun2 file

Open TWVyY3VyaW8K opened this issue 8 years ago • 7 comments

I got a problem using rarun2 files on Fedora 27: everytime i try r2 output is "permission denied". It isn't a problem of permissions, if i run r2 with sudo command output is the same. Also if i try to run r2 -e dbg.profile = blabla.rr2 (without specify filename in the commandline) radare2 doesn't open.

Work environment

Questions Answers
OS/arch/bits (mandatory) Fedora 27 x86-x64
File format of the file you reverse (mandatory) ELF
Architecture/bits of the file (mandatory) x86/32
r2 -v full output, not truncated (mandatory) radare2 2.5.0-git 17615 @ linux-x86-64 git.2.4.0-96-gea69b7056 commit: ea69b705682314facde1fdb60a1a0a8d36fe6d90 build: 2018-03-13__23:20:07

Expected behavior

it should run with blabla.rr2 parameters

Actual behavior

[0x08048320]> ood Could not execvp: Permission denied r_core_file_reopen: Cannot reopen file: dbg:///home/Mercurio/Documenti/CTFs/Root_me/blabla.rr2 with perms 0x0007, attempting to open read-only.

Steps to reproduce the behavior

  • r2 ch18.bin -e dbg.profile = blabla.rr2
  • ood

blabla.rr2: blabla.zip

TWVyY3VyaW8K avatar Mar 13 '18 22:03 TWVyY3VyaW8K

Somehow it doesn't escape whitechars:

> r2 /bin/ls -e dbg.profile=blabla.rr2
 -- Warning, your trial license is about to expire.
[0x00005bc0]> e dbg.profile
blabla.rr2
[0x00005bc0]> quit

> r2 /bin/ls -e dbg.profile = blabla.rr2



 -- Initial frame selected; you cannot go up.
[0x00005bc0]> e dbg.profile

[0x00005bc0]>

It should be easy to fix.

leberus avatar Mar 14 '18 06:03 leberus

Having Radare 2.50 on fedora 27 as well. The issue seem really about the whitespaces in the rarun2 file - looking on some examples and past bug reports I tend to say it is rather feature then a bug.

This works: program=/bin/ls

image

This doesnn't work: program = /bin/ls

image

  1. Please can you show us what are the permissions on the file you are having (ch18.bin/ch1.bin) ?

  2. Are you trying to run ch18.bin as you have on radare2 commandline or are you trying to run the ch1.bin as you have it in the rarun2 profile? If ch18.bin ... then I guess the program in a profile should not be defined AND the program on the radare2 commandline should be the last parameter like: radare2 -e dbg.profile=blabla.rr2 ch18.bin

See https://github.com/radare/radare2/issues/3951 for more examples/explanation.

xambroz avatar Mar 14 '18 19:03 xambroz

1. [Mercurio@localhost Root_me]$ ls -la ch18.bin -rwxrwxr-x. 1 Mercurio Mercurio 5240 13 mar 21.10 ch18.bin [Mercurio@localhost Root_me]$ ls -la ch1.bin -rwxr-xr-x. 1 Mercurio Mercurio 7339 26 nov 2009 ch1.bin

  1. I tried both: i tried to do r2 ch18.bin -e dbg.profile = blabla.rr2 with program = ch8.bin into rr2 file, and i tried r2 -e dbg.profile = blabla.rr2 with program = ch1.bin. the first one shows "permission denied", the second one doesn't even open radare2

It works without spaces, so if it's a feature it's ok for me.

TWVyY3VyaW8K avatar Mar 14 '18 20:03 TWVyY3VyaW8K

Its not a feature. Do you want to try to make the patch to fix this issue? There’s another issue discussing the same topic iirc

On 14 Mar 2018, at 21:40, Daniele Bianchin [email protected] wrote:

1.[Mercurio@localhost Root_me]$ ls -la ch18.bin -rwxrwxr-x. 1 Mercurio Mercurio 5240 13 mar 21.10 ch18.bin [Mercurio@localhost Root_me]$ ls -la ch1.bin -rwxr-xr-x. 1 Mercurio Mercurio 7339 26 nov 2009 ch1.bin

I tried both: i tried to do r2 ch18.bin -e dbg.profile = blabla.rr2 with program = ch8.bin into rr2 file, and i tried r2 -e dbg.profile = blabla.rr2 with program = ch1.bin. the first one shows "permission denied", the second one doesn't even open radare2 Anyway without spaces it works, so if it's a feature it's ok for me.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

radare avatar Mar 15 '18 00:03 radare

Still the "permission denied" is strange - I do not have any explanation for that one. Please @Daniele-B could you try running with "strace r2 -e dbg.profile = blabla.rr2" to see access to which file si being denied.

Also would you consider trying with the rpm build for Fedora whether the issue would be the same? Here is RPM for the today's commit :100: https://copr-be.cloud.fedoraproject.org/results/rebus/infosec-rebus/fedora-27-x86_64/00728012-radare2/ https://copr-be.cloud.fedoraproject.org/results/rebus/infosec-rebus/fedora-27-x86_64/00728012-radare2/radare2-2.5.0-0.1.git38d3d36.fc27.x86_64.rpm https://copr-be.cloud.fedoraproject.org/results/rebus/infosec-rebus/fedora-27-x86_64/00728012-radare2/radare2-devel-2.5.0-0.1.git38d3d36.fc27.x86_64.rpm

xambroz avatar Mar 15 '18 01:03 xambroz

@radare I don't have knowledge about radare internals, so i'd prefer not

@xambroz i attacched the output on this message cause its big. Here is: ch1.log I've updated Fedora at the lastest version today and the output still the same. "permissions denied" shows only when i add filename on commandline and i type ood on radare2 shell.

TWVyY3VyaW8K avatar Mar 15 '18 22:03 TWVyY3VyaW8K

Interesting - in the strace we can see that some directories are not where it should be, but nothing about permission denied. Possibly it could be in some sub-process. Please can you try with the "-f" option to strace to follow also on the forked processes?

Something like: strace -f r2 -e dbg.profile = blabla.rr2 strace -f r2 -e dbg.profile = blabla.rr2 2>&1 | grep -i -E "open|perm"

xambroz avatar Mar 21 '18 05:03 xambroz