ReFirmLabs / binwalk

Firmware Analysis Tool
MIT License
10.97k stars 1.55k forks source link

Extract with docker broken on master branch #703

Open Flo354 opened 5 hours ago

Flo354 commented 5 hours ago

Hello,

The docker image doesn't work with the "-e" argument. It is working perfectly with tag "version-2.3.4"

<> docker run -it --rm -v "$(pwd):/home/appuser" refirmlabs/binwalk -e "file.bin"
[2024-10-19T13:43:56Z ERROR binwalk::binwalk] Failed to create symlink /home/appuser/extractions/file.bin -> /home/appuser/file.bin: Permission denied (os error 13)
thread 'main' panicked at src/main.rs:81:6:
Binwalk initialization failed: BinwalkError
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[1]    76653 exit 101   docker run -it --rm -v "$(pwd):/home/appuser" refirmlabs/binwalk -e 
devttys0 commented 4 hours ago

From the permission denied error, it looks like a file permission problem; specifically, the user ID in the docker container (1337 by default) does not have write access to your $PWD.

You can check this by making $PWD /tmp, which is writable by everyone, and running the same command:

cp file.bin /tmp/file.bin
cd /tmp
sudo docker run -it --rm -v "$(pwd):/home/appuser" refirmlabs/binwalk -e "file.bin"

You could also instruct docker to use the root user instead, with the -u 0 argument:

sudo docker run -it -u 0 --rm -v "$(pwd):/home/appuser" refirmlabs/binwalk -e "file.bin"
aioue commented 1 hour ago

Adjacent issue, solved by sudo su - on mac, and then running:

# docker run -it -u 0 --rm -v "$(pwd):/home/appuser" refirmlabs/binwalk:version-2.3.4 --run-as=root -Me "BIOS.BIN"