The analysis of the wave content inside a perpendicular bow shock indicates that heating of ions is related to the Lower-Hybrid-Drift (LHD) instability, and heating of electrons to the Electron-Cyclotron-Drift (ECD) instability. Both processes represent stochastic acceleration caused by the electric field gradients on the electron gyroradius scales, produced by the two instabilities. Stochastic heating is a single particle mechanism where large gradients break adiabatic invariants and expose particles to direct acceleration by the DC- and wave-fields. The acceleration is controlled by function $chi = m_iq_i^{-1} B^{-2}$div($mathbf{E}$), which represents a general diagnostic tool for processes of energy transfer between electromagnetic fields and particles, and the measure of the local charge non-neutrality. The identification was made with multipoint measurements obtained from the Magnetospheric Multiscale spacecraft (MMS). The source for the LHD instability is the diamagnetic drift of ions, and for the ECD instability the source is ExB drift of electrons. The conclusions are supported by laboratory diagnostics of the ECD instability in Hall ion thrusters.