The generation of the observed baryon asymmetry may have taken place during the electroweak phase transition, thus involving physics testable at LHC, a scenario dubbed electroweak baryogenesis. In this paper we point out that the magnetic field which is produced in the bubbles of a first order phase transition endangers the baryon asymmetry produced in the bubble walls. The reason being that the produced magnetic field couples to the sphaleron magnetic moment and lowers the sphaleron energy; this strengthens the sphaleron transitions inside the bubbles and triggers a more effective wash out of the baryon asymmetry. We apply this scenario to the Minimal Supersymmetric extension of the Standard Model (MSSM) where, in the absence of a magnetic field, successful electroweak baryogenesis requires the lightest CP-even Higgs and the right-handed stop masses to be lighter than about 127 GeV and 120 GeV, respectively. We show that even for moderate values of the magnetic field, the Higgs mass required to preserve the baryon asymmetry is below the present experimental bound. As a consequence electroweak baryogenesis within the MSSM should be confronted on the one hand to future measurements at the LHC on the Higgs and the right-handed stop masses, and on the other hand to more precise calculations of the magnetic field produced at the electroweak phase transition.