Here we provide a definition of malware that highlights the importance of structural and behavioral patterns:
Malware: software that uses planned alteration of structure and behavior of software to serve malicious purposes.
Notice the recursive character of that definition that includes self-modifying malware and also rootkits where a malicious purpose is to conceal.