Skip to content
Ameen Abozaid
Planned lessonJNR-041-L04

XSS from the backend's view

  • Lesson 4 of 7
  • Junior
On This Lesson 4 topics

This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.

In this lesson

know what the backend does about cross-site scripting.

Planned topics

  • XSS: an attacker's script runs in another user's browser.
  • Stored XSS: the payload is saved (for example in a product review) and shown to others. Reflected XSS: it is echoed back from the request, such as in a link.
  • A JSON API is mostly safe if it returns the right Content-Type: application/json and never HTML built from input.
  • If you produce HTML or emails, encode output for its context.
  • Add headers such as X-Content-Type-Options: nosniff and a Content-Security-Policy (more in JNR-042).
Draft outline details

Demonstration

review text <script>alert(1)</script> stored as text and shown encoded as &lt;script&gt;....

Check your understanding

Which is saved and shown to many users: stored or reflected XSS?

Show answer

Stored.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.