We investigate the effects of random and malicious packet losses on the stability of a networked control system. Specifically, we explore the networked control problem for the case where the plant and the controller exchange state and control input packets over a communication channel that may face random transmission failures as well as malicious attacks by an intelligent agent. We obtain a sufficient condition for the stability of the networked system and show that this condition can be assessed by examining the solutions to linear programming problems. The coefficients of the constraints in these problems depend on an asymptotic upper-bound for the average number of transmission failures that we use for characterizing random packet losses and malicious attacks. We illustrate the efficacy of our results with a numerical example.