In this paper, we address wireless sensor network localization problems that have high reliability in an environment where physical node destruction is possible. We propose a range-independent localization algorithm called security localization based on Detecting malicious beacon nodes (DMBSL) that allows sensors to passively determine their location with high reliability, without increasing the number of reference points, or the complexity of the hardware of each reference point or node. In DMBSL, constraints of wireless sensor network are used to find and remove the malicious beacon nodes, then the maximum likelihood method is used to calculate the location of unknown nodes, so that the location calculation is very robust and is able to resist malicious attacks. In this paper, the location performance of DMBSL algorithm is deeply analyzed. The results of the simulation show the algorithm can get lower average positioning error, meantime malicious attacks have little side effects to location performance.