—In this paper we study the propagation of malicious software in wireless ad hoc networks under a probabilistic framework. We design topology control algorithms for the development of effective attack strategies by a malicious mobile node, based on the risk function metric, which indicates the network’s vulnerability. Our approach takes on the attacker’s perspective, in order to investigate the extent of its attack potentials, which in turn could be used for the effective design of network countermeasures. Our performance evaluation results demonstrate that the proposed risk-based topology control algorithms and respective attack strategies effectively balance the tradeoffs between the potential network damage and the attacker’s lifetime, and as a result significantly outperform any other flat and threshold-based approaches.