Skip to content

Conversation

@qkaiser
Copy link
Contributor

@qkaiser qkaiser commented Jun 9, 2022

We observed a sample from Cisco where the CRC value was stored in a different endianness. This is non standard but we decided to support it anyway.

We also added a check for old cramfs format. If it's an old format, the CRC check always returns true because it's not supported.

More information about CRC validation and old format: https://github.com/secularbird/cramfs/blob/master/cramfsck.c

Closes #394

@qkaiser qkaiser self-assigned this Jun 9, 2022
@martonilles
Copy link
Contributor

can we somehow identify those firmware and just disable in those cases?

@qkaiser
Copy link
Contributor Author

qkaiser commented Jun 9, 2022

can we somehow identify those firmware and just disable in those cases?

We actually need to keep the crc check, it was an endianness issue: computed_crc=0x3af2f56e header_crc=0x6ef5f23a

@qkaiser qkaiser force-pushed the 394-disable-cramfs-crc branch from 8049137 to 724f7f5 Compare June 9, 2022 14:19
@qkaiser qkaiser changed the title Remove cramfs CRC check. Improve cramfs CRC check Jun 9, 2022
Copy link
Contributor

@martonilles martonilles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be possible to add cases for this in the integration tests?

  • swapped crc
  • omitted crc

@qkaiser qkaiser force-pushed the 394-disable-cramfs-crc branch from 724f7f5 to e49c817 Compare June 9, 2022 14:52
@qkaiser
Copy link
Contributor Author

qkaiser commented Jun 9, 2022

I added test cases, putting this here for future reference:

dd if=fruits.cramfs_be bs=1 skip=32 count=4 of=crc.bin conv=swab
cp fruits.cramfs_be fruits.crc_swap.cramfs_be
dd if=crc.bin of=fruits.crc_swap.cramfs_be bs=1 skip=32 count=4 conv=notrunc

Don't know why people call it "disk destroyer" :(

@qkaiser qkaiser force-pushed the 394-disable-cramfs-crc branch 2 times, most recently from da5b9bc to 51fad30 Compare June 9, 2022 15:08
We observed a sample from Cisco where the CRC value was stored in a
different endianness. This is non standard but we decided to support it
anyway.

We also added a check for old cramfs format. If it's an old format, the
CRC check always returns true because it's not supported.

More information about CRC validation and old format:
https://github.com/secularbird/cramfs/blob/master/cramfsck.c
@qkaiser qkaiser force-pushed the 394-disable-cramfs-crc branch from 51fad30 to 32320fd Compare June 9, 2022 15:08
@qkaiser
Copy link
Contributor Author

qkaiser commented Jun 9, 2022

would it be possible to add cases for this in the integration tests?

  • swapped crc
  • omitted crc

Created test cases for both situations.

@martonilles martonilles merged commit 266266c into main Jun 9, 2022
@martonilles martonilles deleted the 394-disable-cramfs-crc branch June 9, 2022 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disable cramfs CRC check

4 participants