Accounting for endianness has always been one of the more challenging aspects of writing a YARA rule. It’s hard explaining why seeing the MZ header in a hex editor as "4D5A", would need to be referenced as "5A4D" within a YARA condition.
TIL using the "be" equivalent condition (for all bytes), allows us to use the byte sequences as we see them in our hex editors, without needing to swap for endianess, and without impacting performance in any meaningful way, e.g.,
PE: uint16be(0) == 0x4D5A
PDF: uint32be(0) == 0x25504446
Huge thanks to @glesnewich and @stvemillertime for this enlightening moment!
