exam questions

Exam CS0-002 All Questions

View all questions & answers for the CS0-002 exam

Exam CS0-002 topic 1 question 92 discussion

Actual exam question from CompTIA's CS0-002
Question #: 92
Topic #: 1
[All CS0-002 Questions]

According to a static analysis report for a web application, a dynamic code evaluation script injection vulnerability was found. Which of the following actions is the
BEST option to fix the vulnerability in the source code?

  • A. Delete the vulnerable section of the code immediately.
  • B. Create a custom rule on the web application firewall.
  • C. Validate user input before execution and interpretation.
  • D. Use parameterized queries.
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
david124
Highly Voted 2 years, 10 months ago
Script = Java = Validate user input if it was SQL then it would have been D
upvoted 11 times
...
R00ted
Highly Voted 2 years, 9 months ago
Selected Answer: C
The correct answer is C. This is a XSS issue D = Using parameterized queries, which are precompiled SQL that takes input variables before it is executed. This helps prevent SQL injection attacks. -- This is for a SQL vulnerability
upvoted 9 times
...
skibby16
Most Recent 1 year, 7 months ago
Selected Answer: C
The best option to fix a dynamic code evaluation script injection vulnerability in the source code is to validate user input before execution and interpretation. This involves implementing proper input validation and sanitization mechanisms to ensure that user-supplied data is free from malicious code or characters that could lead to code injection vulnerabilities.
upvoted 1 times
...
Hershey2025
1 year, 11 months ago
It says in the source code answer is D
upvoted 1 times
...
tatianna
2 years, 3 months ago
CHAT GPT Dynamic code evaluation or script injection vulnerabilities can be fixed by ensuring that user input is validated before it is executed or interpreted. Input validation can include sanitizing the input, restricting input characters, and ensuring that the input is in the expected format. This approach will help prevent malicious code from being executed on the server or client side. Deleting the vulnerable section of the code is not an ideal solution, as it can cause the web application to malfunction. Creating a custom rule on the web application firewall or using parameterized queries can help protect against known attack patterns but may not fully address the root cause of the vulnerability.
upvoted 1 times
...
2Fish
2 years, 3 months ago
Selected Answer: C
C. The BEST option is to validate user input before execution and interpretation, which means that input received from users should be checked and filtered before being executed or interpreted by the application.
upvoted 1 times
ikediashi
2 years, 2 months ago
Hey 2Fish I see that you have been commenting with a lot of valid answers and you've been helping give me some clarity. By chance did you take the CYSA exam yet?
upvoted 1 times
...
...
boletri
2 years, 4 months ago
Selected Answer: D
Parameterized Queries Most secure websites with an SQL backend will incorporate a technique called parameterized queries to defend against code injection attacks and insecure object references. Official Comptia Cysa+ Course Material
upvoted 1 times
...
Stiobhan
2 years, 4 months ago
Selected Answer: C
This article will explain why it is C - https://securityboulevard.com/2019/09/what-is-code-injection-and-how-to-avoid-it/#:~:text=Regardless%20of%20language%2C%20you%20can%20avoid%20code%20injection,functions%20on%20raw%20user%20inputs.%20...%20More%20items
upvoted 1 times
...
Mr_BuCk3th34D
2 years, 6 months ago
Explaining the wrong answers: A. Delete the vulnerable section of the code immediately: if you do it you have chances to inutilize the software, hence, not the BEST option. B. Create a custom rule on the web application firewall: also not the BEST option, this is a workaround. D. Use parameterized queries: it talks about a web server, not a database, for that reason i don't see how it can be associated to SQLi. C is the correct answer.
upvoted 2 times
...
moonash
2 years, 6 months ago
Selected Answer: A
I would go with A. This is static code that was reviewed. Meaning it is not yet in prod. Developers might reuse code and the code might be having that vulnerability. I would suggest deleting that piece of vulnerable code section.
upvoted 1 times
...
Fastytop
2 years, 9 months ago
Selected Answer: D
We have here tow things: A parameterized query is a query in which placeholders are used for parameters and the parameter values are supplied at execution time. The most important reason to use parameterized queries is to avoid SQL injection attacks. and Goals of Input Validation¶ Input validation is performed to ensure only properly formed data is entering the workflow in an information system, preventing malformed data from persisting in the database and triggering malfunction of various downstream components. Input validation should happen as early as possible in the data flow, preferably as soon as the data is received from the external party. So I thing D is the correct
upvoted 1 times
...
amateurguy
2 years, 9 months ago
C is correct.
upvoted 1 times
...
Laudy
2 years, 10 months ago
Agree. C is correct
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...