7
Introduction to Software Security The 7 th Quiz Computer Security & OS Lab Dept. of Software Science, DKU Cho, Seong-je (조성제) Spring, 2020

Introduction to Software Securitysecuresw.dankook.ac.kr/ISS20-1/ISS_2020 Quiz_7.pdf · 2020-04-29 · 524660, S’20 Solving & Writing - 6 - Solve the question individually (by yourself)

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Introduction to Software Securitysecuresw.dankook.ac.kr/ISS20-1/ISS_2020 Quiz_7.pdf · 2020-04-29 · 524660, S’20 Solving & Writing - 6 - Solve the question individually (by yourself)

Introduction to Software Security

The 7th Quiz

Computer Security & OS LabDept. of Software Science, DKU

Cho, Seong-je (조성제)

Spring, 2020

Page 2: Introduction to Software Securitysecuresw.dankook.ac.kr/ISS20-1/ISS_2020 Quiz_7.pdf · 2020-04-29 · 524660, S’20 Solving & Writing - 6 - Solve the question individually (by yourself)

- 2 -

7번째 Quiz에 대한 가이드라인

3번, 4번, 5번 슬라이드 문제를 풀어서, Quiz 보고서로 제출 바랍니다.

실습용으로 구축하여 제공한 Linux Ubuntu에서 실습하는 것을 권장합니다.

실습용 Ubuntu에 프로그램 편집기 vim 을 설치하였습니다.

실습 환경에서 문제가 생기면, 연락 주기 바랍니다. (유근하 조교선생에게 연락해도 됩니다.)

Quiz 풀이를 통해 수업 시간에 설명한 내용을 이해하기 바랍니다.

참고로, 유근하 조교가 제공한 Linux 실습 환경은 다음과 같습니다. (uname –a명령 실행 결과)

Computer Security & OS Lab, DKU

Linux ubuntu 5.3.0-46-generic #38~18.04.1-Ubuntu SMP Tue Mar 31 04:17:56 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Page 3: Introduction to Software Securitysecuresw.dankook.ac.kr/ISS20-1/ISS_2020 Quiz_7.pdf · 2020-04-29 · 524660, S’20 Solving & Writing - 6 - Solve the question individually (by yourself)

- 3 -

Answer the following 8 sub-questions (①②③④, ⑤⑥⑦⑧)

Computer Security & OS Lab, DKU

ubuntu:~$ gcc –m32 –o cmu1 cmu.c

ubuntu:~$ ./cmu1

(1) cmu.c를 위와 같이 컴파일하여 실행하였을 경우, ①②③④의 값은?

그 이유도 설명하시오.

① cmu[7] = ? ② cmu[11] = ? ③ucb[-5] = ? ④ucb[-10] = ?

--------------------------------------------------------------------------------------------------------------

(2) cmu.c를 아래와 같이 컴파일하여 실행하였을 경우, ⑤⑥⑦⑧ 의 값은?

그 이유도 설명하시오.

ubuntu:~$ gcc -fno-stack-protector –m32 -o cmu0 cmu.c

ubuntu:~$ ./cmu0

⑤ cmu[-3] = ? ⑥ cmu[-7] = ? ⑦ ucb[8] = ? ⑧ ucb[12] = ?

// File name: cmu.c

// Ubuntu on x86 architecture

#include <stdio.h>

typedef int zip_dig[5];

int main() {

zip_dig cmu = {1, 5, 2, 1, 3};

zip_dig mit = {0, 2, 1, 3, 9};

zip_dig ucb = {9, 4, 7, 2, 0};

printf("0x%x\n", cmu);

printf("0x%x\n", mit);

printf("0x%x\n", ucb);

}

Page 4: Introduction to Software Securitysecuresw.dankook.ac.kr/ISS20-1/ISS_2020 Quiz_7.pdf · 2020-04-29 · 524660, S’20 Solving & Writing - 6 - Solve the question individually (by yourself)

- 4 -

Find all errors including the off-by-one errors in this program.

Computer Security & OS Lab, DKU

You should also show the corrected version of this program.

(아래 프로그램에서 off-by-one error들을 포함하여 모든 오류들을 찾고,

그 오류들을 정정한 버전을 보이시오)

Page 5: Introduction to Software Securitysecuresw.dankook.ac.kr/ISS20-1/ISS_2020 Quiz_7.pdf · 2020-04-29 · 524660, S’20 Solving & Writing - 6 - Solve the question individually (by yourself)

- 5 -

Write & Compile the c_lib.c and Execute it’s binary

오른쪽의 c_lib.c 프로그램을 작성한 다음 컴파일하고,

컴파일된 프로그램을 실행하여 그 결과를 보이시오.

컴파일 시. 프로그램의 실행 파일 이름이 c_lib가 되도록

하시오.

실행 결과를 보고, 실행 결과를 설명하시오.

실행하기 전,

(1) cmu.c 프로그램이 현재 디렉토리에 있는지

(2) quiz7 서브 폴더(subfolder)도 존재하는지 확인한

후에 c_lib를 실행해야 합니다.

만약, quiz7 서브 폴더가 없다면, 다음 명령어로 생성

바랍니다.

$ mkdir quiz7

여러 학생들이 동시에 수행하면, 서로 결과가 엉킬 수도

있으니, 각자 다른 폴더를 생성하여 실험하면 더

좋습니다.

Computer Security & OS Lab, DKU

1. #include <stdio.h> /* c_lib.c */

2. #include <stdlib.h>

3. #include <string.h>

4. main() {

5. char buffer[50];

6. printf("Please make sure that the quiz7 subfolder exists.\n");

7. sprintf(buffer, "cp cmu.c quiz7");

8. system(buffer);

9. system("gcc -o quiz7/cmu quiz7/cmu.c");

10. system("ls -l quiz7");

11. sprintf(buffer, "file");

12. strcat(buffer, “ quiz7/cmu");

13. system(buffer);

14. }

Page 6: Introduction to Software Securitysecuresw.dankook.ac.kr/ISS20-1/ISS_2020 Quiz_7.pdf · 2020-04-29 · 524660, S’20 Solving & Writing - 6 - Solve the question individually (by yourself)

524660, S’20

- 6 -

Solving & Writing

Solve the question individually (by yourself).

You must write a report including the answers to the quizzes by yourself.

No cheating

The cover page of the report must include

Title (제목): “The 7th Quiz of Intro. to SW Security”

분반 (2분반 또는 3분반)

Student name, Student number

Date of submission

Deadline

Submit your report by 3rd May

Computer Security & OS Lab., DKU

Page 7: Introduction to Software Securitysecuresw.dankook.ac.kr/ISS20-1/ISS_2020 Quiz_7.pdf · 2020-04-29 · 524660, S’20 Solving & Writing - 6 - Solve the question individually (by yourself)

524660, S’20

- 7 -

Submission

File naming of the answer report for the 7th Quiz

ISS(분반)_Qz7_이름_학번_mmdd

If you are in the 2nd class, name = “전우치”, student number = 32171234,

submission date = 1st May, then the filename for this Quiz is

ISS(2)_Qz7_전우치_32171234_0501

Submit your report to TA by email.

Email title: “ SW보안개론(분반) 7번 Quiz 답안 제출”

The title for the 2nd class: “SW보안개론(2) 7번 Quiz 답안 제출”

The title for the 3rd class: “SW보안개론(3) 7번 Quiz 답안 제출”

TA: 한승재 (Seungjae Han) [email protected]

Computer Security & OS Lab., DKU