Cubic hafnia (HfO$_2$) is of great interest for a number of applications in electronics because of its high dielectric constant. However, common defects in such applications degrade the properties of hafina. We have investigated the electronic properties of oxygen vacancies and nitrogen substitution in cubic HfO$_2$ using first principles calculations based on density functional theory (DFT) and many-body diffusion Monte Carlo (DMC) methods. We investigate five different charge defect states of oxygen vacancies, as well as substitutional N defects which can lead to local magnetic moments. Both DMC and DFT calculations shows that an oxygen vacancy induces strong lattice relaxations around the defect. Finally, we compare defect formation energies, charge and spin densities obtained from DMC with results obtained using DFT. While the obtained formation energies from DMC are 0.6~eV -- 1.5~eV larger than those from GGA+U, the agreement for the most important defects, neutral and positively charged oxygen vacancies, and nitrogen substitutional defect, under oxygen-poor conditions are in reasonably good agreement. Our work confirms that nitrogen can act to passivate cubic hafnia for applications in electronics.