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.
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
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.
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.
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.
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?
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
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
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.
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.
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
This section is not available anymore. Please use the main Exam Page.CS0-002 Exam Questions
Log in to ExamTopics
Sign in:
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.
david124
Highly Voted 2 years, 10 months agoR00ted
Highly Voted 2 years, 9 months agoskibby16
Most Recent 1 year, 7 months agoHershey2025
1 year, 11 months agotatianna
2 years, 3 months ago2Fish
2 years, 3 months agoikediashi
2 years, 2 months agoboletri
2 years, 4 months agoStiobhan
2 years, 4 months agoMr_BuCk3th34D
2 years, 6 months agomoonash
2 years, 6 months agoFastytop
2 years, 9 months agoamateurguy
2 years, 9 months agoLaudy
2 years, 10 months ago