Introduction to Cross-Site Scripting (XSS)

Let's get an introduction to cross-site scripting.

Introduction

We’ve seen the knock-knock joke principle applied to SQL (SQL injection). Let’s take a look at attacks using that same principle when applied to the HTML and JavaScript in a web page. We call this attack cross-site scripting (or XSS for short) if the attack injects JavaScript. We call it DOM injection if it injects regular HTML.

Let’s continue with the example from earlier in the chapter of a blogging site. One of the most basic requirements is for anyone using the site to be able to read posts written by other users. Suppose a reader writes a blog post such as this:

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy