Wireless sensor networks (WSN) have become increasingly one of the most promising and interesting areas over the past few years. But the character of constrained resources makes it vulnerable to Denial of Service (DoS) attacks, resulting in a large number of compromised nodes. Until now, it is unrealistic to prevent DoS attacks, but compromised nodes may be designed to self-recover to reduce the harm of DoS attacks. In this paper, an agent based selfrecovery model (ABSR) was presented on the use of autonomic computing, which can recover itself in the approach of anomaly monitoring, anomaly deciding and node recovery. Finally, the model is analyzed and verified with the Eclipse Plug-in PEPA Tool, which suggests that compromised nodes can self-recover effectively using ABSR.