With the rapid development of Internet technology, the threats to network security have become more and more serious, and the number of web attacks has doubled year after year. Aiming at the problems of low accuracy of manual feature extraction and uneven distribution of normal and malicious category samples by current web threat identification methods, this paper proposes a web threat identification scheme based on cost-sensitive character-level convolutional neural networks (Char-CNN). Firstly, the characteristics of the Web request are analyzed, the original data is unified in format, the data is read and spliced into a character sequence, and the character sequence is encoded according to the pre-specified index dictionary. Secondly, the character-level CNN is used to extract the request information, and the character encoding is extracted and feature selected for model training. Finally, cost-sensitive learning is embedded, the cross-entropy loss function of the neural network model is modified, the cost of malicious sample classification error is increased, and the model parameters and weights are adjusted through backpropagation, and then the Softmax layer is used for threat identification. Experiments show that the accuracy of the Web threat identification scheme based on cost-sensitive character-level convolutional neural network reaches 98.99%, which improves the accuracy, recall rate and F
1 score compared with the existing threat identification scheme, and verifies the effectiveness of the proposed scheme on unbalanced datasets.