1. Homepage
  2. Exam
  3. [2019] INFR11098 SECURE PROGRAMMING - Final Exam - Q1 Environment Concerns

[2019] INFR11098 SECURE PROGRAMMING - Final Exam - Q1 Environment Concerns

This question has been solved
Engage in a Conversation

1. This question concerns the effects of the environment upon secure programming. CourseNana.COM

(a) In general terms, what are the main security issues concerning the environment in which a program executes? [4 marks] CourseNana.COM

  CourseNana.COM

(b) The two environment variables PATH and LD_LIBRARY_PATH can affect the behaviour of programs in Unix-style systems. Explain the similarity and difference between the two variables, stating which programs are affected. CourseNana.COM

  CourseNana.COM

For each case, illustrate your explanation with examples of potentially risky values for the variable and explain how an attacker might take advantage. Finally, explain how the potential vulnerabilities may be avoided. [10 marks] CourseNana.COM

  CourseNana.COM

(c) Consider the following PHP code fragment for a medical records application, CourseNana.COM

which performs authentication by checking if a cookie has been set. CourseNana.COM

  CourseNana.COM

$auth = $_COOKIES[’authenticated’]; CourseNana.COM

if (! $auth) { CourseNana.COM

if (AuthenticateUser($_POST[’user’], $_POST[’password’]) == "success") { CourseNana.COM

// save the cookie to send out in future responses CourseNana.COM

setcookie("authenticated", "1", time()+60*60*2); CourseNana.COM

} CourseNana.COM

else { CourseNana.COM

ShowLoginScreen(); CourseNana.COM

die("\n"); CourseNana.COM

} CourseNana.COM

} CourseNana.COM

DisplayMedicalHistory($_POST[’patient_ID’]); CourseNana.COM

  CourseNana.COM

i. What is the purpose of the time setting in the call to setcookie, why do you think the programmer makes this choice and how does it have an effect? Mention trust relationships in your answer. [5 marks] CourseNana.COM

ii. Explain how an attacker can defeat the authentication check here even before the first login. [1 mark] CourseNana.COM

  CourseNana.COM

(d) Consider the two Java code fragments below. CourseNana.COM

Fragment (A): CourseNana.COM

String ctl = request.getParameter("ctl"); CourseNana.COM

Worker ao = null; CourseNana.COM

if (ctl.equals("Add")) { CourseNana.COM

ao = new AddCommand(); CourseNana.COM

} CourseNana.COM

else if (ctl.equals("Modify")) { CourseNana.COM

ao = new ModifyCommand(); CourseNana.COM

} CourseNana.COM

else { CourseNana.COM

throw new UnknownActionError(); CourseNana.COM

} CourseNana.COM

ao.doAction(request); CourseNana.COM

Fragment (B): CourseNana.COM

String ctl = request.getParameter("ctl"); CourseNana.COM

Class cmdClass = Class.forName(ctl + "Command"); CourseNana.COM

Worker ao = (Worker) cmdClass.newInstance(); CourseNana.COM

ao.checkAccessControl(request); CourseNana.COM

ao.doAction(request); CourseNana.COM

The purpose of the code is to implement a command dispatcher pattern. Fragment (B) is being proposed as an improved, cleaner refactoring of (A). The improvement uses Java’s reflection language feature. CourseNana.COM

  CourseNana.COM

You are asked to do a code review of the proposed change. Explain the revised code and how it operates, suggesting why the programmer has added the access control in the revised code. Give two reasons why it may be seen as a poorer, more vulnerable security design than the original code. CourseNana.COM

Get the Solution to This Question

WeChat WeChat
Whatsapp WhatsApp
UNIVERSITY OF EDINBURGH代写,INFR11098代写,SECURE PROGRAMMING代写,UNIVERSITY OF EDINBURGH代编,INFR11098代编,SECURE PROGRAMMING代编,UNIVERSITY OF EDINBURGH代考,INFR11098代考,SECURE PROGRAMMING代考,UNIVERSITY OF EDINBURGHhelp,INFR11098help,SECURE PROGRAMMINGhelp,UNIVERSITY OF EDINBURGH作业代写,INFR11098作业代写,SECURE PROGRAMMING作业代写,UNIVERSITY OF EDINBURGH编程代写,INFR11098编程代写,SECURE PROGRAMMING编程代写,UNIVERSITY OF EDINBURGHprogramming help,INFR11098programming help,SECURE PROGRAMMINGprogramming help,UNIVERSITY OF EDINBURGHassignment help,INFR11098assignment help,SECURE PROGRAMMINGassignment help,UNIVERSITY OF EDINBURGHsolution,INFR11098solution,SECURE PROGRAMMINGsolution,