• Mindscape ๐Ÿ”ฅ
    • Playlist ๐ŸŽง
  • Algorithm

    • 1018๋ฒˆ: ์ฒด์ŠคํŒ ๋‹ค์‹œ ์น ํ•˜๊ธฐ
    • 1966๋ฒˆ: ํ”„๋ฆฐํ„ฐ ํ
    • Python ์‹œ๊ฐ„ ์ดˆ๊ณผ ๋ฐฉ์ง€๋ฅผ ์œ„ํ•œ ํŒ
    • C++ std::vector ์‚ฌ์šฉ๋ฒ• ์ •๋ฆฌ
    • Vim ์‚ฌ์šฉ ๋งค๋‰ด์–ผ
  • Ubuntu

    • ๋ฆฌ๋ˆ…์Šค ์šฐ๋ถ„ํˆฌ GRUB ํฐํŠธ ๋ณ€๊ฒฝ
    • ์šฐ๋ถ„ํˆฌ ์ด๋ฏธ์ง€ ๋น„๋””์˜ค ์ธ๋„ค์ผ(๋ฏธ๋ฆฌ๋ณด๊ธฐ) ์•ˆ ๋ณด์ž„ ๋ฌธ์ œ ํ•ด๊ฒฐ
    • Wine ํ™˜๊ฒฝ์—์„œ ์นด์นด์˜คํ†ก ์‹คํ–‰ ์‹œ explorer.exe ๋œจ์ง€ ์•Š๊ฒŒ ํ•˜๋Š” ๋ฒ•
    • ์šฐ๋ถ„ํˆฌ Wine ์นด์นด์˜คํ†ก ์‚ฌ์ง„ ์ด๋ฏธ์ง€ ์Šคํฌ๋ฆฐ์ƒท ๋ถ™์—ฌ๋„ฃ๊ธฐ
    • Wine ์นด์นด์˜คํ†ก ์ด๋ชจ์ง€ ๊นจ์ง ๋ฌธ์ œ ํ•ด๊ฒฐ
    • Ubuntu ์œˆ๋„์šฐ ์• ๋‹ˆ๋ฉ”์ด์…˜ ๋„๊ธฐ
  • Wellness

    • ์ฐจ์ „์žํ”ผ (Psyllium Husk)
    • ์—‘์ŠคํŠธ๋ผ ๋ฒ„์ง„ ์˜ฌ๋ฆฌ๋ธŒ์œ  (Extra Virgin Olive Oil)
    • ์ž๊ฐ€๋น„๊ฐ•์„ธ์ฒ™ (Nasal Irrigation)
    • QCY HT08 (MeloBuds Pro Plus)
    • ์ฝ˜์„œํƒ€ (Concerta)
    • ์ธ๋ฐ๋†€ (Inderal)
    • ์„คํŠธ๋ž„๋ฆฐ (Sertraline)
    • ๋ฉœ๋ผํ† ๋‹Œ (Melatonin)
    • ์น˜๊ฒฝ๋ถ€ ๋งˆ๋ชจ์ฆ
    • ๋ฐ”๋ฒจ ์Šค์ฟผํŠธ (Barbell Squat)
  • Humanities

    • Nordvik, Russia
    • North Sentinel Island
    • ๋กฑ๊ณ ๋กฑ๊ณ (Rongorongo)
    • ๋ฐ”๋กœํฌ ์Œ์•… (Baroque Music)
  • Design

    • ๊ตฌ๊ธ€์˜ ์•„์ด์ฝ˜ ๋Œ€๊ฐœํŽธ โ€” 6๋…„ ๋งŒ์˜ ์‹ค์ˆ˜ ์ธ์ •
    • ์ œ๋Ÿด๋“œ ์  ํƒ€ โ€” ๋Ÿญ์…”๋ฆฌ ์Šคํฌ์ธ  ์›Œ์น˜์˜ ์ฐฝ์‹œ์ž
    • ๋ฐ”์šฐํ•˜์šฐ์Šค โ€” ํ˜„๋Œ€ ๋””์ž์ธ์˜ ์›์ 
  • Brands

    • NOMOS Glashรผtte
    • Frรฉdรฉrique Constant
    • KZ (Knowledge Zenith)
    • ์—์ŠคํŠธ๋ผ (AESTURA)
    • JINHAO (้‡‘่ฑช)
    • Herman Miller
    • ๋ฐ์Šค์ปค (DESKER)
    • ๋ฌด์‹ ์‚ฌ ์Šคํƒ ๋‹ค๋“œ (Musinsa Standard)
  • Finance

    • ํ˜„๋Œ€์นด๋“œ ZERO โ€” Edition2 vs Edition3 ๋น„๊ต
    • ์‹ ํ•œ์นด๋“œ ์ฒ˜์Œ
    • S&P 500 ETF ํˆฌ์ž ๊ฐ€์ด๋“œ
    • ํŒŒํ‚นํ†ต์žฅ vs CMA ํ†ต์žฅ
    • ๋ฒ„ํฌ์…” ํ•ด์„œ์›จ์ด (Berkshire Hathaway)
    • ๋น„ํŠธ์ฝ”์ธ(Bitcoin)
  • Products

    • ์˜ค๋””์˜ค ์ธํ„ฐํŽ˜์ด์Šค (Audio Interface)
    • ์ฟ ๋ฃจํ† ๊ฐ€ (KURUTOGA)
    • CX31993 DAC ๋™๊ธ€
    • ํด๋ Œ์ง• ๋ฐ€ํฌ (Cleansing Milk)
    • ํ”ผ์ ฏ ํ† ์ด (Fidget Toy)
    • ThinkPad
  • Programming Languages

    • 8.0. Statement Level Control Structures
    • 8. Subprogram
    • 9. Implementing Subprogram
    • 10.1. Abstract Data Types and Encapsulation Constructs
    • 10.2. Support for Object Oriented Programming
    • 11. Concurrency
    • 12. FPL (1)
    • 13. FPL (2)
    • 14. Exception Handling and Event Handling
    • Final Exam

2024 Computer Security Final Exam

์ž‘์„ฑ 2026. 6. 12.ยท์ˆ˜์ • 2026. 6. 12.
  • ์ด 16๋ฌธํ•ญ, 100์  ๋งŒ์ 
  • 2024.12.11.

1. Define the following terms. [6์ ]

fuzzing technique

  • ์†Œํ”„ํŠธ์›จ์–ด์˜ ์ž ์žฌ์  ๋ณด์•ˆ ์ทจ์•ฝ์ ์„ ๋ฐœ๊ฒฌํ•˜๊ธฐ ์œ„ํ•ด ๋ฌด์ž‘์œ„์˜ ์œ ํšจํ•˜์ง€ ์•Š๊ฑฐ๋‚˜ ๊ธฐํ˜•์  ๋ฐ์ดํ„ฐ๋ฅผ ์ž…๋ ฅ๊ฐ’์œผ๋กœ ์ฃผ์ž…ํ•˜์—ฌ ์ถฉ๋Œ/์˜ค์ž‘๋™์„ ๋ชจ๋‹ˆํ„ฐ๋งํ•˜๋Š” ํ…Œ์ŠคํŒ… ๊ธฐ๋ฒ•

ASLR(Address Space Layout Randomization)

  • ๊ณต๊ฒฉ์ž๊ฐ€ ๋ฉ”๋ชจ๋ฆฌ ์ฃผ์†Œ๋ฅผ ์˜ˆ์ธกํ•˜๋Š” ๊ฒƒ์„ ๋ฐฉ์ง€ํ•˜๊ธฐ ์œ„ํ•ด stack, heap ๋“ฑ ์ฃผ์š” ๋ฐ์ดํ„ฐ ๊ตฌ์กฐ์˜ ๋ฉ”๋ชจ๋ฆฌ ์œ„์น˜๋ฅผ ๋ฌด์ž‘์œ„๋กœ ์žฌ๋ฐฐ์น˜ํ•˜๋Š” ๊ธฐ๋ฒ•

WโŠ•XW \oplus XWโŠ•X policy

  • ๋ฉ”๋ชจ๋ฆฌ ํŽ˜์ด์ง€๊ฐ€ write ๊ถŒํ•œ๊ณผ execute ๊ถŒํ•œ์„ ๋™์‹œ์— ๊ฐ€์งˆ ์ˆ˜ ์—†๋„๋ก ๊ฐ•์ œํ•˜๋Š” ๋ณด์•ˆ ์ •์ฑ…

2. Select all the correct explanation about a process. [5์ ]

  • (1) Process is a program in execution. (O)
  • (2) Single-threaded process has only one program counter. (O)
  • (3) Multi-threaded process has one program counter per thread. (O)
  • (4) A process has its own physical memory space. (X)

3. Select all the correct explanation about malware analysis methods. [5์ ]

  • (1) The static analysis method analyzes executable files without execution. (O)
  • (2) The dynamic analysis method analyzes malware by executing the malware in a controlled enviornment. (O)
  • (3) The static analysis method cannot analyze malware that applied with the packing techniques. (O)
  • (4) The dynamic analysis method cannot analyze malware with an encrypted code section. (X)
  • (5) The dynamic analysis method can analyze only a part of a code section. (O)

4. What are the execution results of the following code statements? [10์ ]

  1. free(NULL)
    • ์•„๋ฌด๋Ÿฐ ๋™์ž‘๋„ ์ˆ˜ํ–‰ํ•˜์ง€ ์•Š์Œ. (safe)
  2. malloc(0)
    • ๊ตฌํ˜„์— ๋”ฐ๋ผ NULL ๋˜๋Š” free ๊ฐ€๋Šฅํ•œ ๊ณ ์œ  pointer ๋ฐ˜ํ™˜
  3. realloc(p, 0) (Suppose p is not a null pointer.)
    • p๊ฐ€ ๊ฐ€๋ฆฌํ‚ค๋Š” ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ํ•ด์ œ (free(p)์™€ ๋™์ผํ•œ ํšจ๊ณผ)
  4. int *pn = new int;
    if (pn) { ... }
    else { ... }
    
    • ํ‘œ์ค€ C++์—์„œ new๋Š” ์‹คํŒจ ์‹œ NULL ๋ฐ˜ํ™˜ ๋Œ€์‹  exception์„ ๋ฐœ์ƒ์‹œํ‚ค๋ฏ€๋กœ, if ๊ฒ€์‚ฌ๋Š” ๋ฌด์˜๋ฏธํ•˜๊ฑฐ๋‚˜ ํ•ญ์ƒ true
  5. printf("%08x %08x");
    • ์ธ์ž๊ฐ€ ๋ถ€์กฑํ•˜๋ฏ€๋กœ stack ์ƒ์œ„์˜ ์ž„์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์ฝ์–ด 16์ง„์ˆ˜๋กœ ์ถœ๋ ฅ (Information leak)

5. Explain the dll injection attack and the process injection attack. [6์ ]

  • DLL Injection: ํƒ€๊ฒŸ process๊ฐ€ ์•…์„ฑ dll ํŒŒ์ผ์„ ๊ฐ•์ œ๋กœ loadํ•˜๊ฒŒ ํ•˜์—ฌ, ํ•ด๋‹น process์˜ memory space์™€ ๊ถŒํ•œ ๋‚ด์—์„œ ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•˜๋Š” ๊ธฐ๋ฒ•
  • Process Injection: ํƒ€๊ฒŸ process์˜ memory space์— ์ง์ ‘ ์•…์„ฑ ์ฝ”๋“œ๋ฅผ ์‚ฝ์ž…(write)ํ•˜๊ณ  ์‹คํ–‰ ํ๋ฆ„์„ ์กฐ์ž‘ํ•˜์—ฌ ์ด๋ฅผ ์‹คํ–‰์‹œํ‚ค๋Š” ๊ณต๊ฒฉ

6. Packing ๊ธฐ์ˆ ์— ๋Œ€ํ•˜์—ฌ ๋‹ค์Œ ๋ฌผ์Œ์— ๋‹ตํ•˜์‹œ์˜ค. [9์ ]

a. Explain the packing technology.

  • ์‹คํ–‰ ํŒŒ์ผ์˜ ์ฝ”๋“œ๋ฅผ ์••์ถ•ํ•˜๊ฑฐ๋‚˜ ๋‚œ๋…ํ™”(Obfuscation)ํ•˜์—ฌ ๋ถ„์„๊ฐ€๊ฐ€ ๋‚ด๋ถ€ ๋กœ์ง์„ ํŒŒ์•…ํ•˜๊ธฐ ์–ด๋ ต๊ฒŒ ๋งŒ๋“ค๊ณ , ์ •์  ๋ถ„์„์„ ๋ฐฉํ•ดํ•˜๋Š” ๊ธฐ์ˆ 

b. Explain how to find out whether a section is packed or not.

  • Entropy: ์„น์…˜์˜ ์—”ํŠธ๋กœํ”ผ๊ฐ€ ๋งค์šฐ ๋†’๊ฒŒ ์ธก์ •๋จ (์••์ถ•/์•”ํ˜ธํ™”๋œ ๋ฐ์ดํ„ฐ์˜ ํŠน์„ฑ)
  • Size Mismatch: VirtualSize (๋ฉ”๋ชจ๋ฆฌ์— ๋กœ๋“œ๋œ ํฌ๊ธฐ)๊ฐ€ RawSize (ํŒŒ์ผ ์ƒ์˜ ํฌ๊ธฐ)๋ณด๋‹ค ํ˜„์ €ํžˆ ํผ.
  • Section Name: ํ‘œ์ค€์ ์ด์ง€ ์•Š์€ ์„น์…˜ ์ด๋ฆ„(UPX1 ๋“ฑ) ์กด์žฌ

c. Explain the technology used by the Themida packer.

  • Themida packer technology Code Virtualization์„ ์‚ฌ์šฉ. ์›๋ณธ ์ฝ”๋“œ๋ฅผ ์ž์ฒด์ ์ธ ๊ฐ€์ƒ CPU(VM)๊ฐ€ ํ•ด์„ํ•  ์ˆ˜ ์žˆ๋Š” ๋…์ž์ ์ธ bytecode๋กœ ๋ณ€ํ™˜ํ•˜์—ฌ ์‹คํ–‰ํ•˜๊ณ , ๊ฐ•๋ ฅํ•œ anti-debugging ๋ฐ anti-tampering ๊ธฐ๋Šฅ์„ ํฌํ•จํ•จ.

7. In case of analyzing the file system of firmware, list the things that need to be analyzed. [6์ ]

  • File System Type(squashfs, cramfs, jffs2 ๋“ฑ) ์‹๋ณ„ ๋ฐ ๊ตฌ์กฐ ๋ถ„์„
  • Configuration Files: ํ•˜๋“œ์ฝ”๋”ฉ๋œ ํŒจ์Šค์›Œ๋“œ, ์•”ํ˜ธํ™” ํ‚ค, ๋„คํŠธ์›Œํฌ ์„ค์ • ์ •๋ณด
  • Kernal & Bootloader: ๋ถ€ํŒ… ์‹œํ€€์Šค ๋ฐ ์ปค๋„ ์„ค์ • ๋ถ„์„
  • Application Binaries: ์›น ์„œ๋ฒ„, ๋ฐ๋ชฌ ๋“ฑ ์‹คํ–‰ ํŒŒ์ผ์˜ ์ทจ์•ฝ์  ๋ถ„์„

8. Why a deallocation function should not throw an exception? [5์ ]

  • free๋‚˜ ์†Œ๋ฉธ์ž(Destructor)๋Š” ์˜ˆ์™ธ ์ฒ˜๋ฆฌ ๊ณผ์ •(Stack Unwinding) ์ค‘์— ํ˜ธ์ถœ๋  ์ˆ˜ ์žˆ์Œ. ๋งŒ์•ฝ ์ด๋•Œ ๋˜ ๋‹ค๋ฅธ ์˜ˆ์™ธ๊ฐ€ ๋ฐœ์ƒํ•˜๋ฉด(Double fault), ๋Ÿฐํƒ€์ž„์ด ์ด๋ฅผ ์ฒ˜๋ฆฌํ•˜์ง€ ๋ชปํ•˜๊ณ  ํ”„๋กœ๊ทธ๋žจ์„ ์ฆ‰์‹œ ๊ฐ•์ œ ์ข…๋ฃŒ(std::terminate)์‹œํ‚ค๊ธฐ ๋•Œ๋ฌธ

9. Explain how GOT (Global Offset Table) table works, and explain how an attacker can attack by modifying the GOT table. [6์ ]

  • Dynamic linking ๊ณผ์ •์—์„œ ์™ธ๋ถ€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ํ•จ์ˆ˜(printf ๊ฐ™์€)์˜ ์‹ค์ œ ๋ฉ”๋ชจ๋ฆฌ ์ฃผ์†Œ๋ฅผ ์ €์žฅํ•˜๋Š” ํ…Œ์ด๋ธ”. ํ•จ์ˆ˜ ํ˜ธ์ถœ ์‹œ PLT(Procedure Linkage Table)๋ฅผ ๊ฑฐ์ณ GOT์— ์ €์žฅ๋œ ์ฃผ์†Œ๋กœ ์ ํ”„ํ•จ.
  • Attack: GOT Overwrite. ๊ณต๊ฒฉ์ž๊ฐ€ GOT์— ์ €์žฅ๋œ ์ •์ƒ ํ•จ์ˆ˜(printf)์˜ ์ฃผ์†Œ๋ฅผ ์•…์„ฑ ์ฝ”๋“œ๋‚˜ ๊ณต๊ฒฉ ํ•จ์ˆ˜(system)์˜ ์ฃผ์†Œ๋กœ ๋ฎ์–ด์”€. ์ดํ›„ ํ•ด๋‹น ํ•จ์ˆ˜ ํ˜ธ์ถœ ์‹œ ๊ณต๊ฒฉ์ž๊ฐ€ ์˜๋„ํ•œ ์ฝ”๋“œ๊ฐ€ ์‹คํ–‰๋จ.

10. Explain about rootkit malware. How a rootkit can hide attacker's activities. [5์ ]

  • ์ •์˜: ๊ด€๋ฆฌ์ž ๊ถŒํ•œ(root)์„ ํš๋“/์œ ์ง€ํ•˜๊ณ , ์‹œ์Šคํ…œ ๋‚ด์—์„œ ์ž์‹ ์˜ ์กด์žฌ๋ฅผ ์ˆจ๊ธฐ๊ธฐ ์œ„ํ•ด ์„ค๊ณ„๋œ ์•…์„ฑ ์†Œํ”„ํŠธ์›จ์–ด ๋ชจ๋“ˆ
  • Hiding Activity
    • Kernal Object Manipulation (DKOM): ํ”„๋กœ์„ธ์Šค ๋ฆฌ์ŠคํŠธ ๋“ฑ ์ปค๋„ ๊ตฌ์กฐ์ฒด๋ฅผ ์ง์ ‘ ์กฐ์ž‘ํ•˜์—ฌ ์ž์‹ ์„ ๋ฆฌ์ŠคํŠธ์—์„œ ์ œ๊ฑฐ
    • API Hooking: ํŒŒ์ผ ํƒ์ƒ‰์ด๋‚˜ ํ”„๋กœ์„ธ์Šค ์กฐํšŒ ์‹œ์Šคํ…œ ์ฝœ์„ ๊ฐ€๋กœ์ฑ„์–ด ์ž์‹ ์˜ ํŒŒ์ผ์ด๋‚˜ ํ”„๋กœ์„ธ์Šค ์ •๋ณด๋ฅผ ๊ฒฐ๊ณผ์—์„œ ๋ˆ„๋ฝ์‹œํ‚ด.

11. Among defense methods against stack buffer overflow attack, Stack-Smashing Protector(SSP) uses 'stack guard'. Explain with a picture how SSP organized the stack frame for a function. [5์ ]

  High Address                           
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                         
โ”‚Return Addressโ”‚                         
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค                         
โ”‚     SFP      โ”‚                         
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค                         
โ”‚   Canary   โ—„โ”€โ”ผโ”€Stack Guard             
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค (Check for modification)
โ”‚ Local Buffer โ”‚                         
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                         
  Low Address                            
  • Structure: Local variable(buffer)์™€ SFP(Saved Frame Pointer) ์‚ฌ์ด์— Canary(Random variable)๋ฅผ ์‚ฝ์ž…
  • Mechanism: ํ•จ์ˆ˜ ์ข…๋ฃŒ(return) ์ง์ „์— canary๊ฐ’์ด ๋ณ€์กฐ๋˜์—ˆ๋Š”์ง€ ๊ฒ€์‚ฌ
  • Buffer overflow๋กœ ์ธํ•ด ๊ฐ’์ด ๋ฐ”๋€Œ์—ˆ๋‹ค๋ฉด ๊ณต๊ฒฉ์œผ๋กœ ๊ฐ„์ฃผํ•˜๊ณ  ํ”„๋กœ๊ทธ๋žจ ์‹คํ–‰ ์ค‘๋‹จ

12. Explain the ROP(Return-Oriented Programming) attack method with picture. Explain how the libc library binary file is used in the ROP attack. [5์ ]

  • Method: ๋ฉ”๋ชจ๋ฆฌ์— ์ด๋ฏธ ๋กœ๋“œ๋œ ์ฝ”๋“œ ์ค‘ ret(return) ๋ช…๋ น์–ด๋กœ ๋๋‚˜๋Š” ์ž‘์€ ์ฝ”๋“œ ์กฐ๊ฐ(Sequence)๋“ค์„ ์ฒด์ธ์ฒ˜๋Ÿผ gadget์œผ๋กœ ์—ฐ๊ฒฐํ•˜์—ฌ ๊ณต๊ฒฉ์ž๊ฐ€ ์›ํ•˜๋Š” ๋™์ž‘์„ ์ˆ˜ํ–‰ํ•˜๊ฒŒ ํ•˜๋Š” ๊ธฐ๋ฒ•. (Stack์— gadget๋“ค์˜ ์ฃผ์†Œ๋ฅผ ์—ฐ์†์œผ๋กœ ๋ฐฐ์น˜ํ•˜์—ฌ ret ์‹คํ–‰ ์‹œ ๋‹ค์Œ gadget์œผ๋กœ ์ด๋™)
  • libc usage: libc ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋Š” ํ”„๋กœ๊ทธ๋žจ ์‹คํ–‰ ์‹œ ๋ฉ”๋ชจ๋ฆฌ์— ๋กœ๋“œ๋˜๋ฉฐ, ๋งค์šฐ ๋ฐฉ๋Œ€ํ•œ ์ฝ”๋“œ๋ฅผ ํฌํ•จํ•˜๊ณ  ์žˆ์Œ. ๊ณต๊ฒฉ์ž๋Š” libc ๋‚ด๋ถ€์— ๋‹ค์–‘ํ•œ ๊ธฐ๊ณ„์–ด ์ฝ”๋“œ ์กฐ๊ฐ(gadget)๋“ค์„ ์กฐํ•ฉํ•˜์—ฌ ๊ฑฐ์˜ ๋ชจ๋“  ๋กœ์ง(Turing complete)์„ ๊ตฌ์„ฑํ•  ์ˆ˜ ์žˆ์–ด, NX bit(์‹คํ–‰ ๋ฐฉ์ง€) ๋ณดํ˜ธ ๊ธฐ๋ฒ•์„ ์šฐํšŒํ•˜๋Š”๋ฐ ์‚ฌ์šฉ๋จ.

13. Answer the following questions on DDoS attacks. [6์ ]

(a) What is the definition of a DDoS attack?

  • ๋ถ„์‚ฐ๋œ ๋‹ค์ˆ˜์˜ ์ข€๋น„ PC(Botnet)์„ ์ด์šฉํ•ด ํŠน์ • ๋Œ€์ƒ์—๊ฒŒ ๋™์‹œ์— ๋ง‰๋Œ€ํ•œ ์–‘์˜ ํŠธ๋ž˜ํ”ฝ์„ ์ „์†กํ•˜์—ฌ, ์‹œ์Šคํ…œ ์ž์›์„ ๊ณ ๊ฐˆ์‹œํ‚ค๊ณ  ์ •์ƒ์ ์ธ ์„œ๋น„์Šค๋ฅผ ๋ถˆ๊ฐ€๋Šฅํ•˜๊ฒŒ ๋งŒ๋“œ๋Š” ๊ณต๊ฒฉ

(b) Explain how the SYN flooding attack works.

  • ๊ณต๊ฒฉ์ž๊ฐ€ spoofed IP๋กœ ๋Œ€๋Ÿ‰์˜ SYN ํŒจํ‚ท๋งŒ ์ „์†กํ•˜๊ณ , ์„œ๋ฒ„์˜ SYN-ACK ์‘๋‹ต์— ๋Œ€ํ•ด ACK๋ฅผ ๋ณด๋‚ด์ง€ ์•Š์Œ. ์„œ๋ฒ„๋Š” ์—ฐ๊ฒฐ์„ ๋งบ๊ธฐ ์œ„ํ•ด half-open ์ƒํƒœ๋กœ ๋Œ€๊ธฐํ•˜๋ฉฐ backlog queue๋ฅผ ๊ฐ€๋“ ์ฑ„์šฐ๊ฒŒ ๋˜์–ด, ๋” ์ด์ƒ ์ƒˆ๋กœ์šด ์ •์ƒ ์—ฐ๊ฒฐ์„ ์ˆ˜๋ฝํ•  ์ˆ˜ ์—†๊ฒŒ ๋จ.

(c) Explain one or two defense mechhanism against the SYN flooding attack.

  • SYN Cookies: SYN ์š”์ฒญ ์‹œ ์„œ๋ฒ„์˜ ์ž์›(queue)๋ฅผ ํ• ๋‹นํ•˜์ง€ ์•Š๊ณ , ์—ฐ๊ฒฐ ์ •๋ณด๋ฅผ ์•”ํ˜ธํ™”ํ•˜์—ฌ sequence number(cookie)๋กœ ํด๋ผ์ด์–ธํŠธ์— ์ „์†ก. ๋‚˜์ค‘์— ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์˜ฌ๋ฐ”๋ฅธ ACK๋ฅผ ๋ณด๋‚ผ ๋•Œ๋งŒ ์ž์› ํ• ๋‹น
  • Time-out ๊ฐ์†Œ: Half-open ์ƒํƒœ์˜ ๋Œ€๊ธฐ ์‹œ๊ฐ„์„ ์ค„์—ฌ ์ž์›์„ ๋น ๋ฅด๊ฒŒ ํšŒ์ˆ˜

14. Point out lines with errors, and correct the lines. (An error can be a syntax error or a semantic error.) [7์ ]

wchar_twide_str1[] = L"0123456789";
wchar_t*wide_str2 = (wchar_t*) malloc(strlen(wide_str1) + 1);
if (wide_str2 == NULL) {
    /* handle error */
}
strcpy(wide_str2, wide_str1);
/* ...... */
free(wide_str2); wide_str2 = NULL;
  • wchar_t (Wide Character) ์‚ฌ์šฉ๊ณผ ๊ด€๋ จ๋œ ๋ฌธ๋ฒ• ๋ฐ ๋ฉ”๋ชจ๋ฆฌ ํ• ๋‹น ์˜ค๋ฅ˜์ž…๋‹ˆ๋‹ค.
  • Line 1 (Syntax Error):
    • wchar_twide_str1 โ†’ wchar_t wide_str1 (์ž๋ฃŒํ˜•๊ณผ ๋ณ€์ˆ˜๋ช… ์‚ฌ์ด ๊ณต๋ฐฑ ๋ˆ„๋ฝ)
  • Line 2 (Semantic Error):
    • strlen์€ char ๋‹จ์œ„ ๊ธธ์ด๋งŒ ๋ฐ˜ํ™˜ํ•˜๋ฉฐ, malloc์€ ๋ฐ”์ดํŠธ ๋‹จ์œ„ ํฌ๊ธฐ๋ฅผ ์š”๊ตฌํ•ฉ๋‹ˆ๋‹ค. wchar_t ๋ฌธ์ž์—ด ๊ธธ์ด ํ•จ์ˆ˜(wcslen)๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  sizeof(wchar_t)๋ฅผ ๊ณฑํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
    • ์ˆ˜์ •: (wchar_t*) malloc((wcslen(wide_str1) + 1) - sizeof(wchar_t));
  • Line 6 (Semantic Error):
    • strcpy๋Š” char* ์ „์šฉ ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค. wchar_t* ์ „์šฉ ๋ณต์‚ฌ ํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
    • ์ˆ˜์ •: wcscpy(wide_str2, wide_str1);

15. What can be wrong in the following two example code? [6์ ]

์˜ˆ์ œ 1

char dst[16];
char src[] = "0123456789";
strncpy(dst, src, sizeof(dst));
  • Safe. but inefficient
    • src์˜ ๊ธธ์ด(10)๊ฐ€ dst์˜ ํฌ๊ธฐ(16)๋ณด๋‹ค ์ž‘์Šต๋‹ˆ๋‹ค. strncpy๋Š” ๋‚จ์€ ๊ณต๊ฐ„์„ ๋ชจ๋‘ NULL๋กœ ์ฑ„์šฐ๋ฏ€๋กœ(Zero-padding), ์•ˆ์ „ํ•˜๊ฒŒ Null-terminated๋˜์ง€๋งŒ ๋ถˆํ•„์š”ํ•œ ์—ฐ์‚ฐ์ด ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

์˜ˆ์ œ 2

char dst[6];
char src[] = "0123456789";
strncpy(dst, src, sizeof(dst));
  • Dangerous - No Null Termination
    • src์˜ ๊ธธ์ด(10)๊ฐ€ dst์˜ ํฌ๊ธฐ(6)๋ณด๋‹ค ํฝ๋‹ˆ๋‹ค. strncpy๋Š” ์ •ํ™•ํžˆ 6๋ฐ”์ดํŠธ๋งŒ ๋ณต์‚ฌํ•˜๊ณ  ๋ฉˆ์ถ”๊ธฐ ๋•Œ๋ฌธ์—, dst ๋งˆ์ง€๋ง‰์— NULL ๋ฌธ์ž(\0)๊ฐ€ ์‚ฝ์ž…๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.
    • ์ดํ›„ dst๋ฅผ ๋ฌธ์ž์—ด๋กœ ์‚ฌ์šฉํ•˜๋ ค ํ•  ๋•Œ(์˜ˆ: printf, strcpy ๋“ฑ) ๋ฉ”๋ชจ๋ฆฌ ๊ฒฝ๊ณ„๋ฅผ ๋„˜์–ด ์ฝ๋Š” Buffer Over-read๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

16. ๋‹ค์Œ ์ฝ”๋“œ์— ๋Œ€ํ•˜์—ฌ ๋ฌผ์Œ์— ๋‹ตํ•˜์‹œ์˜ค. [8์ ]

/* 'user' is a string that is input from a user. */
char outbuf[512];
char buffer[512];
sprintf(buffer, "ERR Wrong command: %.400s", user);
sprintf(outbuf, buffer);

a. In line 3, how the buffer overflow can be prevented?

  • Format specifier์— Precision(์ •๋ฐ€๋„) ์ œํ•œ์ž %.400s๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ, user ์ž…๋ ฅ๊ฐ’ ์ค‘ ์ตœ๋Œ€ 400๋ฌธ์ž๊นŒ์ง€๋งŒ ์ฝ์–ด์˜ค๋„๋ก ์ œํ•œํ–ˆ๊ธฐ ๋•Œ๋ฌธ์— buffer(512 bytes) ๋„˜์นจ์„ ๋ฐฉ์ง€ํ–ˆ์Šต๋‹ˆ๋‹ค.

b. Explain whether the buffer overflow is possible or not in the above code. If so, explain your answer with a specific example.

  • ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.
  • Line 4์˜ sprintf(outbuf, buffer);์—์„œ buffer ์ž์ฒด๊ฐ€ Format String์œผ๋กœ ์‚ฌ์šฉ๋˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค (Format String Vulnerability).
  • ์˜ˆ์‹œ
    • ๊ณต๊ฒฉ์ž๊ฐ€ user ์ž…๋ ฅ๊ฐ’์œผ๋กœ "%520d"์™€ ๊ฐ™์€ ๋ฌธ์ž์—ด์„ ๋„ฃ์œผ๋ฉด, buffer์—๋Š” "ERR ... %520d"๊ฐ€ ์ €์žฅ๋ฉ๋‹ˆ๋‹ค. Line 4 ์‹คํ–‰ ์‹œ sprintf๋Š” ์ด๋ฅผ ํ•ด์„ํ•˜์—ฌ stack์˜ ๊ฐ’์„ ์ฝ์–ด 520์ž๋ฆฌ ์ˆซ์ž๋กœ ๋ณ€ํ™˜ํ•ด outbuf์— ์“ฐ๋ ค๊ณ  ์‹œ๋„ํ•ฉ๋‹ˆ๋‹ค. ์ด๋•Œ outbuf ํฌ๊ธฐ(512 bytes)๋ฅผ ์ดˆ๊ณผํ•˜์—ฌ buffer overflow๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.
์ตœ๊ทผ ์ˆ˜์ •: 26. 6. 12. ์˜คํ›„ 3:28
Contributors: kmbzn, Claude Sonnet 4.6

BUILT WITH

CloudflareNode.jsGitHubGitVue.jsJavaScriptVSCodenpm

All trademarks and logos are property of their respective owners.
ยฉ 2026 kmbzn ยท MIT License