Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
AntiPortscan-20190925
Search
hiro
September 25, 2019
Technology
1.3k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
AntiPortscan-20190925
hiro
September 25, 2019
More Decks by hiro
See All by hiro
Observe_C2Servers_Phorpiex_Avaddon_-20200630.pdf
ctrl_z3r0
1
1.5k
Observe_C2Servers_via_MonitoringService-20200330.pdf
ctrl_z3r0
2
1.2k
Remove_obfuscation_in_Emotet_PowershellScript-20200129.pdf
ctrl_z3r0
2
2.7k
Honeypot-on-GCP-20191201.pdf
ctrl_z3r0
0
930
HackingDojo_De-Ice_1.110_-20191203.pdf
ctrl_z3r0
5
1.5k
Investigating-Malware-20191030
ctrl_z3r0
4
1.6k
Honeypot_on_GCP-20191006.pdf
ctrl_z3r0
4
1.6k
Honeypot on GCE (Google Compute Engine)
ctrl_z3r0
1
1.1k
Authentication-and-7pay-case.pdf
ctrl_z3r0
6
1.4k
Other Decks in Technology
See All in Technology
MCPゲートウェイを作って運用してわかったこと — Agent時代の権限管理の現在地
mtpooh
10
2.6k
認知負荷を吸収し、プロダクトをまたぐPR Preview基盤の設計事例
taiki45
2
560
「とりあえず動く」の先へ。 AI時代のチーム開発と内部設計/2026-slsdays
slsops
0
100
Account Factory for Terraformによる 標準化されたアカウント発行の自動化
pensuke628
0
120
AI Native Platform Engineering 〜PlatformとAgileで“作る速さ”を“価値”へ〜
uya116
0
590
いちAWSエンジニアのAI活用を振り返る #devio2026 / devio osaka 2026 kawahara
masahirokawahara
2
310
[2026-09-30]ロックンロールは鳴り止まないっ - 信頼性かまってちゃん - 「データ駆動を投げ捨ててまで。」追いかける信頼性改善に向けた取り組みの話
tosite
0
180
CI/CDではもう遅い - 人とAIが迂回しないDevSecOps Verify基盤の再設計 -
kintotechdev
1
630
1人アドミンな私はAWSアカウント申請をSlackで完結したい!
ysuzuki
0
110
私の推しは「聞いてから進む」AIです -AI-DLCに一人でアプリを作らせた話
yama3133
1
160
Mastering Agentic Development: Harness Engineering for Effective Coding Agents
konippi
3
670
AI駆動開発で仕様はどこまで書くべきか? ― 人とAIの責務境界から考える開発プロセスの実践
takahiromatsui
1
280
Featured
See All Featured
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
46k
What's in a price? How to price your products and services
michaelherold
247
13k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
550
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
50
10k
Making the Leap to Tech Lead
cromwellryan
135
10k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Docker and Python
trallard
47
4.2k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
720
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
2
930
Thoughts on Productivity
jonyablonski
76
5.4k
The World Runs on Bad Software
bkeepers
PRO
72
12k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
530
Transcript
IDS/IPSのお話 ~ポートスキャンを遮断してみた~ 第31回ゼロから始めるセキュリティ入門 勉強会 2019/09/25 hiro(@ctrl_z3r0) a.k.a ねこさん⚡(@catnap707)
自己紹介
アジェンダ 1 IDS/IPSとは 2 IDS/IPSの仕組み 3 ポートスキャンとは 4 代表的なOSS(Snort/Suricata/PortSentry) 5 PortSentryでポートスキャンを遮断 6 Snortでポートスキャンを遮断 7 まとめ ▪参考情報 ・IDS・IPS(不正侵入検知・防御)とは?違いや仕組みを図解!(2019-03-15)
https://it-trend.jp/ids-ips/article/explain ・IDS・IPSとは?不正侵入検知・防御サービス解説(2019-04-18) https://www.kagoya.jp/howto/network/ids-ips/ ・情報セキュリティ入門 IDSとIPS(2006-09-05) https://tech.nikkeibp.co.jp/it/article/COLUMN/20060830/246798/ ・無料で使えるIDS製品2選!OSSのメリットと注意点も解説!(2019-05-24) https://it-trend.jp/ids-ips/article/257-0026 ・IPSの接続形態(インラインモードとプロミスキャスモード)とその特徴について() http://sayacafe.sub.jp/sec/no007.php ・侵入防止システム(IPS)を探る(2005-07-14) https://japan.zdnet.com/article/20085358/
4 1 IDS/IPSとは
IDS/IPSとは(1/3) 5 ▪IDS/IPSの概要 ▪参考情報 ・ハニーポットとは - IT用語 https://e-works.jp/w/ハニーポット.html ・ハニーポット -
WikiPedia https://ja.wikipedia.org/wiki/ハニーポット IDS(Intrusion Detection System)は、不正に侵入しようとする通信を検 知するシステム、IPS(Intrusion Prevention System)は、不正侵入を防止 するシステムを指します。 ネットワーク型 設置 ネットワーク上に設置 (インラインモードと、プロミスキャスモード) 監視範囲 ネットワークセグメント ホスト型 設置 サーバ上にインストール 監視範囲 サーバ
6 ▪設置方法による違い IDS/IPSとは(2/3) ネットワーク型 インライン モード 通信路上に設置し、全てのパケットを 検査する プロミスキャス
モード スイッチングHUBのミラーポートに 設置し、パケットを検査する ホスト型 ー ホストに到達したパケットを検査する ▪参考情報 ・IPSの接続形態(インラインモードとプロミスキャスモード)とその特徴について() http://sayacafe.sub.jp/sec/no007.php ・侵入防止システム(IPS)を探る(2005-07-14) https://japan.zdnet.com/article/20085358/ IPアドレスは 割り当てない。
7 IDS/IPSとは(3/3) ▪FireWall、WAFとの違い ▪参考情報 ・WAFとIPS/IDSのちがいとは?(2019-05-08) https://www.shadan-kun.com/blog/measure/1390/ ・IDS・IPSとWAF、ファイアウォールの違いとは?(2019-03-25) https://it-trend.jp/ids-ips/article/difference ・WAFとは |
ファイアウォールやIPS/IDSとの違いと関係性・仕組みや導入方法(2019-03-12) https://boxil.jp/mag/a2381/
8 2 IDS/IPSの仕組み
IDS/IPSの仕組み(1/2) 9 ▪IPSはどうやって遮断しているのか TCPのコネクションをリセットしている。 IPSが、それぞれ相手を偽装したRSTパケットを送信している。 ターゲット 攻撃者 攻撃者 ターゲット 攻撃者
ターゲット RST パケット RST RST RST パケット IPS ▪参考情報 ・RSTパケット 【 reset packet 】 RST packet http://e-words.jp/w/RSTパケット.html ・第15回 信頼性のある通信を実現するTCPプロトコル(2) (2/3)(2004-01-29) https://www.atmarkit.co.jp/ait/articles/0401/29/news080_2.html UDPの場合は、ICMPの不達通知パケット(Destination Unreachable)を送信。
IDS/IPSの仕組み(2/2) 10 シグネチャ検知(パターンマッチング)と、アノマリ検知(異常通信を検知)が ある。ウイルス対策ソフトと同じように、パターンファイルや検索エンジンの アップデートが欠かせない。 ▪シグネチャ検知とアノマリ検知 フォールスポジティブ(FP:False Positive)は、正常なものを異常と誤検知す ること。(過検知) フォールスネガティブ(FN:False
Negative)は、異常なものを正常として見逃 すこと。(検出漏れ) ▪フォールスポジティブとフォールスネガティブ ▪参考情報 ・フォールスポジティブ(誤検知)やフォールスネガティブ(見逃し)(2018-11-28) http://sc.seeeko.com/archives/4559461.html ・誤検知 - F5 GLOSSARY https://www.f5.com/ja_jp/services/resources/glossary/false-positive フォールス ポジティブは、シグネチャの追加時に発生しやすくなる。 フォールス ネガティブは、新たに発見された攻撃手法のシグネチャを 継続的に追加していくことで発生頻度を下げていくことが可能。
11 3 ポートスキャンとは
12 ポートスキャンとは ▪参考情報 ・ポートスキャン 【 port scan 】 ポートスキャニング /
port scanning http://e-words.jp/w/ポートスキャン.html ・攻撃はポートスキャンから始まる(上)(2004-04-28) https://tech.nikkeibp.co.jp/it/members/NBY/Security/20040415/1/ ▪攻撃はポートスキャンから始まる ポートスキャンとは、ネットワークを通じた攻撃手法の一つで、対象のコン ピュータのTCPあるいはUDPのポートに接続を試み、機能停止や侵入などの 攻撃に使えそうな脆弱性がないか調べること。特に、多数あるいは全ての ポートに次々に連続的にアクセスし、各ポートの状態を網羅的に調べあげる こと。
13 4 代表的なOSS (Snort/Suricata/PortSentry)
代表的なOSS(Snort) 14 ▪ネットワーク型IDS/IPS ソフトウェア Snort(スノート) 特徴 Snortはパケットスニファ/パケットロガーとして開発。 ポートスキャンや、OSフィンガープリント調査、サーババナー 探索、バッファオーバーフロー攻撃などを検知可能。 検知ルールを自作することも可能。
oinkmasterツールで検知ルールの自動更新が可能。 リリース 初期:1998年ごろ ※2013年7月にCiscoが買収 安定版:2.9.14.1(2019-08-02) 公式HP https://www.snort.org/ ▪参考情報 ・Snortでつくる不正侵入検知システム(1):不正侵入検知システムを知る (1/3)(2004-08-10) https://www.atmarkit.co.jp/ait/articles/0408/10/news087.html ・Snort (software) - Wikipedia https://en.wikipedia.org/wiki/Snort_%28software%29
代表的なOSS(Suricata) 15 ▪ネットワーク型IDS/IPS ソフトウェア Suricata(スリカタ)※ミーアキャット(マングース科) 特徴 マルチスレッド対応のエンジン。ネイティブIPv6サポート、ファ イル解凍機能及びその他多くの機能。 既存のSnortルールを読み込むことができる。 Snorbyツールで、ログをGUIで表示可能。
リリース 初期:1.0(2010-07-01) 安定版:4.1.4(2019-04-30) 公式HP https://suricata-ids.org/ ▪参考情報 ・Suricata freecode日本語情報ページ - OSDN(2014-05-21) https://ja.osdn.net/projects/freshmeat_suricata/ ・【初心者向け】オープンソースのIPS「Suricata」をCentOSに構築した話(2016-11-10) https://qiita.com/curryperformer-kato/items/60b88418a2c7c22d3a61 ・趣味でIPSを使ってみた話(2017-12-16) https://qiita.com/kouta_hara/items/4229be2ef36e00778a22
代表的なOSS(PortSentry) 16 ▪ホスト型IDS/IPS ソフトウェア PortSentry(ポートセントリー) 特徴 設定がシンプルで導入が容易なIPS/IDS。 設定したポートへのアクセスを検知し、送信元IPアドレスを iptablesやhosts.denyに登録しアクセスを拒否する。 リリース
初期:1.0(2003-05-03) ※2002年にCiscoが買収 安定版:1.2(2003-05-23) 公式HP https://sourceforge.net/projects/sentrytools/ ▪参考情報 ・Sentry Tools(2016-07-16) https://sourceforge.net/projects/sentrytools/ ・PortSentry に関する日本語情報(2010-05-24) http://pocketstudio.jp/linux/?PortSentry ・Nmap対策Portsentry 不正アクセス撲滅委員会[即BAN] https://sys-guard.com/post-2110/ ・Psionic PortSentry サポートに関する FAQ(2006-01-19) https://www.cisco.com/c/ja_jp/support/docs/security/ips-4200-series-sensors/62957-psionic-portsentry.html
17 5 PortSentryでポートスキャンを遮断
PortSentryの場合(1/3) 18 ▪参考情報 ・Sentry Tools(2016-07-16) https://sourceforge.net/projects/sentrytools/ ・PortSentry に関する日本語情報 http://pocketstudio.jp/linux/?PortSentry ・Nmap対策Portsentry
不正アクセス撲滅委員会[即BAN] https://sys-guard.com/post-2110/ ▪PortSentryの構築(Ubuntuの例) 【aptでインストール】 $ sudo apt install portsentry 【設定ファイル】 /etc/portsentry/portsentry.conf 【実行】 $ sudo service portsentry start 【ログ】 /var/lib/portsentry/portsentry.blocked.tcp /var/lib/portsentry/portsentry.blocked.udp /var/lib/portsentry/portsentry.history
TCP_PORTS="21,25,79,80,110,111,119,123,139,143,443,445,1080,3128,3389,8080,12345" UDP_PORTS="69,135,137,138" ADVANCED_PORTS_TCP="1024" ADVANCED_PORTS_UDP="1024" ADVANCED_EXCLUDE_TCP="113,139" ADVANCED_EXCLUDE_UDP="520,67" IGNORE_FILE="/etc/portsentry/portsentry.ignore" HISTORY_FILE="/var/lib/portsentry/portsentry.history" BLOCKED_FILE="/var/lib/portsentry/portsentry.blocked" RESOLVE_HOST
= "0" BLOCK_UDP="1" BLOCK_TCP="1" KILL_ROUTE="/sbin/iptables -I INPUT -s $TARGET$ -j DROP" KILL_HOSTS_DENY="ALL: $TARGET$ : DENY" SCAN_TRIGGER="0" PortSentryの場合(2/3) 19 “1”にすると、iptablesでDROPできる。 ・/etc/portsentry/portsentry.conf 監視対象のポート番号を設定する。
PortSentryの場合(3/3) 20 portsentry[2430]: attackalert: Connect from host: 10.0.0.x/10.0.0.x to TCP
port: 21 portsentry[2430]: attackalert: Host 10.0.0.x has been blocked via wrappers with string: "ALL: 10.0.0.x : DENY" portsentry[2430]: attackalert: Host 10.0.0.x has been blocked via dropped route using command: "/sbin/iptables -I INPUT -s 10.0.0.x -j DROP" ALL: 10.0.0.x : DENY Chain INPUT (policy ACCEPT) target prot opt source destination DROP all -- 10.0.0.x 0.0.0.0/0 Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination ・/var/log/syslog ・/etc/hosts.deny ・iptables -L -n FTP(21/tcp)へのアクセスを検知 し、DROP
PortSentryの場合(ログイメージ) 21
22 6 Snortでポートスキャンを遮断
Snortの場合(1/3) 23 ▪参考情報 ・Snort - Network Intrusion Detection & Prevention
System https://snort.org/ ・10分で出来る snort インストールと検知テスト(2013-07-16) https://www.morihi-soc.net/?p=29 ▪Snortの構築(Ubuntuの例) 【aptでインストール】 $ sudo apt install snort 【設定ファイル】 /etc/snort/snort.conf 【実行】 $ sudo service snort start 【ログ】 /var/log/snort/snort.log /var/log/snort/snort.alert /var/log/syslog
# Portscan detection. For more information, see README.sfportscan preprocessor sfportscan:
proto { all } memcap { 10000000 } sense_level { low } # syslog # output alert_syslog: LOG_AUTH LOG_ALERT output alert_syslog: LOG_LOCAL0 Snortの場合(2/3) 24 ・/etc/snort/snort.conf portscanのプリプロセッサを有効 /var/log/syslogへ出力 ・/etc/rsyslog.conf local0.* /var/log/snort/snort.log ・/etc/snort/rules/scan.rules #alert tcp $EXTERNAL_NET any -> $HOME_NET any (msg:"SCAN nmap XMAS"; flow:stateless; flags:FPU,12; reference:arachnids,30; classtype:attempted-recon; sid:1228; rev:7;) alert tcp $EXTERNAL_NET any -> $HOME_NET any (msg:"SCAN nmap XMAS FlexResp"; flow:stateless; flags:FPU,12; reference:arachnids,30; classtype:attempted-recon; sid:1228; rev:7; resp:rst_all) FlexRespでRSTパケットを送るという指定 ▪参考情報 ・FlexResp で自己防衛を行う (2019-05-18) http://safe-linux.homeip.net/security/linux-snort3-12.html
Snortの場合(3/3) 25 ▪nmapによるポートスキャンを遮断 遮断すると空きポートが検知されない。 ALL 1000 scanned ports on
xx are closed
26 7 まとめ
◆攻撃を観察してみよう! 27 まとめ ◆どんな仕組みか考えてみよう ◆ネットワークの知識は役に立つので勉強 しよう!
ご清聴ありがとうございました。 28 フォロー待ってるニャ! @catnap707
29