nerdexam
CompTIA

CAS-002 · Question #790

It has come to the IT administrator's attention that the "post your comment" field on the company blog page has been exploited, resulting in cross-site scripting attacks against customers reading…

The correct answer is B. Filter metacharacters. Cross-site scripting (XSS) attacks in comment fields rely on injecting special HTML and script metacharacters; filtering those characters server-side is the most direct and effective countermeasure.

Enterprise Security

Question

It has come to the IT administrator's attention that the "post your comment" field on the company blog page has been exploited, resulting in cross-site scripting attacks against customers reading the blog. Which of the following would be the MOST effective at preventing the "post your comment" field from being exploited?

Options

  • AUpdate the blog page to HTTPS
  • BFilter metacharacters
  • CInstall HIDS on the server
  • DPatch the web application
  • EPerform client side input validation

How the community answered

(19 responses)
  • A
    5% (1)
  • B
    84% (16)
  • C
    11% (2)

Why each option

Cross-site scripting (XSS) attacks in comment fields rely on injecting special HTML and script metacharacters; filtering those characters server-side is the most direct and effective countermeasure.

AUpdate the blog page to HTTPS

HTTPS encrypts data in transit between client and server but has no effect on the content of user-submitted input; a malicious script submitted over HTTPS is just as dangerous as one submitted over HTTP.

BFilter metacharactersCorrect

XSS attacks depend on injecting metacharacters such as '<', '>', '"', and '&' to break out of the text context and introduce executable HTML or JavaScript. Filtering or encoding these characters on the server side before storing or rendering user input neutralizes the attack vector at its source, preventing malicious scripts from ever reaching other users' browsers.

CInstall HIDS on the server

A host-based intrusion detection system monitors OS-level events and file integrity on the server but does not inspect or sanitize web application input fields.

DPatch the web application

Patching the web application is a valid general practice but is too vague to be the most effective specific control; the root cause is unsanitized input, not an unpatched software vulnerability.

EPerform client side input validation

Client-side input validation can be trivially bypassed by an attacker using browser developer tools or a proxy, so it provides no real security guarantee and must not be relied upon as a sole defense.

Concept tested: Server-side input filtering to prevent XSS attacks

Source: https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html

Topics

#XSS prevention#input validation#metacharacter filtering#web application security

Community Discussion

No community discussion yet for this question.

Full CAS-002 Practice