Open hikir1 opened 9 months ago
Note that the offending code is here: https://github.com/redballoonsecurity/ofrak/blob/8fe5083494f7505e3f41c4bdc24f392e7bce0f44/ofrak_core/ofrak/cli/command/unpack.py#L161
The way I see it, there are two problems here:
targets = ()
, and should only be called manually using resource.run
ofrak unpack
command. The fact that we're not, and just pulling strings to use for names/paths from the binary is very problematicWould a simple find and replace for /
characters be sufficient to close this issue?
Running
ofrak unpack -r --gui a.out
leads to crash with errorOfrak makes a file for each item it unpacks. When it encounters a string, it names the file using the value of the string. If the string has slashes in it, such as
/lib64/ld-linux-x86-64.so.2
in the error above, it creates an invalid file name.The solution is to sanitize the string. See line 161 of ofrak_core/ofrak/cli/command/unpack.py
script to reproduce:
Stack trace:
The copy of OFRAK I'm using was cloned from github.