ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 167 - CS0-003 discussion

Report
Export

A security analyst found the following vulnerability on the company’s website:

<INPUT TYPE=“IMAGE” SRC=“javascript:alert(‘test’);”>

Which of the following should be implemented to prevent this type of attack in the future?

A.
Input sanitization
Answers
A.
Input sanitization
B.
Output encoding
Answers
B.
Output encoding
C.
Code obfuscation
Answers
C.
Code obfuscation
D.
Prepared statements
Answers
D.
Prepared statements
Suggested answer: A

Explanation:

This is a type of web application vulnerability called cross-site scripting (XSS), which allows an attacker to inject malicious code into a web page that is viewed by other users. XSS can be used to steal cookies, session tokens, credentials, or other sensitive information, or to perform actions on behalf of the victim.

Input sanitization is a technique that prevents XSS attacks by checking and filtering the user input before processing it. Input sanitization can remove or encode any characters or strings that may be interpreted as code by the browser, such as <, >, ", ', or javascript:. Input sanitization can also validate the input against a predefined format or range of values, and reject any input that does not match. Output encoding is a technique that prevents XSS attacks by encoding the output before sending it to the browser. Output encoding can convert any characters or strings that may be interpreted as code by the browser into harmless entities, such as <, >, ", ', or javascript:. Output encoding can also

escape any special characters that may have a different meaning in different contexts, such as , /, or ;.

Code obfuscation is a technique that makes the source code of a web application more difficult to read and understand by humans. Code obfuscation can use techniques such as renaming variables and functions, removing comments and whitespace, replacing literals with expressions, or adding dummy code. Code obfuscation can help protect the intellectual property and trade secrets of a web application, but it does not prevent XSS attacks.

asked 02/10/2024
Roger Warner
33 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first