Semen Sojae Preparatum (SSP) is one of the most widely used traditional Chinese medicines, and is also a functional food. However, contamination with aflatoxins may occur in the fermentation process. To evaluate its safety, an accurate and rapid LC–ESI–MS/MS analytical method was developed and validated for the simultaneous determination of AFB1, AFB2, AFG1, AFG2 and AFM1 in SSP. After a simple ultrasonic extraction of SSP samples, chromatographic separation was achieved on an Agilent Zorbax SB‐C18 column (2.1 × 50 mm, 3.5 μm) with a flow rate of 0.50 mL/min. The gradient elution program was performed using a mobile phase consisting of water and acetonitrile, both containing 0.1% formic acid. Detection of five aflatoxins was based on triple quadrupole mass spectrometry using a multiple reaction monitoring mode with an electrospray ionization source. SSP is likely to be contaminated by aflatoxins in the processes of fermentation, storage, transportation and usage, and it is necessary to strictly monitor it. Artemisia annua L. and Morus alba L. may inhibit the production and growth of AFB1‐ and AFB2‐producing fungi, which has a certain detoxification effect on contamination with aflatoxins in SSP.