Cross-site scripting (XSS) attack is a client-side code injection attack
Cross-site scripting (XSS) attack is a web security vulnerability attack, or it's often termed as the client-side code injection attack. In this case, the attacker executes malicious scripts in a web browser that seems to be a benign and trusted website at first glance. Here, the webpage/website acts as the driver to deliver the malicious scripts to the user’s system.
Wondering how does XSS or cross-site scripting works?
Once the malicious code is executed, the script will get access to various sensitive information stored by a user's browser, such as session tokens, cookies, login credentials, saved passwords, and more. What's more, these scripts are so powerful that they can even tamper and rewrite the contents of an HTML web page.
XSS attack works on a two-step process. First of all, the attacker attempts to find out a source to inject the malicious code to a webpage/website that the victim visits.
Now, if the victim user browses the web page having the malicious code and executes it unknowingly, the XSS security attack will tamper the essential information of a browser.
There are three types of cross-site scripting (XSS) attacks, such as Reflected XSS, Stored XSS, and DOM-based XSS.
Reflected XSS is considered to be the simplest form of XSS attack where the malicious script is sent and executed from the HTTP request. Now, a stored XSS attack is possible when the malicious code snippet is sent from a website's database. Similarly, a DOM-based XSS attack happens when vulnerability/flaw exists in the client-side code.
In web applications that hold confidential and sensitive data like e-commerce applications, banking transactions, healthcare records, and emails, the impact of XSS will be quite serious. But, this impact is subjected to a single targeted victim user.
But, if the XSS attacker gets elevated privileges/full control of the application through malicious code injection, then the impact will be very severe and critical as it will be able to target and compromise the security of all users and their corresponding data.