In many applications of wireless sensor network (WSN), it is essential to ensure that sensors can determine their location, even in the presence of malicious adversaries. However, almost all the localization algorithms need the location information of reference nodes to locate the unknown nodes. When the location information is tempered by the attacks, the accuracy of these algorithms will degrade badly. We present a novel mechanism for secure localization. The mechanism aims to filter out malicious reference signals on the basis of the normal distribution trait among multiple reference signals. This will ensure each node to obtain correct information about its position in the presence of attackers. In this paper, a simulation circumstance which might be attacked is constructed to compare the improved algorithm with original one. The experiment results demonstrate that the proposed mechanism can effectively survive malicious attacks.