To protect the security of IoT devices, Tewari and Gupta proposed an ultralightweight mutual-authentication protocol for an RFID system. In the protocol, only two simple bitwise operations (XOR and rotation) are used to achieve two-pass mutual authentication. Although the protocol is efficient, we observe that the protocol has a security vulnerability. This security weakness could cause the leaking of all secrets in RFID tags. Compared with other researches that also proposed attacks for Tewari and Gupta's protocol, our attack needs less time and smaller space complexity to implement. The time complexity of our attack is O(1), and the attack can successfully crack the protocol with 100% probability.