onekey-sec / unblob

Extract files from any kind of container formats
https://unblob.org
Other
2.11k stars 80 forks source link

OverflowError in squashfs seek #764

Closed AndrewFasano closed 5 months ago

AndrewFasano commented 5 months ago

With the current head of unblob trying to extract this filesystem: https://support.dlink.com/resource/products/DES-1210-28P/REVA/DES-1210-28P_REVA_FIRMWARE_2.00.011.ZIP

Produces this unhandled error:

2024-02-13 19:43.51 [error    ] Unhandled Exception during chunk calculation handler=squashfs_v4_le pid=39 severity=<Severity.ERROR: 'ERROR'> start_offset=0x12d621
Traceback (most recent call last):
  File "/unblob/unblob/finder.py", line 35, in _calculate_chunk
    return handler.calculate_chunk(file, real_offset)
  File "/unblob/unblob/handlers/filesystem/squashfs.py", line 61, in calculate_chunk
    file.seek(end_of_data_offset)
  File "/unblob/unblob/file_utils.py", line 64, in seek
    super().seek(pos, whence)
OverflowError: Python int too large to convert to C ssize_t

Unblob does still seem to extract a good-looking root filesystem at DES-1210-28P_REVA_FIRMWARE_2.00.011.ZIP_extract/des121028P_FW_200011/DES-1210-28P_A1_FW_v2.00.011.hex_extract/1179520-6188928.squashfs_v3_extract/, but I figured this was still a bug worth noting.

I've just been assuming each unique Unhandled Exception is worth opening an issue over - if that's not the case, let me know and I'll stop opening these.

qkaiser commented 5 months ago

I've just been assuming each unique Unhandled Exception is worth opening an issue over - if that's not the case, let me know and I'll stop opening these.

Keep'em coming !

qkaiser commented 5 months ago

Triggered by a false positive:

dd if=/tmp/sample.bin bs=1 skip=$((0x12d621)) | hx | more
00000000  68 73 71 73 71 73 68 71  73 68 73 68 73 71 73 0f  |hsqsqshqshshsqs.|
00000010  8e 07 c0 53 8e 07 c0 8e  8e 07 c0 ae 04 00 00 4c  |...S...........L|
00000020  2b 13 c0 40 25 13 c0 fc  44 13 c0 a2 8e 07 c0 f5  |+..@%...D.......|
00000030  8e 07 c0 3c 8f 07 c0 8f  8f 07 c0 d6 8f 07 c0 27  |...<...........'|
00000040  90 07 c0 ff 07 00 00 c4  bc 24 c0 e0 4a 26 c0 55  |.........$..J&.U|
00000050  90 07 c0 88 90 07 c0 bf  90 07 c0 f4 90 07 c0 25  |...............%|
00000060  91 07 c0 61 91 07 c0 9b  91 07 c0 d1 91 07 c0 10  |...a............|
00000070  bd 24 c0 0b 40 e0 e3 f0  00 9a e5 4e ef fe eb a0  |.$..@......N....|
00000080  00 9a e5 4c ef fe eb 88  00 9a e5 4a ef fe eb 98  |...L.......J....|