A friendly virus is malware that is designed to be helpful in some way rather than destructive or annoying, as is typically the case with conventional viruses. A friendly virus might, for example, patch vulnerabilities but otherwise behave in similar ways to other viruses, accessing targets without user consent or awareness and carrying out its agenda surreptitiously.
Friendly viruses are often disseminated by cyber vigilantes who see a need for greater security in some system that is not being adequately protected by conventional measures. Friendly viruses and ethical worms have included malware designed to address vulnerabilities in various systems including internet of things (IoT) devices and environments and industrial control systems (ICS) as well as computing platforms and operating systems.
The concern of security vigilantes is well-founded. Throughout the history of computer technology, security has too often been an afterthought. However, there are a number of concerns with even the best-intentioned and most effective ethical malware. Even if they propagate flawlessly and install patches effectively, ethical worms could close a security hole that a particular application needs in order to function properly.
Examples of friendly viruses include: Wifatch, an ethical worm designed to harden Linux-based routers by shutting down potentially vulnerable Telnet ports and prompting users to change passwords, and the Hajime IoT worm, which disables default ports on IoT devices but leaves behind some of its functionality, which could be exploited by a less ethical hacker.
The friendly virus term came to security from medicine, where they have been found to infest and eliminate potentially harmful bacteria.