Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lzma data error on a seemingly problematic squashfs filesystem #652

Open
brainstorm opened this issue Dec 5, 2024 · 2 comments
Open

lzma data error on a seemingly problematic squashfs filesystem #652

brainstorm opened this issue Dec 5, 2024 · 2 comments

Comments

@brainstorm
Copy link

brainstorm commented Dec 5, 2024

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: Gottox/sqsh-tools#298

@wcampbell0x2a
Copy link
Owner

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!

@brainstorm
Copy link
Author

brainstorm commented Dec 5, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants