The sudden outbreak of COVID-19 at the end of 2019 has had a huge impact on people's lives all over the world, and the overwhelmingly negative information about the epidemic has made people panic for the future. This kind of panic spreads and develops through online social networks, and further spreads to the offline environment, which triggers panic buying behavior and has a serious impact on social stability. In order to quantitatively study this behavior, a two-layer propagation model of panic buying behavior under the sudden epidemic is constructed. The model first analyzes the formation process of individual panic from a micro perspective, and then combines the Susceptible-Infected-Recovered (SIR) Model to simulate the spread of group behavior. Then, through simulation experiments, the main factors affecting the spread of panic buying behavior are discussed. The experimental results show that: (1) the dissipating speed of individual panics is related to the number of interactions and there is a threshold. When the number of individuals involved in interacting is equal to this threshold, the panic of the group dissipates the fastest, while the dissipation speed is slower when it is far from the threshold; (2) The reasonable external information release time will affect the occurrence of the second panic buying, meaning providing information about the availability of supplies when an escalation of epidemic is announced will help prevent a second panic buying. In addition, when the first panic buying is about to end, if the scale of the second panic buying is to be suppressed, it is better to release positive information after the end of the first panic buying, rather than ahead of the end; and (3) Higher conformity among people escalates panic, resulting in panic buying. Finally, two cases are used to verify the effectiveness and feasibility of the proposed model.