Since a computer virus isn't much different being code at the core, you could very likely build a self-replicating contract that can auto-execute other functions. Ethereum contracts are essentially autonomous agents that can perform many functions.
Wouldn't that be very expensive in terms of ether fees? As I understand Ethereum favours short programs because it charges fees per executed line of code.
https://github.com/ethereum/wiki/wiki/%5BEnglish%5D-White-Paper#wiki-fees