How to do it...

A common task that some major security scanners miss is to locate reflected cross-site scripting vulnerabilities in PHP files via the variable $_SERVER["PHP_SELF"]. The web crawler library httpspider comes in handy when automating this task. Let's see how we can write a script:

  1. Create the script file http-phpself-xss.nse and fill in the required information tags:
   description=[[    Crawls a web server and attempts to find PHP files vulnerable to       reflected cross site scripting via the variable       $_SERVER["PHP_SELF"].    This script crawls the web server to create a list of PHP files       and then sends an attack vector/probe to identify PHP_SELF cross       site scripting vulnerabilities.  PHP_SELF XSS refers to reflected cross site scripting ...

Get Nmap: Network Exploration and Security Auditing Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.