Knowing that, I have a follow-up question: Can a virus be made for a
system in a way that acts like an anti-virus? In other words, this
virus would infect computers and instead of causing damage, it would
protect the computer from other viruses?
Yes, once a program gets in it can do pretty much whatever it wants.
If the answer is yes it is possible, could this virus be sophisticated
enough to automatically update its virus definitions? Perhaps an
advanced deep learning algorithm allows this?
Yes, and its not even hard. The AI deep learning part is a bit harder, but still doable.
A lot of viruses spreading is due to users not updating their systems.
Just upload a list of software the computer contains and its version, and download and install the new versions. That and running windows update, apt-get update, zypper dup, or etc for your OS offers a lot of native protection if its ever even used.
After that implementing a firewall for the user, or re-configuring windows firewall would raise the bar even higher.
automatically sandbox know weak programs like web browsers and mail clients.
Download a list of bad IP's and bad behaviors ever day, and doing a black list would offer even more protection.
So the hacker uses a CDN (content distribution network), so you have a main distribution point from a website hosted on a cdn, and that pretty much all you need.
So the program would have a built-in list of IP or website address, and a preset list of files to download.
Said program would wget http://www.goodvirus.com/files.txt
wget http://www.goodvirus.com/blacklists.txt
The files.txt would contain a list of files and versions to download.
If the version is newer than what you have it download the new version.
Your biggest problem and where the AI comes in is problems like specter, melt down, and etc are way hard to detect. Also mitigate has issues, After a few weeks the security will have a patch you can just download and install reboot and your safe.
You have to ask yourself how far this virus is going to go.
An AI which detects, and implements its own solution is going to have to be way smarter. It will takes years to develop and prefect.
However, automated tools from companies already exist, google has sysbotz which throws things at the linux kernel until it breaks. Then said bot compiles a report, and sends it off to the kernel devs for them to fix. More and more of these automated testing platforms are being created and deployed.
More and more smarter testing routines are being developed and tested all the time.
The bigger problem is the difference between program and virus comes down to user consent. Sure your program forcefully propagates every where, but at the end of the day if your program does nothing bad people will willingly allow or install your virus on their computers. Then it's no longer a virus, but a program.