It is a significant challenge to design a secure routing protocol for wireless sensor network (WSN), because a WSN has dynamic topology, limited energy, confined computing ability and small memory size. This study explores the algorithm of ensuring security in routing layer for a WSN. In this paper, a multipath secure routing protocol for flat network--MDMP is proposed. Symmetric encryption and asymmetric encryption are exploited to encrypt and authenticate data in the network. Furthermore, malicious nodes will be detected out and isolates. Experiments show that MDMP provides effective immunity to a variety of attacks in WSN and better network performance.