Webshell Detection by Transformer Model

Fang Chun Yang, Sihong Li, Zhijie Hu · 2025

The increasing complexity and concealment of Webshell pose a major challenge to web application security, making rule-based and TextCNN detection and classification methods insufficient and backward. This study, a Transformerbased model is utilized for Webshell detection and classification, and its performance is compared against that of conventional CNN-based model typically adopted for similar tasks. We leverage two types of data features-source code and Syntax Trees (AST) that capture both the semantic and deep semantic information of Webshell code. Experimental results demonstrate that Transformer achieves superior performance across both datasets, exhibiting robust detection capabilities. While TextCNN shows slighty inferior performance on AST data, it remains competitive in source code analysis. This study provides a comprehensive and efficient solution for Webshell detection, effectively countering advanced threats.

Read the paper · More papers on PaperTik