Skip to content

Cloud NGFW — Layer 7 Inspection và Phòng Chống Xâm Nhập

Giới Hạn Của VPC Firewall Truyền Thống

VPC firewall rules và hierarchical policies hoạt động ở Layer 3/4 — chúng biết về IP addresses, ports, và protocols. Nhưng trong nhiều threat scenarios, Layer 3/4 filtering không đủ:

  • Một kết nối hợp lệ đến port 443 (HTTPS) vẫn có thể là malware command-and-control
  • Một egress request đến domain hợp lệ (ví dụ: s3.amazonaws.com) có thể là data exfiltration
  • SQL injection xảy ra tại Layer 7 — packet vẫn có valid IP và port
  • DNS-based exfiltration dùng port 53 (không bị block bởi L3/4 firewall)

Cloud NGFW (Next Generation Firewall) là câu trả lời của GCP cho những gaps này. Nó bổ sung khả năng Layer 7 inspection — hiểu nội dung của traffic, không chỉ IP/port.

Kiến Trúc: Intercepted Traffic Path

Cloud NGFW khác về cơ bản so với VPC firewall ở chỗ nó cần intercept traffic để inspect payload. Trong khi VPC firewall enforce tại Andromeda agent trên hypervisor, Cloud NGFW hoạt động theo model khác:

GCP Cloud NGFW Enterprise dùng Palo Alto Networks' threat detection engine (thông qua partnership). Traffic bị redirect đến NGFW inspection layer:

Normal flow (VPC firewall):
VM → [Andromeda checks L3/4 firewall] → Destination

Cloud NGFW flow:
VM → [Andromeda L3/4 check] → [Traffic redirect to NGFW inspection] → [L7 check] → Destination

Việc redirect này tạo overhead — nhưng đó là trade-off cần thiết để có L7 inspection.

Cloud NGFW: Ba Tiers

GCP cung cấp NGFW theo ba tiers với capabilities khác nhau:

Tier 1: Cloud NGFW Essentials

Features:

  • FQDN-based rules (route/block traffic dựa trên domain name)
  • GeoIP filtering (block traffic từ/đến countries cụ thể)
  • Network threat intelligence (block known malicious IPs)

Không cần redirection — rules này được enforce tại layer firewall policy.

Tier 2: Cloud NGFW Standard

Features (thêm vào Essentials):

  • Intrusion Prevention System (IPS): detect và block known attack signatures
  • Layer 7 application identification
  • URL filtering

Tier 3: Cloud NGFW Enterprise

Features (thêm vào Standard):

  • TLS/SSL inspection (decrypt và inspect encrypted traffic)
  • Advanced threat detection (Palo Alto engine)
  • Advanced malware detection
  • Sandboxing (execute suspicious files để detect malware)

FQDN-Based Rules: DNS Integration

FQDN (Fully Qualified Domain Name) rules cho phép write rules như "block traffic đến malware-c2.example.com" mà không cần biết IP address.

bash
# Tạo NGFW endpoint
gcloud network-security firewall-endpoints create prod-ngfw-endpoint \
  --zone=us-west1-a \
  --organization=<ORG_ID>

# Tạo security profile với FQDN rules
gcloud network-security security-profiles create prod-threat-profile \
  --type=THREAT_PREVENTION \
  --organization=<ORG_ID>

# Trong Network Firewall Policy với NGFW action
gcloud compute network-firewall-policies rules create 1000 \
  --firewall-policy=prod-policy \
  --action=apply_security_profile_group \
  --security-profile-group=prod-threat-profile \
  --target-secure-tags=env:production

Cơ Chế FQDN Resolution

Khi rule có FQDN target:

  1. GCP resolve FQDN → IP addresses (bằng Cloud DNS hoặc public DNS)
  2. Khi VM cố kết nối đến IP, GCP check nếu IP đó thuộc FQDN trong rule
  3. Nếu match → apply rule (block/allow)

Vấn đề kỹ thuật với FQDN rules:

DNS TTL và caching có thể cause issues. Nếu domain resolve sang IP mới, có khoảng gap giữa khi IP thay đổi và khi GCP update FQDN-to-IP mapping.

Kịch bản: malware-c2.example.com thay đổi IP từ 1.2.3.4 → 5.6.7.8

FQDN rule: block malware-c2.example.com
GCP resolution: malware-c2.example.com = 1.2.3.4 (cached)

New IP 5.6.7.8 chưa bị resolve:
→ Traffic đến 5.6.7.8 KHÔNG bị block (gap trong protection)
→ Sau khi GCP re-resolve: gap đóng lại

Đây là limitation inherent của DNS-based security — không có cách hoàn toàn tránh gap này.

IDS/IPS: Signature-Based Threat Detection

IDS (Intrusion Detection System) và IPS (Intrusion Prevention System) detect các known attack patterns trong traffic.

IDS mode: Detect và log, không block IPS mode: Detect và block (plus log)

GCP sử dụng threat signatures từ Palo Alto Networks để identify:

  • Network exploits (buffer overflows, shellcodes)
  • Malware command-and-control patterns
  • Data exfiltration patterns
  • Scanning và enumeration activities

Tại Sao IPS Không Phải Silver Bullet

IPS chỉ hiệu quả với known threats (có signature). Zero-day attacks — attacks chưa có signature — sẽ không bị detect.

Known threat: Attacker dùng CVE-2024-XXXX exploit
  → IPS có signature → BLOCK ✓

Zero-day: Attacker dùng exploit chưa ai biết
  → IPS không có signature → PASS ✗

Vì vậy, IPS là lớp bảo vệ bổ sung, không phải thay thế cho defense-in-depth strategy.

TLS Inspection: Nhìn Vào Encrypted Traffic

70-80% internet traffic hiện tại là TLS/HTTPS. IDS/IPS không thể inspect encrypted payload — attacker biết điều này và dùng HTTPS cho C2 traffic.

TLS inspection (chỉ có ở NGFW Enterprise) giải quyết vấn đề bằng cách:

  1. Intercept TLS connection từ client (VM)
  2. Terminate TLS tại NGFW (NGFW đóng vai trò MITM - Man In The Middle)
  3. Inspect plaintext payload
  4. Forward đến server với new TLS connection
  5. Decrypt response và inspect
  6. Return response đến VM
Bình thường:
VM → [TLS Handshake] → Server
     [Encrypted payload, NGFW cannot inspect]

Với TLS Inspection:
VM → [TLS to NGFW] → NGFW → [Inspect plaintext] → [TLS to Server] → Server
     [VM thấy NGFW cert]     [NGFW thấy plaintext]

Requirements và Considerations Của TLS Inspection

Certificate trust chain: VM phải trust NGFW's CA certificate. Nếu không, VM nhận certificate từ NGFW (không phải server), và nếu VM không trust NGFW CA → TLS handshake fail.

Phải deploy NGFW CA certificate vào trust store của tất cả VMs trong scope.

Không inspect được:

  • Certificate pinning (app explicitly expects server cert fingerprint)
  • Mutual TLS (client cert authentication — NGFW không có client cert)
  • Some protocols over TLS that don't start with standard TLS handshake

Privacy và compliance implications: TLS inspection có nghĩa là NGFW đọc nội dung tất cả HTTPS connections trong scope. Điều này có thể vi phạm privacy expectations hoặc compliance requirements (ví dụ: HIPAA Protected Health Information trong HTTPS connections).

Performance impact: TLS inspection thêm latency (decrypt, inspect, re-encrypt). Với traffic volume cao, NGFW endpoint capacity cần được size đúng.

Sizing NGFW Endpoint

NGFW endpoint có giới hạn throughput. Với Cloud NGFW Enterprise:

  • Mỗi endpoint có throughput limit
  • Cần deploy nhiều endpoints cho high-traffic environments
  • Endpoints là zonal — cần endpoints trong mỗi zone nếu muốn HA
bash
# Cho high-availability, deploy endpoints trong nhiều zones
gcloud network-security firewall-endpoints create ngfw-us-west1-a \
  --zone=us-west1-a

gcloud network-security firewall-endpoints create ngfw-us-west1-b \
  --zone=us-west1-b

gcloud network-security firewall-endpoints create ngfw-us-west1-c \
  --zone=us-west1-c

Traffic sẽ được automatically routed đến healthy endpoint trong cùng zone.

Cloud NGFW vs Third-Party NVA: Khi Nào Dùng Gì?

Nhiều organizations đã có investments trong third-party firewalls (Palo Alto Networks VM-Series, Fortinet, Check Point). Câu hỏi: Cloud NGFW hay self-managed NVA?

Khía cạnhCloud NGFWSelf-managed NVA
Deployment complexityLow (GCP-managed)High (manage VM, HA, scaling)
Feature setGCP-standardFull NVA features
IntegrationNative GCP (Cloud Logging, etc.)Cần manual integration
CustomizationLimitedFull control
Cost modelPay-per-usePay for VMs + licenses
HAManaged by GCPPhải tự setup (ILB + MIG)
Existing licensesN/A (GCP bills)Có thể BYOL

Recommendation: Cloud NGFW là tốt cho organizations không có existing NVA investments hoặc muốn minimize operational overhead. Third-party NVA phù hợp hơn khi cần advanced features, existing licenses, hoặc deep customization.

Failure Mode: NGFW Endpoint Failure

Nếu NGFW endpoint fail và không có healthy endpoint trong zone, điều gì xảy ra?

Default behavior: Traffic bị block (fail-closed). Đây là security-first default — traffic không bị allow bypass inspection khi NGFW down.

Điều này có production implications: NGFW endpoint failure → traffic interruption. Cần:

  • Multiple endpoints per zone (không có GCP-managed HA cho NGFW endpoints — bạn phải tạo nhiều endpoints)
  • Health monitoring và alerting cho endpoint status
  • Runbook cho NGFW endpoint recovery

References