WebShell is a common tool for network intrusions,which has the characteristics of great harm and good concealment.The current detection method is relatively simple,and easy to be bypassed,so it is difficult to deal with complex and flexible WebShell.To solve these problems,a supervised machine learning algorithm was put forward to detect WebShell intelligently.By learning the features of existing WebShell and non-existing WebShell pages,the algorithm can make prediction of the unknown pages,and the flexibility and adaptability were both very good.Compared with the traditional WebShell detection methods,the experiment proves that the algorithm has higher detection efficiency and accuracy,and at the same time there is a certain probability to detect new types of WebShell.