A three-dimensional continuous-time stochastic model based on the classic Kermack-McKendrick model for the spread of epidemics is proposed for the propagation of a computer virus. Moreover, control variables are introduced into the model. We look for the controls that either minimize or maximize the expected time it takes to clean the infected computers, or to protect them from the virus. Using dynamic programming, the equations satisfied by the value functions are derived. Particular problems are solved explicitly. 2010 Mathematics Subject Classification. 49N90. Key words and phrases. Game theory, first-passage time, Brownian motion, partial differential equations, method of similarity solutions.