I'm testing XSS vulnerability attacks in Android. For this I've developed a web view, where I load a html file which contains a simple form for entering name and email. The contents of html file are:
<html>
<body>
<form action="search.php" method="get">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>
</body>
</html>
I send the data via get to a php file, which echoes whatever is written in the name field. The contents of php file are :
<html>
<head>
<title> You searched for: </title>
</head>
<body>
<?php
echo $_GET['name'];
?>
</body>
</html>
Now, my intention is to write Javascript inside the name field, so that when I echo it, script is executed. Normal strings passed in name field are echoed successfully, so I know that the php code is actually working.
This works on : Mozilla Firefox.
Doesn't work on : Chrome, Android Emulator, Android real device.
EDIT : I missed the input. I am adding a Javascript in name field. So the input can be a simple script such as:
<script language="Javascript">alert("Hello");</script>
Since I'm not sanitizing the input, I expect the script to execute. You can refer this link for more information.
But the output is a blank page with no output, which means script isn't executed.
Any ideas?
Note: I'm concerned with this not working with emulator/Android device only, so please don't answer for Chrome.