Reflected XSS into HTML context with nothing encoded
Reflected XSS into HTML context with nothing encoded: This lab contains a simple reflected cross-site scripting vulnerability in the search functionality. • PortSwigger • XSS • xss, reflected-xxs
This lab contains a simple reflected cross-site scripting vulnerability in the search functionality.
To solve the lab, perform a cross-site scripting attack that calls the alert function.
In this section, we'll explain reflected cross-site scripting, describe the impact of reflected XSS attacks, and spell out how to find reflected XSS vulnerabilities.
What is reflected cross-site scripting?
Reflected cross-site scripting (or XSS) arises when an application receives data in an HTTP request and includes that data within the immediate response in an unsafe way.
Suppose a website has a search function which receives the user-supplied search term in a URL parameter:
[https://insecure-website.com/search?term=gift](https://insecure-website.com/search?term=gift)
The application echoes the supplied search term in the response to this URL:
`You searched for: gift
`
Assuming the application doesn't perform any other processing of the data, an attacker can construct an attack like this:
[https://insecure-website.com/search?term=](https://insecure-website.com/search?term=)/*+Bad+stuff+here...+*/
This URL results in the following response:
`You searched for: /* Bad stuff here... */
`
If another user of the application requests the attacker's URL, then the script supplied by the attacker will execute in the victim user's browser, in the context of their session with the application.
Quite straight forward first lab
alert("hacked by XsiSec")