Inputs:
Set of trustworthy anchor positions:
Set of untrustworthy anchor to node RSSs:
Parameters of the path-loss model: and .
Detection threshold:
Steps:
 Obtain as the maximum likelihood estimate (MLE) of the position of the node using (17) and (13).
 Compute the test statistic using (13).
 if   then
  set  wormhole_flag true
else
  set  wormhole_flag false
end if
return  wormhole_flag and estimated position
Algorithm 1: Simultaneous localization and wormhole detection. Parametric approach: likelihood ratio test.