Context. Among the intermediate mass, magnetic chemically peculiar (MCP) stars, CU Vir is one of the most intriguing objects. Its 100 % circularly polarized beams of radio emission sweep the Earth as the star rotates, thus making this strongly magnetic star the prototype of a class of non degenerate stellar radio pulsars. While CU Vir is well studied in radio, its high-energy properties are not known. Yet, X-ray emission is expected from stellar magnetospheres and confined stellar winds. Aims. Using X-ray data we aim to test CU Vir for intrinsic X-ray emission and investigate mechanisms responsible for its generation. Methods. We present X-ray observations performed with XMM-Newton and Chandra and study obtained X-ray images, light curves and spectra. Basic X-ray properties are derived from spectral modelling and are compared with model predictions. In this context we investigate potential thermal and non-thermal X-ray emission scenarios. Results. We detect an X-ray source at the position of CU Vir. With L X ≈ 3×10 28 erg s −1 it is moderately X-ray bright, but the spectrum is extremely hard compared to other Ap stars. Spectral modelling requires multi-component models with predominant hot plasma at temperatures of about T X = 25 MK or, alternatively, a nonthermal spectral component. Both types of model provide a virtually equivalent description of the X-ray spectra. The Chandra observations was performed six years later than the one by XMM-Newton, yet the source has similar X-ray flux and spectrum, suggesting a steady and persistent X-ray emission. This is further confirmed by the X-ray light curves that show only mild X-ray variability. Conclusions. CU Vir is also at X-ray energies an exceptional star. To explain its full X-ray properties, a generating mechanism beyond standard explanations like the presence of a low-mass companion or magnetically confined wind-shocks is required. Magnetospheric activity might be present or, as proposed for fast rotating strongly magnetic Bp stars, the X-ray emission of CU Vir is predominantly auroral in nature.