A malware family stores an ASCII-character marker as UTF-16LE, but the YARA rule looks for that marker with an ascii string. Why does the scan miss, and what change makes the marker match?
Select an answer to reveal the explanation.
Short Explanation
You can picture an ASCII word with a blank byte between each character: an ascii string will not match that UTF-16LE layout. Add the wide modifier or use a hex pattern with null bytes between characters; base64, nocase, and replacing the string section with a header check address different issues.
Full Explanation
An ascii string is searched as one byte per character. For this ASCII-character marker, UTF-16LE inserts a zero high byte after each character, and YARA’s wide modifier reproduces that layout. The ascii form therefore does not line up with the bytes on disk, so the scan misses the marker. Add the wide modifier or use a hex pattern that includes the null bytes, and the marker can match. YARA can store text in the strings section, so replacing it with a header check on the claim that YARA cannot store text is unnecessary; a header check answers a different question. Storing the marker as base64 does not make the existing ascii string match: base64 is another encoding, not the byte layout in the file. Adding nocase alone ignores capitalization differences, but does not account for the extra null bytes. The wide modifier is not a general Unicode or UTF-16 encoder; it handles this wide layout for ASCII characters. Wide and ascii can be used together when a family ships both layouts. Exam caveat: nocase does not stand in for wide, and base64 does not describe UTF-16LE. Practical check: add wide, scan the sample again, and confirm the marker matches where the ascii-only rule was silent.