F5 クラウドネイティブ・ネットワーク機能によるDNSセキュリティ強化

This post is also available in English (英語)

 本記事では、F5 の BIG-IP Next Cloud-Native Functions に実装された新機能をご紹介します。

Kubernetesのセキュリティ強化

アプリケーションのデプロイと公開には多数のリスク要因があるため、Kubernetes ワークロードを保護することは困難です。 CNCF では、従うべきいくつかのベスト プラクティスがリストされていますが、DNS などのプロトコルには、より専門的な強化が必要です。

F5の役割

以前の記事で述べたように、F5 CNF はより多くの機能で Kubernetes を拡張し、DDoS および不正侵入防御システム (IPS) 機能を有効にすることでクラウドネイティブ DNS インフラストラクチャの保護を提供することもできます。これらの機能は、DNS キャッシュ、トラフィックの最適化、NAT 機能と同じレイヤーで有効にできるため、セキュリティを犠牲にすることなくパフォーマンスを向上できます。

技術概要

DNS インフラストラクチャを保護するために使用できる 2 つの機能は、ポート 53 へのトラフィックを保護するための多くのパラメーターを提供する DDoS ポリシーIPS ポリシーです。これらの機能は、Kubernetes API にデプロイされたカスタム リソース定義 (CRD) を使用して構成されます。したがって、K8s とのネイティブ統合があり、選択したオートメーションまたは CI/CD ツールセットにシームレスにプラグインする機能もあります。 

以下のポリシーは、RFC 標準に準拠していない、または既知の攻撃シグネチャと一致する不正な形式の DNS パケットを含む外部攻撃から保護します。ネットワーク内に存在すべきでないベクターに対するデフォルトの軽減策を有効にしました。これにより、ベスト プラクティスが実装され、構成が簡素化されます。

以下の例はデフォルトのしきい値を示していますが、実際の値はバックエンド システムの容量、ネットワーク リンク容量、ベースライン トラフィック量などによって異なることに注意してください。値は、TMM ポッドごとのしきい値を表します。

 

DDoSポリシーカスタムリソース

以下は、DNS リスナーのカスタム リソースで参照および有効化できる DDoS ポリシーの例です。

apiVersion: "k8s.f5net.com/v1"
kind: F5BigDdosPolicy
metadata:
  name: dns-ddos-01
spec:
    hslPublisher: "publisher1"
    vectors:
      floodVectors:
        commonConfigVectors:
        - vectorType: ip-frag-flood
          state: detection-only
        - vectorType: icmpv4-flood
          state: detection-only
          perSourceIpDetectionEps: 1000
          perSourceIpLimitEps: 10000
        - vectorType: tcp-psh-flood
          state: detection-only
          perSourceIpDetectionEps: 100000
          perSourceIpLimitEps: 100000
        - vectorType: tcp-rst-flood
          state: detection-only
          perSourceIpDetectionEps: 100000
          perSourceIpLimitEps: 100000
        - vectorType: udp-flood
          state: detection-only
          perSourceIpDetectionEps: 40000
          perSourceIpLimitEps: 100000
      dnsFloodVectors:
        commonConfigVectors:
        - vectorType: dns-a-query
          state: mitigation
          detectionThresholdEps: 1
          rateLimit: 50000
          detectionThresholdEps: 1250
          rateLimit: 2500
        - vectorType: dns-aaaa-query
          state: mitigation
          detectionThresholdEps: 1250
          rateLimit: 2500
        - vectorType: dns-any-query
          state: mitigation
          detectionThresholdEps: 100
          rateLimit: 200
        - vectorType: dns-axfr-query
          state: mitigation
          detectionThresholdEps: 50
          rateLimit: 100
        - vectorType: dns-cname-query
          state: mitigation
          detectionThresholdEps: 100
          rateLimit: 200
        - vectorType: dns-ixfr-query
          state: mitigation
          detectionThresholdEps: 50
          rateLimit: 100
        - vectorType: dns-mx-query
          state: mitigation
          detectionThresholdEps: 50
          rateLimit: 100
        - vectorType: dns-ns-query
          state: mitigation
          detectionThresholdEps: 100
          rateLimit: 200
        - vectorType: dns-other-query
          state: mitigation
          detectionThresholdEps: 50
          rateLimit: 100
        - vectorType: dns-ptr-query
          state: mitigation
          detectionThresholdEps: 400
          rateLimit: 800
        - vectorType: dns-soa-query
          state: mitigation
          detectionThresholdEps: 50
          rateLimit: 100
        - vectorType: dns-srv-query
          state: mitigation
          detectionThresholdEps: 400
          rateLimit: 800
        - vectorType: dns-txt-query
          state: mitigation
          detectionThresholdEps: 400
          rateLimit: 800
        specificConfigVectors:
          dnsNxdomainQuery:
            state: mitigation
            detectionThresholdEps: 400
            rateLimit: 800
      ipV6FloodVectors:
        commonConfigVectors:
        - vectorType: ipv6-frag-flood
          state: detection-only
        - vectorType: icmpv6-flood
          state: detection-only
          perSourceIpDetectionEps: 1000
          perSourceIpLimitEps: 10000
        specificConfigVectors:
          extHdrTooLarge:
            state: detection-only
            perSourceIpDetectionEps: 100
            perSourceIpLimitEps: 1000
          lowHopCnt:
            state: detection-only
          tooManyExtHdrs:
            state: detection-only
          withExtHdrFrames:
            state: detection-only
            perSourceIpDetectionEps: 1000
            perSourceIpLimitEps: 10000
      dnsErrorVectors:
        commonConfigVectors:
        - vectorType: dns-malformed
          detectionThresholdEps: 40
        - vectorType: dns-qdcount-limit
          detectionThresholdEps: 40

このポリシーが DNS トラフィックを処理しているリスナーに適用されると、さまざまな攻撃から保護されます。

 

テストするには、scapy というツールを使用して悪意のあるパケットを作成します。

send(IP(dst="100.100.200.150")/UDP(dport=53)/DNS(id=50713,rd=1,opcode=-1,qdcount=1,ancount=0,qd=DNSQR(qname="fake1.terry.f5.com",qclass="IN",qtype="A")),count=5000,inter=0.0001)

デフォルトでこれらの攻撃が軽減されているため、この不正な形式の DNS パケットが検出され、ドロップされることがわかります。

 

IPSポリシーカスタムリソース

 

以下は、許可するクエリを定義するポリシーに DNS トラフィックが準拠していることを確認するために使用できる IPS ポリシーの例です。他のリスナー タイプ (Context Secure) も、このポリシーの参照をサポートしています。

apiVersion: "k8s.f5net.com/v1"
kind: F5BigIpsPolicy
metadata:
  name: "dns-ips-01"
spec:
  services:
    - name: dns
      ports:
        - "53"
      compliances:
        - name: dns_disallowed_query_type
          value: "IQUERY"
          action: reject
        - name: dns_disallowed_resource_records
          value: "A6 DLV GID MAILA MAILB MB MD MF MG MR NULL NXT SINK TALINK UID UINFO UNSPEC ISDN ATMA X25"
          action: reject
        - name: dns_domains_blacklist
          value: "fake1.terry.f5.com"
          action: reject
        - name: dns_experimental_resource_records
          value: "AFSDB APL ISDN LOC MB MG MINFO MR NULL RP RT X25"
          action: reject
        - name: dns_malformed_pdu
          action: reject
        - name: dns_maximum_reply_length
          value: "4096"
          action: reject
        - name: dns_maximum_request_length
          value: "520"
          action: reject
        - name: dns_obsolete_resource_records
          value: "KEY MAILA MD MF"
          action: reject
        - name: dns_unknown_resource_record_type
          logging: disabled
      signatures:
        - name: dns_blacklist_dns_reverse_lookup_response_for_known_malware_domain_spheral_ru_win_trojan_glupteba
          action: reject
        - name: dns_dns_query_amplification_attempt
          action: drop
        - name: dns_malformed_dns_query_with_http_content
          action: drop
        - name: dns_named_authors_attempt
          action: drop
        - name: dns_named_authors_attempt_1
          action: drop
        - name: dns_named_version_attempt
          action: drop
        - name: dns_named_version_attempt_1
          action: drop
        - name: dns_os_linux_os_linux_x86_linux_overflow_attempt
          action: drop
        - name: dns_os_linux_os_linux_x86_linux_overflow_attempt_1
          action: drop
        - name: dns_os_linux_os_linux_x86_linux_overflow_attempt_admv2
          action: drop
        - name: dns_os_other_os_other_x86_freebsd_overflow_attempt
          action: drop
        - name: dns_os_solaris_exploit_sparc_overflow_attempt
          action: drop
        - name: dns_server_other_bind_buffer_overflow_named_tsig_overflow_attempt
          action: drop
        - name: dns_server_other_bind_buffer_overflow_named_tsig_overflow_attempt_1
          action: drop
        - name: dns_server_other_bind_buffer_overflow_via_nxt_records
          action: drop
        - name: dns_server_other_bind_buffer_overflow_via_nxt_records_named_overflow_adm
          action: drop
        - name: dns_server_other_bind_buffer_overflow_via_nxt_records_named_overflow_admrocks
          action: drop
        - name: dns_server_other_bind_named_overflow_attempt
          action: drop
        - name: dns_spoof_query_response_ptr_with_ttl_of_1_min_and_no_authority
          action: drop
        - name: dns_spoof_query_response_with_ttl_of_1_min_and_no_authority
          action: drop
        - name: dns_tcp_inverse_query
          action: drop

非準拠のシナリオをテストするには、以下の scapy スクリプトを実行して、IQUERY または リバース DNS ルックアップを実行するメソッドを示すopcode 1 を持つパケットを送信します。

send(IP(dst="100.100.200.150")/UDP(dport=53)/DNS(id=RandShort(), opcode=1, rd=1, qdcount=1, ancount=0, nscount=0, arcount=0,qd=DNSQR(qname="fake1.terry.f5.com", qtype=1, qclass="IN")))

 パケットが検出され、以下のようなプロトコル検査の統計とログが表示されます。

IPS: on_flags/264: Found '10010' match (file '/builds/d3347dec/0/dpi/ips-lib/src/ips_service_dns.cpp:264')
IPS: ips_insp_callback/807: COMPL CHECK MATCH: id=10010, ctx='IQUERY', action=REJECT, support_id = 0000ff520000271a

これら 2 つの例は、F5 ハードウェアと VE ソフトウェアでこの保護を強化するのと同じエンジンを使用して、コンテナ ベースの DNS インフラストラクチャのセキュリティを確保する方法を示しています。

Published Jun 27, 2023
Version 1.0

Was this article helpful?

No CommentsBe the first to comment