ハニーポット T-Pot 17.10をインストールしてみた。

一年ほど前のセキュリティミニキャンプ九州のデータ収集用にインストールしたT-Potですが、ELKあらためElastic Stackが最新バージョンに対応したようなので、最新バージョンによるリライトです。機能もいろいろと紹介することにしました。

 

f:id:connect24h:20181027184249j:plain

 

一年前の記事はこちら。


connect24h.hatenablog.com

 

T-Potとは?

まずはおさらいから。T-Potは、いわゆる、インターネット上で「おとり」として立ち上げ、自身に到達する攻撃をログとしてため込み、攻撃の予兆や攻撃の手法の研究などに役立てることを目的とした「ハニーポット」と呼ばれる製品の一つです。開発はドイツテレコム社が行っています。

下記のように、異なる用途のハニーポットを稼働させ、かつ、Dockerコンテナでセグメント分けし、ElasticSeachにログを集約、Kibanaで可視化してくれる優れものです。前バージョンのT-Pot 16.10だと、Elastic Stackのバージョンが古かったです。かれこれ、13年ほど前に、日経ネットワークセキュリティなどで、ハニーポットの記事を書いていたころに比べたら、このお手軽さは隔世の感があります。良い時代になったものです。

よ、ドイツテレコム太っ腹!と、おもっても、しっかりログはEWS Posterを通じてドイツテレコムに提供されるようなので、持ちつ持たれつですね。

f:id:connect24h:20181027184255p:plain

 

T-Potに構築されているハニーポットは以下になります。

ハニーポット

・Conpot(ICS/SCADA Honeypot)

conpot.org

サーバサイドの低対話型の作業用制御システムのハニーポットです。IPAICSCoEで使われてそうなハニーポットですね。去年、参加したうちの若い衆に聞いてみよう。

概要は以下の通り。

Conpot is a low interactive server side Industrial Control Systems honeypot designed to be easy to deploy, modify and extend. By providing a range of common industrial control protocols we created the basics to build your own system, capable to emulate complex infrastructures to convince an adversary that he just found a huge industrial complex. To improve the deceptive capabilities, we also provided the possibility to server a custom human machine interface to increase the honeypots attack surface. The response times of the services can be artificially delayed to mimic the behaviour of a system under constant load. Because we are providing complete stacks of the protocols, Conpot can be accessed with productive HMI's or extended with real hardware. Conpot is developed under the umbrella of the Honeynet Project and on the shoulders of a couple of very big giants. 

 

www.cowrie.org

sshとsftpに特化したハニーポット。Kippoの後継に当たります。

概要は以下の通り。

Since summer 2014 I’ve been working on extensions and contributions to the well known Kippo honeypot developed by desaster.

I noticed some SSH attacks against my systems were not logged in complete detail and I started to work on additional logging, from there I’ve added ‘ssh exec commands’ support, SFTP support, SCP support, direct-tcpip (proxying) support and many other features.

To distinguish this from the original software, I have now renamed the system to "Cowrie". All features below are incorporated in my cowrie repository on github.

Welcome to dionaea’s documentation! — dionaea 0.8.0 documentation

非常に高機能なフルスタックハニーポットの一つ。nepenthes(うつぼ)かずらの後継にあたります。

概要は以下の通り。

Dionaea is meant to be a nepenthes successor, embedding python as scripting language, using libemu to detect shellcodes, supporting ipv6 and tls

Service

 

  • elasticpot

Elastic Searchのハニーポット、T-Potにマージされた模様。

 

  • emobility

github.com

次世代交通インフラに対する攻撃者の知見を収集するための高対話型ハニーポット

概要は以下の通り。

eMobility is a high-interaction honeynet with the goal to collect intelligence about the motives and methods of adversaries targeting next-generation transport infrastructure. The eMobility honeynet consists of a charging central system, serveral charge points, and simulated user transactions. Once the attacker gets access to the web interface of the central system, the attacker will be able to reconfigure the system, monitor and manipulate running charging transactions, and interact with the charge points. On top of that, at random times, users start charging their vehicles and the attacker might interact with those users.

 

  • glastopf

mushmush.org

 PythonベースのWebアプリケーションハニーポット。現在は、後継のSNARE/TANNERが同じページにありますが、枯れているので現在もT-Potに採用されているのでしょう。

概要は以下の通り。

lastopf is a Python web application honeypot. We use vulnerability type emulation instead of vulnerability emulation. Popular attack type emulation is already in place: Remote File Inclusion via a build-in PHP sandbox, Local File Inclusion providing files from a virtual file system and HTML injection via POST requests.

 

  • honeytrap

github.com

 TCP/UDPで待ち受ける低応答型のハニーポットインターネット老人会的な話をするとSlammerとかのときに、iplogで待ち受けて統計とって、netcatで受け取ってファイル化してたけど、Honeytrapでざっくり統計とれてよいですね。

概要は以下の通り。

Honeytrap is a low-interaction honeypot and network security tool written to catch attacks against TCP and UDP services. In its default configuration, it runs as a daemon and starts server processes on demand when a connection attempt to a port is made.


Different modes of operation are available that control how connections are handled. In *normal mode*, a server sends arbitrary data provided in template files as a basic means to emulate well-known protocols. Many automated attack tools will be fooled and continue with the attack dialog. A popular mode is the so-called *mirror mode* in which incoming connections are proxied back to the initiator. This trick eliminates the need for protocol emulation in many cases. A third mode, the *proxy mode*, allows forwarding of specific sessions to other systems, e.g., high-interaction honeypots.

  

  • mailoney

github.com

作者がPythonの学習がてらに作ったSMTPベースのHoneypotだそうです。

最近、SMTPリレーチェックとか調べる機会があったので、これ使って検証してみようと思います。

概要は以下の通り。

Mailoney is a SMTP Honeypot I wrote just to have fun learning Python. There are various modules or types (see below) that provide custom modes to fit your needs. Happily accepting advise, feature or pull requests.

 

  • elasticpot

github.com

リモートデスクトップVNCに特化したPythonベースのハニーポット

概要は以下の通り。

Remote Desktop Protocol in twisted python.

RDPY is a pure Python implementation of the Microsoft RDP (Remote Desktop Protocol) protocol (client and server side). RDPY is built over the event driven network engine Twisted. RDPY support standard RDP security layer, RDP over SSL and NLA authentication (through ntlmv2 authentication protocol).

 

  • vnclowpot

github.com

 VNCの低対話型ハニーポット

概要は以下の通り。

Low-interaction VNC honeypot. Listens on a port and logs responses to a static VNC Auth challenge.

 

 

【Elastic Stack】

  • Elastic Stack

こんにちは、Elastic StackとX-Pack | Elastic

Elastic Stackはオープンソースサーチエンジン製品群。サーチエンジンのElasticSeach、ログ転送の変換、保管のLogstash、WEBフロントのKibanaなどから構成されます。

 

  • ES Head

github.com

 Elastic seach自身にモニタリングとかの機能が付いたので、あんまりいらなくなりましたが、昔からある管理用のWEBフロント。

 

 

【NSM:Network Security Monitoring】

  • Suricata

suricata-ids.org

オープンソースのIPS。

概要は以下の通り。

Suricata is a free and open source, mature, fast and robust network threat detection engine.

The Suricata engine is capable of real time intrusion detection (IDS), inline intrusion prevention (IPS), network security monitoring (NSM) and offline pcap processing.

Suricata inspects the network traffic using a powerful and extensive rules and signature language, and has powerful Lua scripting support for detection of complex threats.

With standard input and output formats like YAML and JSON integrations with tools like existing SIEMs, Splunk, Logstash/Elasticsearch, Kibana, and other database become effortless.

Suricata’s fast paced community driven development focuses on security, usability and efficiency.

The Suricata project and code is owned and supported by the Open Information Security Foundation (OISF), a non-profit foundation committed to ensuring Suricata’s development and sustained success as an open source project.

 

  • p0f

http://lcamtuf.coredump.cx/p0f3/

P0f is a tool that utilizes an array of sophisticated, purely passive traffic
fingerprinting mechanisms to identify the players behind any incidental TCP/IP communications (often as little as a single normal SYN) without interfering in any way.

ネットワークトラフィックから受動的に通信相手のOSなどを判定するツール。nmapのオプション「-O」のネットワーク版ですね。10年位前からあるツールで、そこまでメジャーにならないかとおもったのですが、しぶとく生き残っているのは、感慨深いものがあります。

 

【Tools】

  • EWS Poster

ドイツテレコムにログを提供する機能。T-Potが無料である理由ですね。

 

  • Netdata

my-netdata.io

リアルタイムパフォーマンスモニター。

 

  • Portainer

portainer.io

 Docker管理用ユーザインターフェース。

 

  • Spiderfoot

https://www.spiderfoot.net/

SpiderFoot is a reconnaissance tool that automatically queries over 100 public data sources (OSINT) to gather intelligence on IP addresses, domain names, e-mail addresses, names and more. You simply specify the target you want to investigate, pick which modules to enable and then SpiderFoot will collect data to build up an understanding of all the entities and how they relate to each other.

SpiderFoot は、IP アドレス、ドメイン名、電子メールアドレス、名前などに関して、100以上のパブリックデータソース (OSINT) を自動的に照会する情報収集ツールである。敵を調べるときに使う。 

 

 T-potのインストール

【Isoファイルのダウンロード】

以下のサイトからT-Potのisoファイルをダウンロードします。

github.com

 

tpot.isoを選んでダウンロードします。

f:id:connect24h:20181027184430j:plain

注意が必要なのが、常に最新バージョンを利用することです。

T-Potのインストールブログが複数ありますが、微妙にバージョンが違っていて、参考になる場合と、仕様が変わりすぎていて混乱する場合があります。今回のインストール記事も、実は、2018年10月限定です。

 

【環境】

 

 前回と同様、VirtualBox上に作りました。T-Potはメモリ食いなので、メモリ4GB、HDDは64GBGB割り当てました。最近、とある方に譲っていただいたコア6、メモリ16GBあるマシンなので余裕です。前回立ち上げていた10年前のCore Quadメモリ8GBのマシンだと、重かったし、定期的にハングアップするし、リソース少ない中で運用するとはまるので、ぜいたくなリソースの環境で行うか、いっそのこと、T-Potに頼らないで自作したほうが良いかもしれません。あと、DHCP環境じゃないといけないとか、WEBアクセスは、同じローカルIPからじゃないとだめとか、色々と縛りがあります。旧バージョンに比べて、ハードルは下がっていますが、思わぬ落とし穴があったりするので、各種仕様はちゃんと確認するようにしましょう。

 

【動作イメージ】

T-Pot 17.10(20181029現在)はUbuntu 16.04 LTSベースなのは、全バージョンと変わりません。以下は動作イメージです。Kibana 5.0ベースで明るくなりました。旧バージョンと違って背景が暗くありません。

f:id:connect24h:20181029001527j:plain

 

まずはVirtaulBoxで仮想マシンを作ります。メモリは4GBにしました。

f:id:connect24h:20181027184454j:plain

 

HDDは64GB。

f:id:connect24h:20181027184303j:plain

 

仮想CDにt-pot.isoをマウントさせます。

f:id:connect24h:20181027184447j:plain

 

ネットワークはブリッジアダプターを選択します。

f:id:connect24h:20181027184331j:plain

異常で仮想マシンの準備は完了です。

 

【T-Potのインストール】

T-Potのインストールで実は一番参考になるのは、 githubのサイトやREADME.mdです。特に、sshでログインする方法は、バージョンによってちがうので、最新のREADME.mdを見るのが吉です。そうは言っても、T-Potもかなり枯れてきたので、はまりポイントは少なくなりました。

簡単に済ませたいときは動画をどうぞ。


T-Pot 17.10

 

以下インストール画像。

T-Pot 17.10を選択します。 

f:id:connect24h:20181027184548p:plain

 

 メニューでエリアを選択せずに「Go Back」で戻ります。

f:id:connect24h:20181028235655p:plain

 

 戻った画面でインストール画面で日本語が選べるので、日本語を選択します。

 

 

f:id:connect24h:20181028235852p:plain

 

インストーラが完全に日本語対応していない但し書きが出ますが気にせず「はい」を選択します。

f:id:connect24h:20181028235615p:plain

 

場所=エリアで日本を選択します。

f:id:connect24h:20181028235618p:plain

 

キーボードで文字を選べとでてきますので、「y」「w」と次々選びます。最後に「はい」「いいえ」の画面が出てくるので、「いいえ」を連打してください。椅子トールが始まります。キーボードは後で選択するので、適当でもかまいません。

f:id:connect24h:20181028235623p:plain

 

最初にインストールエディションを選択します。今回はStandardタイプということで「T」を選びます。超簡単です。 

f:id:connect24h:20181028235630p:plain

 

 ログイン管理者ユーザの「tsec」のパスワードを設定します。

f:id:connect24h:20181028235633p:plain

 

 次に、WEBアクセス用のELK(Elastic Search、Logstash、Kibana)のアカウント名を聞かれるので、安直に「ELK」とします。

f:id:connect24h:20181029000109p:plain

 

WEB用アクセスアカウント「ELK」のパスワードを設定します。

f:id:connect24h:20181028235645p:plain

 

f:id:connect24h:20181028235651p:plain

 

 これでインストール時の設定は完了です。あとは、30分ほど待てば、インターネット上からコンテナがダウンロードされて、T-potが自動で立ち上がります。最初に設定した「tsec」パスワードでログインして下さい。

f:id:connect24h:20181028235455p:plain

 

 【インストール後の初期設定】

今のままだとキーボードの設定がおかしいので設定します。

teratermなどでポート番号64295でログインID「tsec」でログインして、管理者になってください。

$ sudo su

で管理者になれます。パスワードはtsecのパスワードでいけます。

以下のコマンドを実行します。

# dpkg-reconfigure keyboard-configuration

f:id:connect24h:20181029001440j:plain

キーボードが選択できます。105キーボードを選択。

f:id:connect24h:20181029001417j:plain

 

キーボードの国を「日本語」選択。

f:id:connect24h:20181029001429j:plain

 

キーボードレイアウトも「日本語」を選択

f:id:connect24h:20181029001432j:plain

 

「キーボード配置のデフォルト」を選択。これで日本語キーボードレイアウトになります。

f:id:connect24h:20181029001438j:plain

 

TimeZoneの設定もおかしいので直します。

dpkg-reconfigure tzdata

を実行して下さい。

f:id:connect24h:20181029001442j:plain

 

「アジア」を選択。

f:id:connect24h:20181029001445j:plain

 

「Tokyo」を選択。

f:id:connect24h:20181029001456j:plain

 

これで、ちゃんとタイムゾーンAsia/Tokyoになりました。

f:id:connect24h:20181029001505j:plain

WebアクセスしてKibanaの画面にアクセスしてみます。

https://<T-PotのIP>:64297

認証画面が出るので、ID「ELK」と、指定したWEBパスワードでログインします。

ログインできました。FTTH環境下でDMZ状態で公開すれば、ものの数分でたくさんの攻撃を受けていることがわかります。楽しいですよ!

Discoverでログが届いていることを確認します。

f:id:connect24h:20181029001512j:plain

 

dashboardが各機能ごとで選択可能です。このdashboardだけでも知見の塊なので、深く掘っていっても良いと思います。

f:id:connect24h:20181029001521j:plain

 

総合である「T-Pot」のdashboardです。これだけでもOverView可能です。

さあ、みんなもハニー・ポッターになろうぜ!  f:id:connect24h:20181029001527j:plain

 

以下、ハニーポットお勉強用の本

 

 

データ分析基盤構築入門[Fluentd、Elasticsearch、Kibanaによるログ収集と可視化]

データ分析基盤構築入門[Fluentd、Elasticsearch、Kibanaによるログ収集と可視化]

データ分析基盤構築入門[Fluentd、Elasticsearch、Kibanaによるログ収集と可視化記事]のリライト版。

 

Elasticsearch実践ガイド (impress top gear)

Elasticsearch実践ガイド (impress top gear)

最近のElastic Stackの本の中ではこれが一番かな。

 

Elastic Stackのできるシリーズ。QiitaのELKの記事がちゃんと探せて読める人は買う必要がないかも。時間を買うためにこの本を買うのはアリ。

 

Elastic Stackで作るBI環境 バージョン6.4対応版 (技術書典シリーズ(NextPublishing))

Elastic Stackで作るBI環境 バージョン6.4対応版 (技術書典シリーズ(NextPublishing))

Elastic StackのBI的な使い方のできるシリーズ。

 

高速スケーラブル検索エンジン ElasticSearch Server (アスキー書籍)

高速スケーラブル検索エンジン ElasticSearch Server (アスキー書籍)

古い本だけど、Elastic Searchの本でよい本が少なくて・・・

クラスタの考え方とか理解するにはよいかと。

 

森久 和昭さん作のサーバサイドの低対話型Web ハニーポットの解説記事。

 

 同じく、森久 和昭さんさんのハニーポット観察日記。正直、あんまりテクニカルではないです。技術というよりは、考え方を学ぶといった感じ。