A trojan horse is a piece of code that is designed to disrupt the typical functioning of a computer system. Infections can spread out quickly and trigger considerable damage to both individual computers and networks. Some infections are harmless, while others can erase files, corrupt data, or even damage hardware.