Tag: security

Questions Related to security

  1. Since the file name is hard coded, fopen() will fail if the file already exists

  2. 0600 is not a secure option. The parameter 0600 should be changed to 0666

  3. Attackers can exploit by creating a symboling link /tmp/cache_data that points to a system file

  4. Attackers can exploit the application's cache by writing directly to /tmp/cache_data


Correct Option: C
  1. Overwriting freed memory is a security vulnerability

  2. Depends on the application and how important “somedata” is

  3. This will result in a buffer overflow since the freed memory location cannot handle 8 characters of data “somedata”

  4. strcpy() will fail as it cannot write to already freed memory, and the application will crash


Correct Option: A

Identify the line on which the vulnerability exists: 1 public class performSearchAction extends HttpServlet{ 2 // Servlet for Search Action 3 public void doPost(HttpServletRequest req, HttpServletResponse res) 4 { 5 try 6 { 7 ArrayList arrSearch = Util.performSearchAction(req, res); 8 req.setAttribute(“SearchResults”,arrSearch); 9 RequestDispatcher rd = getServletContext().getRequestDispatcher("/SearchResult.jsp"); 10 rd.forward(req,res); 11 } catch (Exception e) { 12 log.debug(“Exception occurred:”+e); 13 } 14 } //End of doPost method 15 public void doGet(HttpServletRequest req, HttpServletResponse res) 16 { 17 doPost(req,res); 18 } //End of doGet method 19 } //End of Class

  1. Line # 12

  2. Line # 9

  3. Line # 17

  4. Line # 8

  5. Line # 14, 18 & 19


Correct Option: C

AI Explanation

To identify the line on which the vulnerability exists, we need to analyze each line of code and determine if there are any potential vulnerabilities.

Let's go through each option:

Option A) Line #12 - This line of code is a debug statement and does not contain any potential vulnerabilities.

Option B) Line #9 - This line of code is responsible for forwarding the request and response objects to the "/SearchResult.jsp" page. It does not appear to have any vulnerabilities.

Option C) Line #17 - This line of code calls the doPost method, which in turn calls the performSearchAction method. There does not appear to be any vulnerabilities in this line of code.

Option D) Line #8 - This line of code sets the "SearchResults" attribute in the request object. It does not appear to have any vulnerabilities.

Option E) Line #14, 18 & 19 - These lines of code mark the end of the doPost and doGet methods, and the end of the class. They do not contain any vulnerabilities.

Based on the analysis, none of the given options contain a vulnerability. Hence, the correct answer is none of the above.

  1. Information Leakage

  2. Cross Site Scripting

  3. Cross Site Tracing

  4. Option 1 AND Option 2

  5. Option 1 AND Option 3

  6. Command Injection


Correct Option: D
  1. Request Redirection is vulnerable and not a good practice

  2. Exception is not logged

  3. Input parameter “language” is not validated

  4. Option 1 AND Option 2

  5. Option 1 AND Option 3

  6. Option 2 AND Option 3


Correct Option: E