SUMMARYBoth distance fraud attacks and relay attacks threaten radio-frequency identification (RFID) applications but are hard to prevent. Existing approaches can neither avoid tags to response the rouge reader's challenges nor have the simultaneous feature to defend the two kinds of attacks. In a first step, this paper presents an improved distance-bounding protocol that a tag deduces the distance to a reader and reports if the reader is honest or malicious through the output of trust values that can defend distance fraud. When multiple readers are synchronized and scheduled, we just logically threat them as one. So our solutions fix a flaw in prior work that may be leveraged by attackers to increase the successful rate of discovering relay attack. Secondly, we deploy trusted third party architecture to provide anonymity for tags in anonymous RFID systems without requiring tag identifiers. Existing distance-based attack detection methods are not applicable in anonymous RFID systems because of the requirement of awareness of tag identifiers. This insight inspires Distance-Bounding Trust Protocol (DBTP), which is for both distance fraud and relay attacks detection in anonymous RFID systems. DBTP can make correct decisions through trust values in accepting or rejecting a reader's challenge by establishing collaborations and trust relationship between one reader (verifier) and active tags (provers). We evaluate the performance of DBTP through theoretical analysis and extensive simulations. The results show that DBTP can detect both distance fraud and relay attacks, and it is effective to guarantee security for anonymous RFID systems.