nerdexam
EC-Council

312-50V13 · Question #314

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…

The correct answer is D. This php file silently executes the code and grabs the users session cookie and session ID. Session Hijacking via Hidden Malicious Code Option D is correct because the hidden PHP code behind the images is designed to perform a session hijacking attack - when a user clicks the image, the script silently executes in the background, stealing the user's session cookie and…

Submitted by ricky.ec· Mar 6, 2026Session Hijacking

Question

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: What issue occurred for the users who clicked on the image?

Exhibit

312-50V13 question #314 exhibit

Options

  • AThe code inject a new cookie to the browser.
  • BThe code redirects the user to another site.
  • CThe code is a virus that is attempting to gather the users username and password.
  • DThis php file silently executes the code and grabs the users session cookie and session ID.

How the community answered

(38 responses)
  • A
    3% (1)
  • B
    5% (2)
  • C
    3% (1)
  • D
    89% (34)

Explanation

Session Hijacking via Hidden Malicious Code

Option D is correct because the hidden PHP code behind the images is designed to perform a session hijacking attack - when a user clicks the image, the script silently executes in the background, stealing the user's session cookie and session ID, which the attacker can then use to impersonate that user without needing their credentials.

Why the distractors are wrong:

  • A is incorrect because the code is stealing an existing session cookie, not injecting a new one into the browser.
  • B is incorrect because while some malicious scripts do redirect users, the described attack operates silently - the user notices no redirection.
  • C is incorrect because this is not a virus seeking usernames and passwords directly; session hijacking bypasses credentials entirely by stealing the active session token.

Memory Tip: Think of a session cookie as a temporary ID badge - once you log in, the server trusts that badge. Session hijacking steals the badge rather than the password, which is why it's so dangerous. Remember: "No click needed to redirect, no virus, no new cookie - just silent theft of your session."

Topics

#Session Hijacking#Web Application Security#Cross-Site Scripting#Malicious Code

Community Discussion

No community discussion yet for this question.

Full 312-50V13 Practice