With the increase of social informatization, network security incidents occur frequently, and the security problem is paid more and more attention. Network intrusion detection is one of the important components of network security. Aiming at the current problems of data imbalance and low detection accuracy of anomalous traffic, this paper proposes an intrusion detection method based on BiGRU and CBAM. First, we use ADASYN adaptive oversampling and class balancing to oversample a few classes of anomalous data to solve the data imbalance problem. After that, we learn the temporal features of the data through a bidirectional long and short-term memory network, we introduce spatial attention and temporal attention CBAM, and the fused features are assigned different weights, and finally output the detection results. Experimental tests are conducted on the NSL-KDD dataset, and the results show that the model in this paper has higher accuracy and lower false detection rate compared with the current machine learning and deep learning models.