Abstract Exceptional orthogonal polynomial systems (X-OPSs) arise as eigenfunctions of Sturm–Liouville problems, but without the assumption that an eigenpolynomial of every degree is present. In this sense, they generalize the classical families of Hermite, Laguerre, and Jacobi, and include as a special case the family of CPRS orthogonal polynomials introduced by Cariñena et al. (J. Phys. A 41:085301, 2008). We formulate the following conjecture: every exceptional orthogonal polynomial system is related to a classical system by a Darboux–Crum transformation. We give a proof of this conjecture for codimension 2 exceptional orthogonal polynomials (X2-OPs). As a by-product of this analysis, we prove a Bochner-type theorem classifying all possible X2-OPSs. The classification includes all cases known to date plus some new examples of X2-Laguerre and X2-Jacobi polynomials.