Inputs:
Set of trustworthy anchor positions:
Untrustworthy node position:
Set of untrustworthy node to anchor RSSs:
Parameters of the path-loss model: K and
Detection threshold:
Steps:
 Obtain the anchor to node distances .
 Compute the test statistic using (13).
if   then
  set  wormhole_flag true
else
  set  wormhole_flag false
end if
return  wormhole_flag
Algorithm 2: Detection after localization. Parametric approach: likelihood ratio test.