1. Web Security Academy
  2. Cross-site scripting
  3. Contexts
  4. Lab

Lab: Reflected XSS into HTML context with most tags and attributes blocked


This lab contains a reflected XSS vulnerability in the search functionality but uses a web application firewall (WAF) to protect against common XSS vectors.

To solve the lab, perform a cross-site scripting attack that bypasses the WAF and calls the print() function.


Your solution must not require any user interaction. Manually causing print() to be called in your own browser will not solve the lab.

Register for free to track your learning progress

The benefits of working through PortSwigger's Web Security Academy
  • Practise exploiting vulnerabilities on realistic targets.

  • Record your progression from Apprentice to Expert.

  • See where you rank in our Hall of Fame.

Already got an account? Login here