Bug 1567797 - root permission needed to read globally readable file
Summary: root permission needed to read globally readable file
Alias: None
Product: Fedora
Classification: Fedora
Component: libdasm
Version: rawhide
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Michal Ambroz
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2018-04-16 08:45 UTC by jiri vanek
Modified: 2018-04-17 18:16 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2018-04-17 18:11:54 UTC
Type: Bug

Attachments (Terms of Use)

Description jiri vanek 2018-04-16 08:45:56 UTC

Maybe it is feature, not  a bug, but to disassemble system libraries, one needs to be root, even if the file is globally readable and executable:

 $    ls -l   /bin/das  /usr/lib/libasound.so.2.0.0 
-rwxr-xr-x 1 root root   11328 Apr  3 21:30 /bin/das
-rwxr-xr-x 1 root root 1093988 Nov 14 10:03 /usr/lib/libasound.so.2.0.0

 $    /bin/das  /usr/lib/libasound.so.2.0.0  | head
Error: unable to open file "/usr/lib/libasound.so.2.0.0"

 $     cat    /bin/das  /usr/lib/libasound.so.2.0.0  | head
          @@@%@8	@@@@@@

 $    sudo    /bin/das  /usr/lib/libasound.so.2.0.0  | head
00000000  7f45              jg 0x47
00000002  4c                dec esp
00000003  46                inc esi
00000004  0101              add [ecx],eax
00000006  0100              add [eax],eax
00000008  0000              add [eax],al
0000000a  0000              add [eax],al
0000000c  0000              add [eax],al
0000000e  0000              add [eax],al
00000010  0300              add eax,[eax]

Comment 1 Michal Ambroz 2018-04-17 17:01:12 UTC
It is a bug, fopen is called with parameter "r+b" (read and write, binary) instead of "rb" (read binary).

Comment 2 Michal Ambroz 2018-04-17 18:11:54 UTC
Created pull request upstream to fix this:

Patched also the fedora package in rawhide for next release.
I won't be pushing the update packages now as this is not core or even purpose of libdasm or "das" example application to disassemble whole libraries. The libdasm / das is meant to be used for 32-bit opcode such as snippets of the shellcode / functions etc.

Comment 3 jiri vanek 2018-04-17 18:16:54 UTC
Sure. Thanx!

Note You need to log in before you can comment on or make changes to this bug.