Cognitive radio (CR) is regarded as an emerging technology, which equips wireless devices with the capability to adapt their operating parameters on the fly based on the radio environment, to utilize the scarce radio frequency spectrum in an efficient and opportunistic manner. However, due to the increasingly pervasive existence of smart wireless devices in cognitive radio networks (CRNs), CR systems are vulnerable to numerous security threats that affect the overall performance. There have been many significant advances on security threats and countermeasures in CRNs in the past few years. Our main goal in this paper is to present the state-of-the-art research results and approaches proposed for CRN security to protect both unlicensed secondary users and licensed primary users. Specifically, we present the recent advances on security threats/attacks and countermeasures in CRNs focusing more on the physical layer by categorizing them in terms of their types, their existence in the CR cycle, network protocol layers (exploited during their activities and defense strategies), and game theoretic approaches. The recent important attacks and countermeasures in CRNs are also summarized in the form of tables. We also present recommendations that can be followed while implementing countermeasures to enhance CRN security. With this paper, readers can have a more thorough understanding of CRN security attacks and countermeasures, as well as research trends in this area.