御社のDNSは人質に取られていませんか?

悪意のあるサイバー活動において、DNSが知らず知らずのうちに悪用される仕組みについて解説する3回シリーズの第2回では、第2のシナリオ「人質にされたDNS」について紹介します。

Instructor at whiteboard explaining a long DNS hostname string in a lesson on DNS being used as a hostage in cyber attacks
主なポイント要点はAIの支援により生成されています。自動生成された要約には、時折誤りがあったり、重要な文脈が抜け落ちたりする場合があるため、完全な情報を得るには、必ずブログ記事の全文をご参照ください。

This article is the second installment in a three-part series examining how DNS becomes an unwitting accomplice in malicious cyber activities, focusing on DNS as a "hostage" used for covert data exfiltration through tunneling techniques. DNS tunneling exploits the fact that DNS traffic is often unmonitored, allowing attackers to bypass firewalls and establish command-and-control communications by encapsulating private data within DNS queries and responses that appear as legitimate public network traffic. Organizations can detect DNS tunneling by analyzing query patterns for unusual characteristics such as unique character strings, long labels, long hostnames, beacon-like periodic requests, and unexpected geographic traffic flows, making threat detection and prevention essential for protecting enterprise security.

What is DNS tunneling and how does it function as a security threat?

DNS tunneling is a technique that leverages DNS as a covert communication channel by encapsulating private data within DNS queries and responses to bypass firewalls and security controls. According to the article, it operates similarly to a “VPN over DNS,” allowing attackers to establish communication pathways between compromised endpoints and command-and-control servers. The primary threats include unauthorized remote command execution on compromised systems and data exfiltration, exploiting DNS’s typically unmonitored nature to achieve stealth communications without requiring additional obfuscation techniques.

What detection patterns indicate DNS tunneling activity within network traffic?

The article identifies several key detection patterns for DNS tunneling: unusual query characteristics including unique character strings, long labels, and extended hostnames; queries for text records rarely used by legitimate clients; sequential query pairs with variations designed to evade detection; and recurring request-response patterns over time. Additionally, traffic analysis can reveal beacon-like periodic queries (such as every minute), abnormal volumes of DNS traffic, unusual distributions of hostnames per domain, and significant DNS traffic to geographically unexpected regions, all serving as indicators of compromised DNS systems.

Why is DNS particularly vulnerable to exploitation for malicious communications?

DNS is vulnerable to exploitation because it was not designed for data transfer purposes and is frequently left unmonitored by security teams. The article explains that attackers exploit this oversight by using DNS as an undetected communication pathway, taking DNS “hostage” for their purposes. Since DNS traffic is typically allowed through firewalls as legitimate network activity, attackers can hide malicious communications within standard DNS transactions, making detection difficult and posing significant security risks to enterprises if left undiscovered and unmitigated.

悪意のあるサイバー活動において、無自覚な手助け役となるDNSに関する3回シリーズの第2回では、第2の役割である「人質としてのDNS」を紹介します。人質として、DNSはインターネット上で個人情報を転送するための無自覚な伝達役として利用されます。

DNSが人質として悪用される最たる例が「トンネリング」です。DNSは監視されていないことが多いため、悪意のある攻撃者はこの点を悪用します。その結果、DNSを活用するためのトンネリング手法は、特にステルス性を高める必要がありません。概念的には、トンネリングは「DNS経由のVPN」のようなもので、ファイアウォールを迂回してDNSを経由して直接通信を行う方法です。

まず、トンネリングについて簡単に定義します。

Techopediaによると、トンネリングとは、実際にはプライベートなデータであるにもかかわらず、パブリック情報であるかのように見せかけて、パブリックネットワークを介してデータパケットを転送する手法です。カプセル化と呼ばれるプロセスにより、データをネットワーク上で気づかれることなく安全に通過させることができます。

DNSトンネリングは、クライアント(多くの場合マルウェア)とサーバーの間に通信経路を構築し、さまざまな種類のメッセージをやり取りします。DNSトンネリングによる代表的な脅威として、侵害されたエンドポイントに対するコマンド&コントロールや、データの持ち出しが挙げられます。

トンネリングの検知

DNSが乗っ取られていることをどのように見分け、トンネリングをどのように検知すればよいのでしょうか?

手がかりはクエリそのものの中にあり、異なるパターンが見られることが多くの場合、その証拠となります。

一般的に、ドメインやサブドメインが確認され、そのホストレコードに可能な限り多くのデータを詰め込もうとする試みが見られます。一般的なクライアントではあまり使用されないテキストレコードをクエリすることで、DNSを乗っ取ろうとする活動を特定するのに役立つ場合があります。

注意すべき重要な点は、トンネリングにおいて、一連のクエリ(それぞれが互いに異なる)を含むパターンが一般的であるということです。通過する確率を高めるため、各クエリは一意に作成されます。これらのレコードは、一意の文字列が長く続くこと、長いラベル、長いホスト名によって識別できます。

BlueCat

DNSをメッセージの送受信手段として利用することは、場合によっては完全に正当な用途である可能性もありますが、一般的には、これがトンネリングが行われていることを示す兆候となります。

他にも示唆に富むパターンがあります。例えば、リクエストの数や頻度に関するトラフィック分析などです。

トンネリングを示唆するパターンには、時間の経過とともに複数のリクエストとレスポンスのペアが必ず現れるという特徴があります。最終的に、何度も何度も試行された後、DNSサーバーは実行すべきコマンドをレスポンスとして返すことがあります。

1分ごとにクエリが送信されていませんか?これは「ビーコン攻撃」の兆候である可能性があります。悪意のある攻撃者が、ネットワークの自己通知型修復戦略を悪用して、悪意のある目的で利用しているのです。

トラフィック分析からは、DNSトラフィックの量、ドメインごとのホスト名数、ドメインの履歴など、有益な情報も得られます。地理的な要因も手がかりの一つです。通常は取引を行っていない地域への大量のDNSトラフィックも、トンネリングの兆候である可能性があります。

DNSはデータ転送を目的としていないため、容易に人質に取られ、悪意のある通信の経路として悪用される可能性があります。これが発見されなければ、企業にとって重大なリスクとなる恐れがあります。DNSが人質に取られているかどうかを判断するための確かな手がかりがあります。

重要なのは、これを阻止することです。