In this paper, a formal analysis of security protocols for wireless sensor networks (WSN) is presented. Considering WSN environmental factors and features of the network nodes, we establish a model of SPINS (Security Protocols in wireless Sensor Networks) that is an example of WSN security protocols and analyze its authentication and confidentiality via the SPIN tool. Experimental results show that some security holes exist in SPINS. The work demonstrates the feasibility of model checking the security protocol for WSN, which provides a n...