The first-order Fermi acceleration of electrons requires an injection of electrons into a mildly relativistic energy range. However, the mechanism of injection has remained a puzzle both in theory and observation. We present direct evidence for a novel stochastic shock drift acceleration theory for the injection obtained with Magnetospheric Multiscale observations at the Earth's bow shock. The theoretical model can explain electron acceleration to mildly relativistic energies at high-speed astrophysical shocks, which may provide a solution to the long-standing issue of electron injection.