Network Security Basics

Eunji·2025년 12월 8일

System Security

목록 보기
16/16

패킷은 해저 케이블로 전달된다.

IP Address: the Original Scheme

  • Calssful Addressing Scheme (1981 - 1993)
  • IPv4 Address
  • 32 bit = 4 byte
  • 클래스(A~E) / 네트워크 ID / 호스트 ID

CIDR Scheme: Classless Inter-Domain Rounting

  • 1993 ~
  • IP주소/접두사길이
    • 접두사 길이 = 서브넷 마스크에서 1로 채워진 비트 수

32bit IPv4 주소와 클래스 방식만으로 빠르게 늘어나는 기기를 다 수용하기 어려워 네트워크 경계를 1비트 단위로 쪼개서 할당하는 CIDR 등장

  • What is the address range of the network 192.168.192.0/19?
    • /19 앞의 19 bit \rightarrow 네트워크 ID
    • 32 - 19 = 13 bit \rightarrow 호스트 ID

Special IP Addresses

  • Private IP Addresses
    • 10.0.0.0/8
    • 172.16.0.0./12
    • 192.168.0.0/16
  • Loopback Address
    • 127.0.0.0/8
    • Commonly used: 127.0.0.1

Network Address Translation (NAT)

  • 라우터 내부 네트워크에서는 192.168.60.1 같은 사설 IP를 사용하고 인터넷과 통신할 때는 ISP로부터 할당받은 공인 IP 사용
  • 내부 여러 PC에서 나가는 패킷을 이 공인 IP 하나와 서로 다른 포트 번호에 mapping

List IP Address on Network Interface

  • lo: 컴퓨터 내부 통신, 자기 자신
  • enp0s3: 외부 네트워크 연결에 사용되는 장치명

1. Manually Assign IP Address

2. Automatically Assign IP Address

대부분 자동으로 IP Address를 할당한다.

  • DHCP: Dynamic Host Configuration Protocol

Get IP Addresses for Host Names: DNS

DNS: Domain Name Service

Pros

  1. 서버의 IP Address가 변경되더라도 DNS 레코드만 갱신하면 traffic이 자동으로 새로운 IP로 연결
  2. 사람이 기억하기 어려운 숫자 형태의 IP 대신 기억하기 쉬움

1. Network Attacks

1.1 Network Attacks

Old days

  • Worm: self-spreading malware

네트워크를 타고 자가 복제로 남을 감염시킨다.

Basic step

  • Scan: find a victim
  • Infect: delever a malicious payload

Advanced

  • Web: drive-by downloaded
  • Bot: control a victim
  • Denial of service: flood a victim(or her network)
  • Others: online social network, spam, ...

1.2 Virus vs. Work

Virus

  • malicious program that spreads using a propagation technique that generally requires user intervention, and always has a malicious intent

감염시키고자 하는 숙주(sw)가 존재해야 하고 항상 악의적인 의도를 품고 있다.

Worm

  • to self-propagate, and may or may not have malicious intent

Malware 자체가 worm으로 악의적인 의도가 없을 수도 있다.

  1. Morris worm
    • Infected approximately 6,000 machine
    • The first compueter worm
    • Buffer overflow vulnerablity in fingerd
  2. Code Red worm
    • Infected more than 500,000 servers

CodeRed Case

  • Overflow 시킨 후 감염

1.3 Worm Spreading Model


2. Network Intrusion

2.1 Network Intrusion

  • A set of actions aimed to compromise the security goals, namely
    • Integrity, confidentiality, or avaliability, of a computing and networking resource
    • i.e., CIA model

2.2 How to Find a Victim

Scan a network

  • Send a packets to find a host with open network services
  • E.g., a host serving Apache web server (port 80이면)

2.3 Scanning Technique

1. TCP

  • SYN scan: check if a recipient returns a SYN/ACK packet
  • FIN scan: check if a recipient returns an RST packet

상대방이 SYN/ACK 패킷을 반환하면 해당 port가 열려 있음을 의미한다.

2. UDP

  • Send a UDP packet to a random port
    • If a port is open: no response
    • If a port is closed: ICMP port unreachable

열린 port는 응답하지 않고 닫힌 port는 오류 메시지를 전송한다.

3. ICMP

  • Check if a host is reachable
  • ping

2.4 Nmap

  • Popular network scanning tool
  • Example commands
    • $ nmap scanme.nmap.org
      • This option scans all reserved TCP ports on the machine
    • $ nmap -sS -O scanme.nmap.org/24
      • Launches a stealth SYN scan against each machine that is up out of the 256 IPs on the class C sized network whee Scanme resides
      • root privileges

특정 IP에 대해서 TCP, UDP가 몇 번이 열려있는가, 안 열려있는가 한 번에 scanning해줌

Aggressive OS guesses

  • 운영체제마다 패킷 헤더의 특정 필드 값을 고유하게 사용
  • Time To Live: Linux - 128, Window - 64로 시작하는 경우가 많다.
  • TTL, port pattern, kernel version 등의 정보를 종합하면 상대방 OS를 추정하여 공격에 활용할 수 있다.

How to Prevent Scanning을 막으려면?

  • 탐지되지 않도록 위장하는 방법 사용
  • TTL은 IP 헤더의 필드로, 패킷이 다른 장치를 거칠 때마다 1씩 감소
    • 0이 되면 패킷 전달 종료
  • E.g., 원래 TTL이 256인 경우 이를 128로 설정하여 위장할 수 있다.

3. Advanced Techniques

  • Malware propagation approach that abuses web browser as the mechanism to connect computer users to servers that have malware

추적 방지를 위해 덫을 건다.

3.1 Drive-by Download

Landing site

  • First site that a client visits
  • Redirect to a hop point or distribution site
    • Using iframe or JavaScript

Hop point

  • Relay points
  • Redirect to a next hop or a target site
    • Using iframe or JavaScript

Malware districution site

  • Final destination site that has malware

3.2 Bot

  • A software application that runs automated tasks over the Internet

malware의 한 종류로 좀비와 같다.

Type

  • Commercial purpose
    • Web spider - crawling
  • Malicios purpose
    • Botnet

3.3 Botnet

Bot(Zombie)

  • Compromised computer controlled by malware(bot-code) without owner consent/knowledge

Botnets(Bot Armies)

  • Networks of bots controlled by criminals

3.4 Denial of Service

  • An attempt to make a machine or network resource unavaliable to its intended users
  • Commonly knowns as
    • (D)Dos attack
    • TCP SYN flooding
    • And many more
  • 공격자는 다수의 클라이언트처럼 위장하여 다량의 SYN 패킷을 서버로 전송
  • 서버는 각 요청에 대해 SYN-ACK을 반환하고, 3-way handshake를 마치기 위해 클라이언트 응답을 기다리며 버퍼에 저장
  • 공격자는 실제 ACK 응답을 보내지 않으므로 서버의 버퍼가 가득 차서 정상 사용자의 실제 연결 요청 거부됨
  • 공격자는 TCP 헤더에서 SYN 플래그만 켠 패킷(SYN=1, ACK=0)을 수만 개 서버로 보낸다. 버퍼가 꽉 차면 서버는 새로운 SYN에 대해 더 이상 자리를 못 만들어서, 정상 사용자의 연결 요청을 받아줄 수 없게 되어 DoS 상태가 된다.

3.5 Trojan

  • A computer program that a useful function, but also has a hidden and potentially malicious function that evades security mechanisms, sometimes by exploiting legitimate authorizations of a system entity that invokes it
  • Computer security - Principles and Practice, Stallings

0개의 댓글