Computer >> Hướng Dẫn Máy Tính >  >> Kết Nối Mạng >> An Ninh Mạng

Tại sao mô hình OSI quan trọng trong an ninh mạng?

Mô hình OSI & An ninh mạng: Nền tảng tư duy hệ thống

Mô hình OSI (Open Systems Interconnection) 7 tầng không chỉ là lý thuyết học thuật – là ngôn ngữ chung (lingua franca) để các chuyên gia an ninh giao tiếp, thiết kế kiến trúc, phân tích lỗ hổng, và triển khai kiểm soát (controls) một cách có hệ thống.

7 Tầng OSI & Ánh xạ Control An ninh

TầngTênChức năng chínhKiểm soát bảo mật điển hìnhVí dụ công cụ
7ApplicationGiao diện người dùng, nghiệp vụWAF, API Gateway, Secure Coding, AuthZ/AuthN, DLP, Email SecurityModSecurity, Kong, Okta, Proofpoint
6PresentationMã hóa, nén, serialize, encodingTLS/SSL Config, Certificate Mgmt, JWT/JWE, S/MIME, PGPOpenSSL, Let's Encrypt, cert-manager, HashiCorp Vault
5SessionThiết lập, duy trì, kết thúc phiênSession Management, Secure Cookie, TLS Session Resumption, RPC SecuritySpring Session, Redis Session Store, TLS 1.3 PSK
4TransportTruyền tin cậy, đa luồng, kiểm soát lưu lượngStateful Firewall, TCP SYN Cookie, Rate Limiting, DDoS Protection, QUIC/TLSiptables/nftables, Palo Alto, Cloudflare, AWS Shield
3NetworkĐịnh tuyến, định địa chỉ, phân mảnhIPsec VPN, ACL, uRPF, BGPsec, RPKI, FlowSpec, DDoS ScrubbingCisco ASA/FTD, StrongSwan, Cloud Router, Arbor/Akamai
2Data LinkKhung truyền, truy cập môi trường, MACPort Security, 802.1X/NAC, DAI, IP Source Guard, BPDU Guard, MACsec, Private VLANCisco ISE, Aruba ClearPass, FortiSwitch, MACsec
1PhysicalBिट truyền trên môi trường vật lýPhysical Access Control, Cable Security, Port Disable, TEMPEST, Fiber MonitoringData Center Physical Sec, Port Lock, OTDR

Tại sao OSI quan trọng cụ thể cho Security?

1. Phân loại & Định vị lỗ hổng (Vulnerability Mapping)

  • CVE thường ghi rõ layer: CVE-2021-44228 (Log4Shell) → L7; CVE-2022-0778 (OpenSSL infinite loop) → L6; TCP SYN Flood → L4; IP Spoofing → L3; ARP Spoofing → L2
  • Giúp ưu tiên vá: L7 (App) thường patch nhanh nhất (code change), L1/L2 khó hơn (hardware/config change)

2. Thiết kế kiến trúc Defense in Depth (DiD)

  • Mỗi tầng = một lớp phòng thủ. Kẻ tấn công phải vượt qua tất cả.
  • Ví dụ: Internet → [L3: Edge Router ACL + DDoS Scrubbing] → [L4: Perimeter FW Stateful + IPS] → [L7: WAF + API Gateway] → [L7: App Secure Code + AuthZ] → Data
  • Thiếu tầng nào → "Swiss cheese model" lỗ hổng xuyên suốt

3. Phân tích tác động & Blast Radius

  • Compromise ở L7 (App) → Rò rỉ dữ liệu app
  • Compromise ở L4 (TCP Hijack) → Chuyển hướng/trao đổi session
  • Compromise ở L3 (BGP Hijack) → Lộ toàn bộ prefix traffic
  • Compromise ở L2 (ARP Spoof) → MITM toàn bộ VLAN
  • Compromise ở L1 (Fiber Tap) → Passive sniff mọi thứ

4. Lựa chọn & Cấu hình công cụ phù hợp

  • Cần inspect L7 payload? → WAF, Proxy, NGFW với App-ID, SSL Decrypt
  • Cần block DDoS volumetric? → L3/L4: Cloud Scrubbing, SYN Cookie, Rate Limit
  • Cần ngăn lateral movement trong LAN? → L2: Micro-segmentation, 802.1X, MACsec, Private VLAN
  • Cần bảo mật kết nối site-to-site? → L3: IPsec VPN (ESP/AH)

5. Giao tiếp không двусмыслен (Unambiguous Communication)

  • "Block ở Layer 4" = Block port/IP (Firewall/ACL)
  • "Block ở Layer 7" = Block HTTP method/URL/JSON field (WAF)
  • "Encrypt Layer 3" = IPsec (Site-to-Site VPN)
  • "Encrypt Layer 4" = TLS (HTTPS, SMTPS)
  • "Encrypt Layer 2" = MACsec (802.1AE)

6. Tuân thủ & Audit (Compliance)

  • PCI DSS, ISO 27001, NIST 800-53 yêu cầu kiểm soát tại nhiều tầng
  • Mapping control → OSI layer giúp chứng minh coverage đầy đủ
  • Ví dụ: PCI DSS Req 1 (Firewall) → L3/L4; Req 3 (Protect Stored Data) → L6/L7; Req 4 (Encrypt Transmission) → L4 (TLS) / L3 (IPsec)

7. Threat Modeling Có cấu trúc (STRIDE per Layer)

TầngSpoofingTamperingRepudiationInfo DisclosureDoSElevation of Privilege
L7 AppCredential theftSQLi, XSSMissing audit logData leakApp DoSPriv esc via bug
L6 PresCert spoofCipher downgradeLog tamperingPlaintext leakCrypto DoSKey extraction
L5 SessSession hijackSession fixationSession log gapSession replaySession exhaustionSession prediction
L4 TransIP/Port spoofTCP RST injectStateless firewallTraffic sniffSYN FloodPort binding
L3 NetIP SpoofingRoute injectBGP log gapTraffic interceptVolumetric DDoSRouting table poison
L2 LinkARP/MAC SpoofVLAN HopSwitch log gapLAN SniffMAC FloodSTP Root Takeover
L1 PhysDevice impersonationCable tap/modifyNo physical logEM RadiationCable cut/PowerConsole access

OSI vs TCP/IP Model trong thực tế

Mạng thực tế dùng TCP/IP 4/5 tầng (Link, Internet, Transport, Application). OSI 7 tầng là khung tham chiếu (reference model) chi tiết hơn – tách Presentation/Session ra khỏi Application. Security pro cần thành thạo CẢ HAI:

  • TCP/IP: Triển khai, troubleshoot, config thiết bị thực
  • OSI: Thiết kế kiến trúc, threat modeling, compliance mapping, vendor evaluation

Kết luận

Mô hình OSI quan trọng trong an ninh mạng vì nó cung cấp:

  1. Framework phân tầng để áp dụng Defense in Depth
  2. Ngôn ngữ chuẩn cho vulnerability, control, tool, compliance
  3. Cơ sở threat modeling có hệ thống (STRIDE per layer)
  4. Tiêu chí lựa chọn công cụ đúng layer, đúng mục đích
  5. Visibility end-to-end từ bit trên dây cáp đến business logic

Security pro không thành thạo OSI = Kiến trúc sư không biết bản vẽ kỹ thuật.