The existence of vulnerabilities is a serious threat to the security of networks, which needs to be detected timely. In this paper, machine learning methods were mainly studied. Firstly, network security vulnerabilities were briefly introduced, and then a Convolutional Neural Network (CNN) + Long Short-Term Memory (LSTM) method was designed to extract and match vulnerability features by preprocessing vulnerability data based on National Vulnerability Database. It was found that the CNN-LSTM method had high training accuracy, and its recall rate, precision, F1, and Mathews correlation coefficient (MCC) values were better than those of support vector machine and other methods in detecting the test set; its F1 and MCC values reached 0.8807 and 0.9738, respectively; the F1 value was above 0.85 in detecting different categories of vulnerabilities. The results demonstrate the reliability of the CNN-LSTM method for vulnerability detection. The CNN-LSTM method can be applied to real networks.