Dynamic spectrum access (DSA) has been envisioned to become the key to solving worldwide spectrum shortage. However, the open nature of wireless medium brings severe threats to the DSA system resulting from unauthorized access. Specifically, unauthorized secondary user (SU) utilizes the licensed spectrum by faking/replaying the spectrum permit, which will not only introduce severe interference to authorized SU but also disable the DSA system due to the lack of stability and incentives. In this paper, we propose a secure and optimized unauthorized SU detection scheme. By optimizing permit modulation and embedding based on the current channel condition, we shorten the unauthorized SU's detection period and further improve the accuracy with low-complexity implementation. The proposed scheme ensures the security of DSA system and will further unleash its great potential. Extensive experimental results using both MATLAB and Universal Software Radio Peripheral (USRP) demonstrate the effectiveness, efficiency, and accuracy of our proposed scheme.