Webshell is a backdoor web page-based program. Malicious attackers obtain some privileges through the Webshell so as to realize the operation and control of the website. However, due to confusion coding technology, Webshell detection becomes difficult. This paper presents a Webshell detection model based on the word attention mechanism. In the model, we mainly focus on intra-line word association. After using Word2vec to vectorize the words, we use GRU (Gated Recursive Unit) and the attention mechanism to train and detect the samples. The experimental results show that the model has a high detection rate and low loss function.