ReFirmLabs / binwalk

Firmware Analysis Tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Regression. Extraction of ubifs image fails with latest version

frakman1 opened this issue · comments

commented

I can no longer extract ubifs images on the version built from this repo:

  • Binwalk v2.3.3+fa0c0bd

Build steps:
git clone https://github.com/ReFirmLabs/binwalk.git
sudo python setup.py install

Previously, it worked on the version installed via apt-get install on Ubuntu 18:

  • Binwalk v2.1.1

as well as versions in the recent past. I'm not sure when exactly it failed and on what version but sometime in the last few months.

Extraction was performed on the exact same file.

Working (v2.1.1) log:

$ binwalk -v --signature -e ubifs-256k-4096-3390b0-RG.img --directory=binwalk_ubifs

Scan Time:     2022-02-02 11:27:23
Target File:   /home/frak/Downloads/binwalk/cga4336/ubifs-256k-4096-3390b0-RG.img
MD5 Checksum:  1cbb5bcc30ae643a55a521e7243ba3eb
Signatures:    344

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
0             0x0             UBI erase count header, version: 1, EC: 0x0, VID header offset: 0x1000, data offset: 0x2000

$ tree -L 5 binwalk_ubifs/
binwalk_ubifs/
├── _ubifs-256k-4096-3390b0-RG.img-0.extracted
│   ├── 0.ubi
│   └── ubifs-root
│       └── 1302997359
│           └── rootfs
│               ├── bin
│               ├── boot
<cut>

└── _ubifs-256k-4096-3390b0-RG.img.extracted
    ├── 0.ubi
    └── ubifs-root
        └── 1302997359
            └── rootfs
                ├── bin
                ├── boot
<cut>

54 directories, 8 files

Failing (latest version) log:

$ binwalk -v --signature -e ubifs-256k-4096-3390b0-RG.img --directory=binwalk

Scan Time:     2022-02-02 16:26:16
Target File:   /host_dir/cga4336vfs/ubifs-256k-4096-3390b0-RG.img
MD5 Checksum:  1cbb5bcc30ae643a55a521e7243ba3eb
Signatures:    411

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------

WARNING: Extractor.execute failed to run external extractor 'ubireader_extract_files -o 'ubifs-root' '%e'': 'module' object has no attribute 'DEVNULL', 'ubireader_extract_files -o 'ubifs-root' '%e'' might not be installed correctly
0             0x0             UBI erase count header, version: 1, EC: 0x0, VID header offset: 0x1000, data offset: 0x2000

$ tree binwalk
binwalk
|-- _ubifs-256k-4096-3390b0-RG.img-0.extracted
|   `-- 0.ubi
`-- _ubifs-256k-4096-3390b0-RG.img.extracted
    `-- 0.ubi
commented

Update:

When I did a git checkout v2.3.0 and re-installed via sudo python setup.py install, I was able to get it to work.
Strangely, the version returned in the help page shows the version as:

$ binwalk --help

Binwalk v2.2.1+80a519b

but the commit ID checks out.

Then I tried git checkout v2.3.2, reinstalled and that works too.

$ binwalk --help

Binwalk v2.3.2+499019

So it failed somewhere between v2.3.2 and v2.3.3:

image

commented

See #596

I don't have this specific firmware image on hand, but UBI is supported and does extract properly under Binwalk v3:

image_2024-09-22_211609397