Cloud Application Security

A cloud forum application stores user comments and renders them unchanged on pages that other users view. Attackers' comments now run scripts in those viewers' browsers. Which control BEST removes the root cause?

Show the answer

Correct answerD. Context-aware output encoding of untrusted data when it is rendered

AWhy not this: Parameterized queries separate SQL code from data, but the problem here is rendering, not query construction.

BWhy not this: Rate limiting slows abuse volume but does not stop a single malicious comment from executing.

CWhy not this: Encryption at rest protects stored data from disclosure; it does not change how comments are displayed.

DWhy this is right: Encoding untrusted data for its HTML context stops the browser from executing it, which removes the XSS root cause.

The flaw is cross-site scripting: untrusted data is sent to the browser as active content. Context-aware output encoding makes the browser treat it as text. Parameterized queries stop SQL injection, a different injection flaw that does not affect how data is rendered.