This paper presents a method to identify compromised nodes in wireless sensor networks that drop or modify packets. It utilizes a dynamic routing tree structure and a combination of a node categorization algorithm and global ranking algorithm to monitor node behavior and determine the reliability of packet forwarding. The approach is characterized by low overhead, effective detection of misbehaving nodes, and compatibility with existing packet filtering schemes.