In recent years, the growth of brain-computer interfaces (BCIs) has been remarkable in specific application fields, such as the medical sector or the entertainment industry. Most of these fields use evoked potentials, like P300, to obtain neural data able to handle prostheses or achieve greater immersion experience in videogames. The natural use of BCI involves the management of sensitive users' information as behaviors, emotions, or thoughts. In this context, new security breaches in BCI are offering cybercriminals the possibility of collecting sensitive data and affecting subjects' physical integrity, which are critical issues. For all these reasons, the fact of applying efficient cybersecurity mechanisms has become a main challenge. To improve this challenge, this chapter proposes a framework able to detect cyberattacks affecting one of the most typical scenarios of BCI, the generation of P300 through visual stimuli. A pool of experiments demonstrates the performance of the proposed framework.