backhand
backhand copied to clipboard
lzma data error on a seemingly problematic squashfs filesystem
I'm seeing a lot of errors while running backhand(-cli) against a Flash memory I dumped from a home router:
% cargo run --bin unsquashfs-backhand squashfs_part1.sqsh
(...)
Failed squashfs-root/usr/lib/libiptext6.so : lzma data error
Failed squashfs-root/usr/lib/libmmdbdtests.so : lzma data error
Failed squashfs-root/usr/lib/libwlctl.so : lzma data error
Failed squashfs-root/usr/lib/libiqctl.so : lzma data error
Failed squashfs-root/usr/lib/libmmdevcallstate.so : lzma data error
Failed squashfs-root/usr/lib/lua/socket/url.lua : lzma data error
(...)
While a lot of files decompress successfully and their contents are legit, a lot of other files are 0-byte sized, i.e:
% ls -alh squashfs-root/bin
total 0
drwxr-xr-x 60 rvalls staff 1.9K Aug 23 2017 .
drwxr-xr-x 20 rvalls staff 640 Sep 25 2017 ..
lrwxr-xr-x 1 rvalls staff 7 Sep 25 2017 ash -> busybox
lrwxr-xr-x 1 rvalls staff 7 Sep 25 2017 base64 -> busybox
-rw-r--r-- 1 rvalls staff 0 Dec 5 15:30 board_detect
-rw-r--r-- 1 rvalls staff 0 Dec 5 15:30 busybox
lrwxr-xr-x 1 rvalls staff 7 Sep 25 2017 cat -> busybox
I've tried other tools before such as unsquashfs, sasquatch and sqsh-tools, but none of them handle this filesystem particularly well, perhaps yours yields the most output though...
Here's the full context and how to obtain (and slice) the aforementioned squashfs_part1.sqsh file if you are curious: https://github.com/Gottox/sqsh-tools/issues/298
You can use RUST_LOG=trace to see even more output..
Does this device boot? If so, you need to read the datasheet to fixup from the oob regions.. I think some readers have knowledge about the regions, but they can be costly.
You can at least see if all the corrupted blocks are in one region!
Yes, it does boot! I used my FlashCat to dump the firmware... I'll see if there's some guidance about OOB there too.
Thanks for the suggestions! I'll read the datasheet (closest to actual model Micron_MT29F1G08ABAEA).
I also ran the following:
$ export NO_COLOR=1
$ rm -rf squashfs-root && RUST_LOG=trace cargo run --bin unsquashfs-backhand squashfs_part1.sqsh >& trace.log && zip trace.log.zip trace.log
Let me know if you spot something interesting in it, I'll take a peek at it too: trace.log.zip