So far, the problem of positioning in sensor and ad hoc networks has been studied in a non-adversarial setting. We show that most of the proposed positioning algorithms are highly vulnerable to attacks from compromised network nodes and malicious (outside) attackers. We propose a set of mechanisms for securing positioning. Our mechanisms aim to enable each node to obtain correct information about its position in the presence of attackers. Furthermore, they aim to enable the network nodes and the network authority to detect the modifications of network topology and the changes in physical positions of other nodes. We further show the usefulness of the proposed mechanisms for the the detection of node stealing and the detection of compromise. In our mechanisms, we make use of distance-bounding and distance estimation techniques and we rely on conventional cryptographic techniques.