IPv4 and IPv6

What Are IPv4 and IPv6?

The Internet Protocol (IP) is the fundamental communication layer of the internet, responsible for addressing and routing packets between hosts. IPv4 (Internet Protocol version 4) has been the backbone of the internet since the 1980s, while IPv6 (version 6) was developed in the 1990s to address IPv4’s limitations—most critically, the exhaustion of its 32-bit address space.

IPv4 Overview

IPv4 uses a 32-bit address space, providing approximately 4.3 billion unique addresses. Addresses are written in dotted-decimal notation (e.g., 192.168.1.1). Due to address exhaustion, technologies like NAT (Network Address Translation) and CIDR were developed as workarounds.

Key Characteristics:

  • Address size: 32 bits
  • Address notation: x.x.x.x (0–255 per octet)
  • Header size: 20–60 bytes (variable)
  • Supports broadcast, multicast, and unicast
  • Manual or DHCP-based configuration

Header Structure:

  • Version, IHL, DSCP/ECN, Total Length
  • Identification, Flags, Fragment Offset
  • TTL, Protocol, Header Checksum
  • Source IP, Destination IP
  • Options (variable)

IPv6 Overview

IPv6 uses a 128-bit address space, providing approximately 3.4 × 10³⁸ unique addresses—effectively unlimited. Addresses are written in hexadecimal colon notation (e.g., 2001:0db8:85a3::8a2e:0370:7334).

Key Characteristics:

  • Address size: 128 bits
  • Address notation: 8 groups of 4 hex digits, separated by colons
  • Header size: 40 bytes (fixed)
  • Eliminates broadcast (uses multicast instead)
  • Stateless Address Autoconfiguration (SLAAC) support
  • Built-in IPsec support (optional in practice)

IPv6 Address Types:

  • Unicast: One-to-one communication (Global, Link-local, Loopback)
  • Multicast: One-to-many (replaces broadcast)
  • Anycast: One-to-nearest

Key Differences

Feature IPv4 IPv6
Address Length 32 bits 128 bits
Address Space ~4.3 billion ~3.4 × 10³⁸
Header Variable (20–60 bytes) Fixed (40 bytes)
Fragmentation Routers and hosts Hosts only
Broadcast Supported Not supported
Configuration Manual/DHCP SLAAC/DHCPv6
NAT Common Not required
IPsec Optional Built-in (optional)
Checksum In header Removed (offloaded)

Security Implications

IPv4 Security Issues

  • IP Spoofing: Source address forgery is trivial without ingress filtering (BCP38).
  • Fragmentation Attacks: Overlapping fragment attacks can bypass firewalls (e.g., Teardrop).
  • ARP Poisoning: Within LAN, ARP has no authentication mechanism.
  • ICMP Attacks: Smurf attacks using broadcast amplification.
  • NAT Traversal: Attackers exploit NAT to hide internal topology but also to bypass detection.

IPv6 Security Issues

  • NDP Spoofing: Neighbor Discovery Protocol (NDP) replaces ARP—without SEND (SEcure Neighbor Discovery), it’s vulnerable to spoofing.
  • ICMPv6 Abuse: ICMPv6 is critical to IPv6 operation and cannot be blocked entirely, creating attack surface.
  • Extension Header Abuse: Attackers use large chains of extension headers to evade IDS/IPS inspection.
  • IPv6 Tunneling: IPv6-in-IPv4 tunnels (6to4, Teredo, ISATAP) can bypass security controls that don’t inspect tunnel content.
  • SLAAC Attacks: Rogue Router Advertisements (RA) can redirect traffic through an attacker’s machine.
  • Dual-Stack Misconfiguration: Enterprises often have robust IPv4 security policies but immature IPv6 policies, creating a “shadow” attack surface.

Penetration Testing Considerations

  • Always check if the target is dual-stack—many networks protect IPv4 tightly but leave IPv6 open.
  • Use ping6, nmap -6, and thc-ipv6 tools for IPv6 enumeration.
  • Test for RA Spoofing using tools like fake_router6 from the THC-IPv6 toolkit.
  • Check for 6to4 or Teredo tunneling in corporate environments.
  • Inspect firewall rules for IPv6 - ACLs that only apply to IPv4 are a common finding.

IPv4와 IPv6란?

인터넷 프로토콜(IP)은 인터넷의 근본적인 통신 계층으로, 호스트 간 패킷의 주소 지정 및 라우팅을 담당합니다. IPv4는 1980년대부터 인터넷의 근간을 이뤄왔으며, IPv6는 IPv4의 한계, 특히 32비트 주소 공간의 고갈 문제를 해결하기 위해 1990년대에 개발되었습니다.

IPv4 개요

IPv4는 32비트 주소 공간을 사용하여 약 43억 개의 고유 주소를 제공합니다. 주소는 192.168.1.1과 같이 점으로 구분된 십진수 표기법으로 작성됩니다. 주소 고갈 문제로 인해 NAT(Network Address Translation)와 CIDR 같은 기술이 임시방편으로 개발되었습니다.

주요 특성:

  • 주소 크기: 32비트
  • 주소 표기: x.x.x.x (각 옥텟 0–255)
  • 헤더 크기: 20–60바이트 (가변)
  • 브로드캐스트, 멀티캐스트, 유니캐스트 지원
  • 수동 또는 DHCP 기반 구성

IPv6 개요

IPv6는 128비트 주소 공간을 사용하여 약 3.4 × 10³⁸개의 고유 주소를 제공합니다. 주소는 2001:0db8:85a3::8a2e:0370:7334와 같이 16진수 콜론 표기법으로 작성됩니다.

주요 특성:

  • 주소 크기: 128비트
  • 주소 표기: 4자리 16진수 8그룹, 콜론으로 구분
  • 헤더 크기: 40바이트 (고정)
  • 브로드캐스트 제거 (멀티캐스트로 대체)
  • 상태 비저장 주소 자동 구성(SLAAC) 지원
  • IPsec 내장 (실제 사용은 선택적)

핵심 차이점

기능 IPv4 IPv6
주소 길이 32비트 128비트
주소 공간 약 43억 개 약 3.4 × 10³⁸ 개
헤더 가변 (20–60바이트) 고정 (40바이트)
단편화 라우터와 호스트 호스트만
브로드캐스트 지원 미지원
구성 방식 수동/DHCP SLAAC/DHCPv6
NAT 일반적 불필요
IPsec 선택적 내장 (선택적)
체크섬 헤더 포함 제거 (오프로드)

보안 관점에서의 시사점

IPv4 보안 취약점

  • IP 스푸핑: 인그레스 필터링(BCP38) 없이는 소스 주소 위조가 쉽습니다.
  • 단편화 공격: 중첩 단편 공격으로 방화벽 우회 가능 (예: Teardrop).
  • ARP 포이즈닝: LAN 내에서 ARP는 인증 메커니즘이 없습니다.
  • ICMP 공격: 브로드캐스트 증폭을 이용한 Smurf 공격.
  • NAT 횡단: 공격자가 NAT를 악용하여 내부 토폴로지를 숨기거나 탐지를 우회합니다.

IPv6 보안 취약점

  • NDP 스푸핑: ARP를 대체하는 NDP(Neighbor Discovery Protocol)는 SEND(SEcure Neighbor Discovery) 없이 스푸핑에 취약합니다.
  • ICMPv6 악용: ICMPv6는 IPv6 동작에 필수적이라 완전히 차단할 수 없어 공격 표면이 됩니다.
  • 확장 헤더 악용: 공격자는 긴 확장 헤더 체인을 이용해 IDS/IPS 검사를 우회합니다.
  • IPv6 터널링: 6to4, Teredo, ISATAP 터널은 터널 내용을 검사하지 않는 보안 장비를 우회할 수 있습니다.
  • SLAAC 공격: 악의적인 라우터 광고(RA)를 통해 트래픽을 공격자 장비로 유도할 수 있습니다.
  • 듀얼스택 잘못된 구성: 기업 환경에서 IPv4 보안 정책은 강력하지만 IPv6 정책은 미흡한 경우가 많아 “그림자” 공격 표면이 생깁니다.

침투 테스트 시 고려 사항

  • 타겟이 듀얼스택인지 항상 확인하세요. 많은 네트워크가 IPv4는 철저히 보호하지만 IPv6는 열어두는 경우가 있습니다.
  • IPv6 열거를 위해 ping6, nmap -6, thc-ipv6 도구를 활용하세요.
  • THC-IPv6 툴킷의 fake_router6 등을 이용해 RA 스푸핑을 테스트하세요.
  • 기업 환경에서 6to4 또는 Teredo 터널링을 확인하세요.
  • IPv6에 대한 방화벽 규칙도 점검하세요. IPv4에만 적용되는 ACL은 흔히 발견되는 취약점입니다.