The origin of magnetic flux noise in Superconducting Quantum Interference Devices with a power spectrum scaling as $1/f$ ($f$ is frequency) has been a puzzle for over 20 years. This noise limits the decoherence time of superconducting qubits. A consensus has emerged that the noise arises from fluctuating spins of localized electrons with an areal density of $5times10^{17}$m$^{-2}$. We show that, in the presence of potential disorder at the metal-insulator interface, some of the metal-induced gap states become localized and produce local moments. A modest level of disorder yields the observed areal density.