City Research Online

Detecting Cross-Site Scripting Attacks Using Machine Learning

Howe, J. M. & Mereani, F. (2018). Detecting Cross-Site Scripting Attacks Using Machine Learning. Advances in Intelligent Systems and Computing, 723, doi: 10.1007/978-3-319-74690-6_20


Cross-site scripting (XSS) is one of the most frequently occurring types of attacks on web applications, hence is of importance in information security. XSS is where the attacker injects malicious code, typically JavaScript, into the web application in order to be executed in the user’s browser. Identifying that a script is malicious is an important part of the defence of a web application. This paper investigates using SVM, k-NN and Random Forests to detect and limit these attacks, whether known or unknown, by building classifiers for JavaScript code. It demonstrated that using an interesting feature set combining language syntax and behavioural features results in classifiers that give high accuracy and precision on large real world data sets without restricting attention only to obfuscation.

Publication Type: Article
Additional Information: This is a post-peer-review, pre-copyedit version of an article published in Advances in Intelligent Systems and Computing. The final authenticated version is available online at:
Publisher Keywords: Cross-site scripting; System security; Supervised learning; Classifiers Features selection
Departments: School of Science & Technology > Computer Science
[thumbnail of mereaniHoweXSS.pdf]
Text - Accepted Version
Download (220kB) | Preview


Add to AnyAdd to TwitterAdd to FacebookAdd to LinkedinAdd to PinterestAdd to Email


Downloads per month over past year

View more statistics

Actions (login required)

Admin Login Admin Login