Are there any (known) viruses for CP/M? Chronologically, CP/M machines fit into the time period of the first home computer viruses, starting with other 8-bit computers.

Given the hardware independence, CP/M viruses could have spread quite successfully, and thinking about possible mechanism, a virus that attaches itself to an executable, runs when the executable is executed, infects a random file and then jumps to the real code is very well within technical possibilities. Even hiding the virus could be well supported by existing block padding of the filesystem.

OTOH, bootable viruses are probably out of question, if we want to go beyond one architecture.

I am taking the definition of "virus" quite broadly here - trojans and worms are included, and of course trojans are perfectly possible under any OS.

The question asks primarily about "classic" CP/M or MP/M, but CP/M-86 and other examples would be welcome, too (I imagine that technically a CP/M-86 virus would be doable in much the same way as the MS-DOS ones were).

I tried an extensive network search but came up with exactly nothing.

  • 1
    Writing a proof of concept CP/M virus looks like a nice project. However, I don't think spreading would have worked easily - a typical workflow was to have one "system" floppy disk, one "data" floppy disk, and "system" disks were created by manual copying. So while a virus would have infected other executables on the system disk, it would have only spread to other disks if this disk was copied. Also, accesses to the "wrong" disk are quite noticeable.
    – dirkt
    Commented Feb 22, 2019 at 11:23
  • I did not use CP/M, but I was under the impression pirating of the system was rampant? If so, that seems like the obvious vector. Commented Feb 22, 2019 at 21:14
  • Most early viruses (eg. for the Apple II, which had similar floppy disk based work environment) affected the boot process in some way. As you say that would limit a CP/M virus to just one particular CP/M implementation since they there wasn't a common boot environment for CP/M. By the time people were making viruses that could infect executables, CP/M was pretty much obsolete and uninteresting to hackers. So it wouldn't surprise me if there were few or even no CP/M viruses.
    – user722
    Commented Feb 22, 2019 at 21:47
  • Malware was a definite concern, but I don't remember viruses, spreading from one computer to another, being much of an issue. Communication programs such as XModem would not allow you to transfer executable programs by their name. E.g. "newprog.exe" would have to be called something like "newprog.ex_" before it could be ran. This placed the full onus on running a harmful program on the downloader, because he would have to manually rename it first.
    – RichF
    Commented Feb 23, 2019 at 2:45
  • 1
    Its possible but with very little gain. Computers were basically islands then not interchanging much data. Commented Feb 23, 2019 at 7:47

2 Answers 2


In this 1993 USENET thread, two people claim to have written simple proof-of-concept viruses for CP/M. Since by their account these were programming exercises, it is unlikely that they ever left their authors' computers.


CP/M viruses could have spread quite successfully

I doubt about that:

A virus cannot infect every kind of file format but only files that contain code:

  1. Executable files
  2. Other files that contain any kind of code (e.g. macros in office documents)
  3. File formats that can be manipulated in a way that an error happens when opening the file which causes the computer to execute some code - for example by forcing a buffer overflow

In the 1970s and 1980s, file types that match criteria (2) and (3) were not used very often (if they existed at all) so a virus could only have spread using executable files.

While home computer users were exchanging executable files (illegally copied games!) very frequently, I doubt that professional users (using CP/M) were exchanging executable files.


After having read the comments, I'd like to extend my answer a bit:

Back in the times when computers had no network/modem/internet/... access, viruses could only spread widely in the following scenario:

  • Some user starts an infected CP/M program
  • The virus infects other CP/M programs on the user's computer
  • The user gives some of these CP/M programs to a second user
  • The second user gives some infected CP/M programs to a third user
  • The third user gives some infected CP/M programs to a fourth user
  • And so on ...

I already doubt that this scenario happened as often as the comparable scenario happened with C64 programs. (Note that a CP/M virus would probably not be able to infect non-CP/M programs on computers where CP/M is not the only OS - such as the Amstrad CPC, the Commodore 128 or some MSX machines.)

You also have to see that the actual process of infecting a file is much more unlikely in the case of a CP/M virus:

CP/M computers were not hardware compatible at all. A program or virus could not directly access the hardware nor do anything else not officially supported by the operating system.

Therefore, the only way a CP/M virus could infect another program is when the program is stored on a disk that had to be in the drive while the infected program is running. (Most CP/M versions did not support parts of the program staying in the RAM after the program has finished.)

In contrast, a MS-DOS or C64 virus could do things not officially supported by the operating system. They could stay in RAM after a program has finished (under MS-DOS this is even officially supported). When you insert a disk much later, it can infect the programs on the disk.

  • For one, there is no real difference between the eager to copy by some peopwhen they switch role from 'private' to 'business'. In fact, while being more visible (shown on TV) as being made in private, program-'sharing' in comapnies was way more rampant. That's why copy protection (Dongles) where such a great business during the 80s - almost all for non home machines. Second CP/M wasn't an all professional thing. There where quite popular home machines running CP/M - think Amstrad/Schneider CPC series.
    – Raffzahn
    Commented Feb 22, 2019 at 11:38
  • 1
    @Raffzahn I know that there were home computers that could run CP/M: The Commodore 128 would be another example. However, at least the home computers I know were using CP/M only as secondary OS. (Amstrad CPC's primary OS for example was AMS-DOS.) I'm not sure, but I think most "home users" did not use CP/M. Commented Feb 22, 2019 at 12:53
  • 1
    @Raffzahn: I used CP/M on the Commodore 128 to run Turbo Pascal, and was rather happy with how well it worked. I think my high school bought CP/M cards for some of their Apple //e computers so they could use Turbo Pascal as well, since it is so much nicer to work with than the UCSD P-system.
    – supercat
    Commented Feb 22, 2019 at 16:22
  • 1
    @manassehkatz: Turbo Pascal could be used to compile a program too large to fit in memory with the IDE and produce an executable that was too large to fit in memory with the IDE. Even if one had too little memory to use it any other way, it would still have been a huge improvement over just about anything else.
    – supercat
    Commented Feb 22, 2019 at 19:10
  • 1
    @manassehkatz-Moving2Codidact Turbo Pascal came out for CP/M up to version 3 where it was as groundbreaking as you describe it. The crucial feature was that the editor and compiler was concurrently in memory along with your source code and compiled machine code, so no disk access required. As you can see on jbox.dk/rc702/images/rc700-cpm.png a 56 KB CP/M system allows about 22 kb for the user. This in turn means that you absolutely need at least 32 Kb RAM for this to work, and then we are looking at lots of money in the 50'es. Commented Nov 2, 2021 at 22:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .