A Debian-first guide to identifying suspicious script injection attempts in web requests, reviewing targeted inputs, and tightening application handling.
Cross-site scripting, or XSS, is an attack that tries to inject script content into a web application so that it executes in a user's browser. Attackers typically target input fields, comments, search parameters, URLs, headers, or stored content that may be reflected back unsafely.
Even failed XSS probes are useful to study because they show what parts of the application attackers expect to handle user-controlled input.
sudo journalctl -u caddy --since "1 hour ago"
sudo grep -Ei "<script|javascript:|onerror=|onload=|alert\(|%3Cscript|%3E|document\.cookie" /var/log/caddy/*.log 2>/dev/null | tail -n 100
sudo grep -Ei "\?|search=|q=|query=|comment=|message=" /var/log/caddy/*.log 2>/dev/null | tail -n 100
sudo journalctl --since "1 hour ago" | grep -Ei "template|render|error|exception"
sudo awk '{print $1}' /var/log/caddy/*.log 2>/dev/null | sort | uniq -c | sort -nr | head
sudo ufw deny from <IP_ADDRESS>
# Reduce or disable the targeted form or reflected input path during active abuse if operationally necessary
# Inspect the affected application path and template behavior
sudo grep -Ei "<script|javascript:|onerror=|onload=|alert\(|document\.cookie" /var/log/caddy/*.log 2>/dev/null | tail -n 200
# Inspect how user-controlled input is handled, escaped, stored, and rendered
# Review submitted comments, messages, or stored entries for unexpected script-like content
Recovery means confirming whether the XSS attempt remained a probe or whether malicious content was actually stored or reflected back to users.
# Use safe application-side handling for all user-controlled content
sudo journalctl -u caddy --since "24 hours ago"
sudo ss -tulnp
sudo ufw status numbered
sudo apt update
sudo apt upgrade
# Remove old forms, test pages, and forgotten UI paths from public access
Manual review and safe input handling come first. Future recommendations may include tools that improve visibility into web abuse, but the most important control is still how the application handles untrusted content.
All commands shown are based on Debian-based systems unless otherwise noted.