UJP - 技術情報2 バックアップ : SecurityTool/masscan/mac の変更点

Life is fun and easy!

不正IP報告数

Okan Sensor
 
メイン
ログイン
ブログ カテゴリ一覧

  
現: 2019-11-25 (月) 23:45:36 nobuaki ソース 編集
Line 1: Line 1:
 +*macosでmasscanを使ってみる [#ne0dc2c4]
 +**はじめに [#q31018c6]
 +
 + IoTなどもあるので自分のネットワーク上に何が存在しているかわからない今日この頃.ネットワークスキャンのMasscanを使って,「ネットワーク上に存在している何か」を探してみようと思う.
 +
 + MasscanはIPv4の指定したアドレス空間を高速にスキャンするために作成されたツールの1つで,調査目的で使えるということで攻撃者も使うツールとして知られる.
 + つまり,使い方を間違えれば,自分自身が攻撃者として扱われる可能性もあるので,慎重に使わなければならないツールであることに注意する.
 +
 +**インストール [#o6d4d6ac]
 +
 + 今回もHomeBrewでインストール.
 + まずは情報を確認.
 +
 + $ brew info masscan🆑
 + masscan: stable 1.0.5 (bottled), HEAD
 + TCP port scanner, scans entire Internet in under 5 minutes
 + https://github.com/robertdavidgraham/masscan/
 + Not installed
 + From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/masscan.rb
 + ==> Options
 + --HEAD
 +  Install HEAD version
 + ==> Analytics
 + install: 274 (30 days), 861 (90 days), 3,435 (365 days)
 + install-on-request: 274 (30 days), 856 (90 days), 3,388 (365 days)
 + build-error: 0 (30 days)
 + $
 +
 +1年で3435インストールというのは,多いいのか少ないのか.
 +気にせずインストールしてみる.
 +
 + $ brew install masscan🆑
 + Updating Homebrew...
 + ==> Auto-updated Homebrew!
 + Updated Homebrew from a1939cfe7 to 99a8f15fb.
 + Updated 2 taps (homebrew/core and homebrew/cask).
 + ==> New Formulae
 + cargo-c  devdash      monolith      postgresql@11
 + ==> Updated Formulae
 + nss ✔    cstore_fdw  fluxctl  gwyddion    maxwell  pgroonga    pspg    streamlink
 + wget ✔  dcos-cli    gcc@6    haproxy  n    pgrouting    restic  stunnel
 + awscli  eslint  gcc@8    helmfile    navi    phpmyadmin  salt    temporal_tables
 + babel    evince  gitleaks    juju    nsd      postgis  scipy    terrahub
 + cfn-lint    exploitdb    glooctl  libpq    paket    postgresql  simple-scan  wal2json
 + citus    file-roller  goreleaser  libpqxx  pgloader    proftpd  sn0int  yelp-tools
 + 
 + ==> Downloading https://homebrew.bintray.com/bottles/masscan-1.0.5.high_sierra.bottle.tar.gz
 + ######################################################################## 100.0%
 + ==> Pouring masscan-1.0.5.high_sierra.bottle.tar.gz
 + 🍺  /usr/local/Cellar/masscan/1.0.5: 5 files, 284.6KB
 + $
 + 問題なく完了.
 +
 +**masscanを使って80番ポートをスキャン [#d6f8028e]
 +
 + まず簡単に使って見る. ポート80番(HTTP)でlocalhostをスキャン.
 +
 + $ /usr/local/bin/masscan -p80 127.0.0.1🆑
 + FAIL: en0: You don't have permission to capture on that device ((cannot open BPF device) /dev/bpf0: Permission denied)
 +  [hint] need to sudo or run as root or something
 +  [hint] I've got some local priv escalation 0days that might work
 + adapter[en0].init: failed
 + $
 +
 + root権限が必要だそうだ.
 + sudoして実行する.
 +
 + $ sudo /usr/local/bin/masscan -p80 127.0.0.1🆑
 + Password:🆑
 + 
 + Starting masscan 1.0.4 (http://bit.ly/14GZzcT) at 2019-11-24 11:24:55 GMT
 +  -- forced options: -sS -Pn -n --randomize-hosts -v --send-eth
 + Initiating SYN Stealth Scan
 + Scanning 1 hosts [1 port/host]
 + $
 + localhost(127.0.0.1)なので1台見つかったとされる.
 +
 +**セグメント全体をスキャンして見る [#o1ced429]
 +
 + 0番ポートから65535ポートまでを指定してセグメト全体を指定.
 +
 + $ date;sudo /usr/local/bin/masscan -p0-65535 192.168.20.1/24;date🆑
 + 日 11 24 20:27:07 JST 2019
 + 
 + Starting masscan 1.0.4 (http://bit.ly/14GZzcT) at 2019-11-24 11:27:08 GMT
 +  -- forced options: -sS -Pn -n --randomize-hosts -v --send-eth
 + Initiating SYN Stealth Scan
 + Scanning 256 hosts [65536 ports/host]
 + Discovered open port 62078/tcp on 192.168.20.126
 + Discovered open port 62078/tcp on 192.168.20.103
 + Discovered open port 62078/tcp on 192.168.20.108
 +  Cwaiting several seconds to exit...
 + saving resume file to: paused.conf
 + 月 11 25 01:13:45 JST 2019
 + $
 +
 + 5時間かかっても終わらないので,停止してみた.
 + 次に,自分自身1台だけと対象を絞って,0番ポートから65535ポートで調べて見る.
 +
 + $ date;sudo /usr/local/bin/masscan -p0-65535 192.168.20.32;date🆑
 + 月 11 25 22:47:29 JST 2019
 + Password:
 + 
 + Starting masscan 1.0.4 (http://bit.ly/14GZzcT) at 2019-11-25 13:47:33 GMT
 +  -- forced options: -sS -Pn -n --randomize-hosts -v --send-eth
 + Initiating SYN Stealth Scan
 + Scanning 1 hosts [65536 ports/host]
 + 月 11 25 22:58:41 JST 2019
 + $
 +
 + 1台だけでも11分程度かかっている模様.
 +
 + そしてこのあと大問題が・・・・
 +
 +**ルータが停止した [#ee897a20]
 +
 + セグメント全体をスキャンしていても問題なかったから,localhostをスキャンしても問題ないだろうと思ったけれど,それが大きな間違いでルータに負荷をかけてしまった模様.ルータがハングアップした.
 + セグメント全体をスキャンといっても40%位までだったので,ローカルをスキャンするところまでいってないわけだから,偶然,問題発生にヒットしなかったことになる.
 +
 + 使い方を間違えるとダウンさせてしまうという例かな.実験環境でよかった.ふぅ...
  

  • SecurityTool/masscan/mac のバックアップ差分(No. All)
    • 現: 2019-11-25 (月) 23:45:36 nobuaki

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   ページ新規作成 全ページ一覧 単語検索 最新ページの一覧   ヘルプ   最新ページのRSS 1.0 最新ページのRSS 2.0 最新ページのRSS Atom
Counter: 1657, today: 2, yesterday: 1

広告スペース
Google