In this paper, we propose an approach for detecting primary user emulation attacks in cognitive radio networks. Cognitive radios (CRs) have been proposed as a promising solution for improving spectrum utilization via opportunistic spectrum sharing. In a CR network environment, primary (licensed) users have priority over secondary (unlicensed) users when accessing the wireless channel. Thus, if a malicious secondary user exploits this spectrum access etiquette by mimicking the spectral characteristics of a primary user, it can gain priority access to a wireless channel over other secondary users. Our proposed approach is initiated by energy detection to locate the existing users on the frequency band. The approach employs a cyclostationary calculation to represent the features of the user signals, which are then fed into an artificial neural network for classification. As opposed to current techniques for detecting primary user emulation attacks in CR networks, our proposed approach does not require any special hardware or time synchronization algorithms in the wireless network. Consequently, existing systems can readily employ the proposed approach without significant structural and functional modifications. The proposed approach is validated via computer simulations as well as by experimental hardware implementations using USRP2 platform. The hardware experiment shows that our approach can achieve a percentage of correct detection around 98% in actual wireless environments.