LoginSignup
2
0

ONTAPのSecurity機能について9【Autonomous Ransomware Protection(ARP)】

Last updated at Posted at 2024-06-17

はじめに

ランサムウェアは、コンピューターシステムを攻撃し、データを暗号化してアクセスを制限し、その解除のための身代金を要求するマルウェアで、この攻撃は個人から大企業、さらには政府機関にまで及び、全世界的な問題となっています。
かつては電子メールを通じた攻撃が一般的でしたが、現在ではネットワーク機器の脆弱性を狙った侵入や、データを盗み出して公開を脅かす二重恐喝(ダブルエクストーション)が増えており、さらには「ノーウェアランサム」と呼ばれる、データを盗み出し身代金を要求する手法も見受けられます。

しかしながら、身代金を支払ったとしてもデータが必ずしも元通りになるわけではない為、ランサムウェアから自身を守る最善の手段は、定期的なバックアップ、システムとソフトウェアの更新、そして不審なメールやウェブサイトからのダウンロードを避ける事となります。

バックアップの取得といっても本来は時間がかかる上、復旧には被害に遭った際の直前のバックアップが必要になってきます。
本記事では、ランサムウェア攻撃の疑いが検出された際に自動でSnapshotを取得するONTAPのRansomware対策機能、Autonomous Ransomware Protection(ARP)について記載します。

qiita-square

何をしたい?できる?

ONTAPでARP機能を有効にして異常検知させる
異常なファイル動作を検出してSnapShotの自動作成
Autosupportとは別で異常検出時に管理者への通知
作成されたARP用のSnapshotからのリストア

ONTAPにおけるRansomware対策機能

ARP(Autonomous Ransomware Protection)は、NAS環境の異常を検出し、攻撃が疑われる場合にSnapshotの作成を実施します。異常検知は、受信データの暗号化/非暗号化の識別、エントロピー分析、ファイル拡張子タイプ、ファイルIOPSなどに基づいて検出を行います。

また、ARPでは「学習モード」と「アクティブモード」の2つのモードがあり学習モード時に保護対象VolumeのI/O特性や格納されるファイル拡張子を学習し、アクティブモードに切り替え後は、異常検知時にARP Snapshotを作成することで脅威が検出された場合にデータを保護します。

学習モードの期間は、誤検知を防ぐため30日間を推奨としていますが、ONTAP9.13.1以降では最適な学習期間がONTAP側で自動決定されます。
その後、自動的にアクティブモードに切り替わります。アクティブモードでは、受信データの脅威を評価し、脅威を検出すると評価レベル(低、中)が割り当てられます。脅威が低い場合でも異常を検出し、Snapshotを作成して復旧ポイントを確保します。

qiita-square

なお、ARP機能の適している環境等については、マニュアルを参照してください。

記事における環境情報

本記事では、以下の環境で実施した内容となります。
分かり易くするために、Network構成は単純化しています。

  • ONTAP : 9.14.1
  • Windows Active Directory環境
qiita-square

GUIでも設定できますが、本記事ではCLIで操作します

設定手順

手順内で指定されているSVM名やパラメータは、環境により異なるので適宜変更して下さい。

1. ARP機能の有効化

1-1. 前提条件の確認

ARPを有効化するにあたって、以下の内容が適用されている事を確認します。

  • ライセンスがインストールされている
  • SVM上でNFSかCIFSが有効になっている
  • ARP設定対象のVolumeはジャンクションパスがある
  • Volume使用率が100%未満

また、推奨事項としては以下の通りです。

  • ARPに関する通知を含む送信を行うように設定する
  • Multi-admin Verification(MAV;マルチ管理者検証)を有効にする
  • FPolicyやTmperproof Snapshotを利用する
# ライセンスの確認
> license show -package Anti_ransomware
  (system license show)

Serial Number: xxxxxxxxxxxxx
Owner: PS-C250-01
Installed License: ONTAP ONE
Capacity: 1.20PB
Package           Type     Description           Expiration
----------------- -------- --------------------- -------------------
Anti_ransomware   capacity Autonomous Ransomware Protection License -

Serial Number: xxxxxxxxxxxxx
Owner: PS-C250-02
Installed License: ONTAP ONE
Capacity: 1.20PB
Package           Type     Description           Expiration
----------------- -------- --------------------- -------------------
Anti_ransomware   capacity Autonomous Ransomware Protection License -
2 entries were displayed.


# CIFSサービスの確認
> cifs show -vserver vs_cifs11

                                          Vserver: vs_cifs11
                         CIFS Server NetBIOS Name: CIFSSVM11
                    NetBIOS Domain/Workgroup Name: PS-SC
                      Fully Qualified Domain Name: PS-SC.LOCAL
                              Organizational Unit: CN=Computers
Default Site Used by LIFs Without Site Membership:
                                   Workgroup Name: -
                             Authentication Style: domain
                CIFS Server Administrative Status: up
                          CIFS Server Description:
                          List of NetBIOS Aliases: -


# ARP対象のVolumeの確認
> vol show -vserver vs_cifs11 -volume cifs100 -fields volume,size,percent-used,junction-path
vserver   volume  size junction-path percent-used
--------- ------- ---- ------------- ------------
vs_cifs11 cifs100 20GB /cifs100      0%


> cifs share show -vserver vs_cifs11 -volume cifs100
Vserver        Share         Path              Properties Comment  ACL
-------------- ------------- ----------------- ---------- -------- -----------
vs_cifs11      cifs100       /cifs100          oplocks    -        Everyone / Full Control
                                               browsable
                                               changenotify
                                               show-previous-versions

本環境ではイベント通知として、ランサムウェアに関係するイベント一連や、callhome.arw.activity.seenをMail通知するように設定しています。
(callhomeと付くものはHTTPSを使ったAutoSupport通知も別途実施されます)

ARPに関するイベントはarwになります(pじゃなくてw)

# ランサムウェアに関するイベントの確認
> event catalog  show -message-name *arw*
Message                          Severity         SNMP Trap Type
-------------------------------- ---------------- -----------------
arw.analytics.ext.report         NOTICE           Severity-based
arw.analytics.high.entropy       ERROR            Severity-based
arw.analytics.probability        ERROR            Severity-based
arw.analytics.report             NOTICE           Severity-based
arw.analytics.suspects           ERROR            Severity-based
arw.auto.switch.enabled          NOTICE           Severity-based
arw.new.file.extn.seen           NOTICE           Severity-based
arw.snapshot.created             NOTICE           Severity-based
arw.volume.state                 NOTICE           Severity-based
arw.vserver.state                NOTICE           Severity-based
callhome.arw.activity.seen       ALERT            Severity-based
11 entries were displayed.


# 通知対象のイベントの確認
> event filter show -filter-name arw-filter
Filter      Rule Rule                                    SNMP Trap
Name        Posn Type     Message Name     Severity      Type      Parameters
----------- ---- -------- ---------------- ------------- --------- -----------
arw-filter
            1    include  callhome.arw.activity.seen ALERT *       *=*
            2    include  arw.*            ERROR, NOTICE *         *=*
            3    exclude  *                *             *         *=*
3 entries were displayed.


# 通知先の確認
> event notification show -filter-name arw-filter
ID   Filter Name                     Destinations
---- ------------------------------  -----------------
2    arw-filter                      mail01

1-2. 学習モードでARPの有効化

ARPの対象Volumeに対して、学習モードでARPを有効化し、正常な動作や書き込まれる拡張子を学習させます。

qiita-square

本来、ONTAP 9.13.1以降ではARPによって最適な学習期間間隔が自動的に決定され、アクティブモードへ切り替えが実施されますが、本環境では、短時間での検知までを試したいので、Adaptive learning機能については無効に設定します。
(学習期間は短くして有効化させる)

# 既存のVolumeに対し、学習モードでARP機能を有効化
> security anti-ransomware volume dry-run -volume cifs100  -vserver vs_cifs11
Volume modify successful on volume cifs100 of Vserver vs_cifs11.

> security anti-ransomware volume show  -vserver vs_cifs11
Vserver    Volume           State            Dry Run Start Time
---------- ---------------- ---------------- ------------------
vs_cifs11  cifs100          dry-run          6/14/2024 17:59:04
vs_cifs11  report           disabled         -
2 entries were displayed.


# Adaptive learning機能については無効化
> vserver modify vs_cifs11  -anti-ransomware-auto-switch-from-learning-to-enabled false

本環境ではランサムウェアに関係するイベントについてメール通知の設定をしているので、有効化の際には以下のようなメールが通知されます。
qiita-square

1-3. ARP対象のVolumeへアクセス開始

ARP対象のVolumeに対してファイルのRead/Write等を開始して、状態を学習させます。
qiita-square

また、学習中の内容については、anti-ransomware volume workload-behaviorコマンドで概要を確認することができます。

# 学習モード中に書き込まれた拡張子等が確認できる
> security anti-ransomware volume workload-behavior show -vserver vs_cifs11 -volume cifs100
                                         Vserver: vs_cifs11
                                          Volume: cifs100
                        File Extensions Observed: txt, exe, zip, pdf, xlsx,
                                                  msi, pem, csv, pptx, dotx,
                                                  tgz, ps1
              Number of File Extensions Observed: 12

 Historical Statistics
              High Entropy Data Write Percentage: 56
   High Entropy Data Write Peak Rate (KB/Minute): 205896
              File Create Peak Rate (per Minute): 103
              File Delete Peak Rate (per Minute): 51
              File Rename Peak Rate (per Minute): -
(中略)

1-4. 通知項目の追加

ONTAP 9.14.1以降では以下の2つのイベント通知をVolumeやSVM単位で指定できます。
(デフォルトでは無効になっている)

  • ARPの学習期間で把握しているファイル拡張子以外のファイルを発見
  • ARP Snapshot作成

本記事では上記のイベントを有効化します。

# 新しい拡張子の検出とSnapshot作成についてのイベント有効化
> security anti-ransomware volume event-log modify -vserver vs_cifs11  -is-enabled-on-new-file-extension-seen true -volume cifs100

> security anti-ransomware volume event-log modify -vserver vs_cifs11  -is-enabled-on-snapshot-copy-creation true -volume cifs100

> anti-ransomware volume event-log show -vserver vs_cifs11 -volume cifs100
  (security anti-ransomware volume event-log show)

                         Vserver Name: vs_cifs11
                          Volume Name: cifs100
Is Enabled on New File Extension Seen: true
 Is Enabled on Snapshot Copy Creation: true

1-4. アクティブモードへの切り替え

学習期間を終了させ、アクティブモードとして動作するように切り替えます。
これ以降は、異常検知時に自動でSnapshot作成が行われるようになります。
(本記事では動作確認も目的の為、短期間の学習)

qiita-square
# アクティブモードへの切り替え
> security anti-ransomware volume enable -vserver vs_cifs11 -volume cifs100
Volume modify successful on volume cifs100 of Vserver vs_cifs11.


# 状態の確認
> security anti-ransomware volume show -vserver vs_cifs11
Vserver    Volume           State            Dry Run Start Time
---------- ---------------- ---------------- ------------------
vs_cifs11  cifs100          enabled          -
vs_cifs11  report           disabled         -
2 entries were displayed.

ARP対象のVolumeの状態が変更されたので、以下のようなメール通知も実施されます。
qiita-square

2. 攻撃を検知してSnapshotが自動作成されるか確認

学習時と異なる挙動や拡張子を作成して、自動的にSnapshot作成や通知がなされる事を確認します。
qiita-square

2-1. 検知しやすいようにパラメータの調整

検証環境では、少ないファイル数の再作成や新しい拡張子数でも検知できるように攻撃検知のパラメータ値(数値部分)を設定します。

パラメータ 説明
high-entropy-data-surge-notify-percentage 過去の観測値と比較したエントロピーにおいて安全と考えられる急増%
file-create-rate-surge-notify-percentage 過去の観測値と比較したファイルcreateにおいて安全と考えられる急増%
file-delete-rate-surge-notify-percentage 過去の観測値と比較したファイルDeleteにおいて安全と考えられる急増%
file-rename-rate-surge-notify-percentage 過去の観測値と比較したファイルRenameにおいて安全と考えられる急増%
never-seen-before-file-extn-count-notify-threshold Create/Rename操作で、過去に見たことのない拡張子数の閾値
never-seen-before-file-extn-duration-in-hours 以前に見たことがない拡張子の継続時間を時間単位で表示(上記optionsとセット)
# 攻撃検出パラメータの変更
> security anti-ransomware volume attack-detection-parameters modify -vserver vs_cifs11 -volume cifs100 -high-entropy-data-surge-notify-percentage 5 -file-create-rate-surge-notify-percentage 5 -file-delete-rate-surge-notify-percentage 5 -never-seen-before-file-extn-count-notify-threshold 2 -never-seen-before-file-extn-duration-in-hours 1

# 設定したパラメータ値の確認
> security anti-ransomware volume attack-detection-parameters show -vserver vs_cifs11 -volume cifs100
                                             Vserver Name : vs_cifs11
                                              Volume Name : cifs100
            Is Detection Based on High Entropy Data Rate? : true
  Is Detection Based on Never Seen before File Extension? : true
                  Is Detection Based on File Create Rate? : true
                  Is Detection Based on File Rename Rate? : true
                  Is Detection Based on File Delete Rate? : true
           Is Detection Relaxing Popular File Extensions? : true
                High Entropy Data Surge Notify Percentage : 5
                 File Create Rate Surge Notify Percentage : 5
                 File Rename Rate Surge Notify Percentage : 100
                 File Delete Rate Surge Notify Percentage : 5
 Never Seen before File Extensions Count Notify Threshold : 2
       Never Seen before File Extensions Duration in Hour : 1

2-2. Volumeのファイルの削除と再作成の繰り返し

ファイルを暗号化するといったランサムウェア攻撃では無いですが、ファイル作成が急増といういつもと異なる振る舞いを実行しても検知するか確認します。

qiita-square

2-3. 通知の確認とSnapshotの確認

Anti_ransomware_backuXXXという名前のSnapshotが自動作成される事と、Snapshot作成に関する通知が実施される事を確認します。
なお、ランサムウェア攻撃の振る舞いでは無いので、攻撃の可能性としては検知して無い形です。

# Snapshotの一覧確認
> snapshot show -vserver vs_cifs11 -volume cifs100
                                                                 ---Blocks---
Vserver  Volume   Snapshot                                  Size Total% Used%
-------- -------- ------------------------------------- -------- ------ -----
vs_cifs11 cifs100
                  daily.2024-06-15_0010                    160KB     0%    0%
                  hourly.2024-06-15_1205                   156KB     0%    0%
                  hourly.2024-06-15_1305                   156KB     0%    0%
                  hourly.2024-06-15_1405                   156KB     0%    0%
                  hourly.2024-06-15_1505                   156KB     0%    0%
                  hourly.2024-06-15_1605                   156KB     0%    0%
                  hourly.2024-06-15_1705                  3.26GB    16%   42%
                  Anti_ransomware_backup.2024-06-15_1721 27.68MB     0%    1%
8 entries were displayed.

# ランサムウェア攻撃の疑いがあるかを確認
> security anti-ransomware volume show -vserver vs_cifs11 -volume cifs100

      Vserver Name: vs_cifs11
       Volume Name: cifs100
             State: enabled
Dry Run Start Time: -
Attack Probability: none
   Attack Timeline: -
 Number of Attacks: -

ARP対象のVolumeでSnapshotが作成されたので、以下のようなメール通知も実施されます。
qiita-square

2-4. Volume内のファイルへの大量の暗号化を実施

ランサムウェア攻撃を模した形で、テキストファイルへの暗号化を実施します。
圧縮や暗号化についてはChatGPTを利用してコードを作成しています。

qiita-square
# 暗号化鍵とIVの生成
$key = New-Object Byte[] 32  # AES 256-bit key
$iv = New-Object Byte[] 16   # AES block size (128-bit IV)
[System.Security.Cryptography.RNGCryptoServiceProvider]::Create().GetBytes($key)
[System.Security.Cryptography.RNGCryptoServiceProvider]::Create().GetBytes($iv)

# 指定ディレクトリ内のファイルを圧縮・暗号化
$targetFolder = "C:\Path\To\Your\Folder"  # 対象ディレクトリのパスを設定

Get-ChildItem $targetFolder -File | ForEach-Object {
    $originalFile = $_.FullName
    $compressedFile = "$originalFile.gz"
    $encryptedFile = "$originalFile.encrypted"

    # ファイルを圧縮
    $fileStream = [System.IO.File]::OpenRead($originalFile)
    $compressedStream = [System.IO.File]::Create($compressedFile)
    $gzipStream = New-Object System.IO.Compression.GZipStream $compressedStream, ([System.IO.Compression.CompressionMode]::Compress)
    $fileStream.CopyTo($gzipStream)
    $gzipStream.Dispose()
    $compressedStream.Dispose()
    $fileStream.Dispose()

    # 圧縮ファイルを暗号化
    $fileContent = [System.IO.File]::ReadAllBytes($compressedFile)
    $aes = New-Object System.Security.Cryptography.AesCryptoServiceProvider
    $aes.Key = $key
    $aes.IV = $iv
    $encryptor = $aes.CreateEncryptor($aes.Key, $aes.IV)
    $encryptedContent = $encryptor.TransformFinalBlock($fileContent, 0, $fileContent.Length)
    [System.IO.File]::WriteAllBytes($encryptedFile, $encryptedContent)

    # 生成された圧縮ファイルと元のファイルを削除
    Remove-Item $compressedFile
    Remove-Item $originalFile
}

他者が管理している機器に対し行うことは不正アクセスとなる為、自ら管理・構築した環境でのみ実施して下さい。

2-5. 通知の確認とSnapshotの確認

Anti_ransomware_backuXXXという名前のSnapshotが自動作成される事と、Snapshot作成に関する通知が実施される事を確認します。
なお、ランサムウェア攻撃に似せているので、低確率ではあるものの攻撃されていると判断し、Snapshotの自動作成が実施されている事が確認できます。

# Snapshotの一覧確認
> snapshot show -vserver vs_cifs11 -volume cifs100
                                                                 ---Blocks---
Vserver  Volume   Snapshot                                  Size Total% Used%
-------- -------- ------------------------------------- -------- ------ -----
vs_cifs11
         cifs100
                  daily.2024-06-15_0010                    168KB     0%    0%
                  hourly.2024-06-15_1605                   156KB     0%    0%
                  hourly.2024-06-15_1705                  3.26GB    16%   47%
                  Anti_ransomware_backup.2024-06-15_1721 27.70MB     0%    1%
                  hourly.2024-06-15_1805                   184KB     0%    0%
                  hourly.2024-06-15_1905                   160KB     0%    0%
                  hourly.2024-06-15_2005                   168KB     0%    0%
                  hourly.2024-06-15_2105                 276.8MB     1%    7%
                  Anti_ransomware_backup.2024-06-15_2113 690.5MB     3%   16%
9 entries were displayed.

# ランサムウェア攻撃の疑いがあるかを確認
> security anti-ransomware volume show -vserver vs_cifs11 -volume cifs100

      Vserver Name: vs_cifs11
       Volume Name: cifs100
             State: enabled
Dry Run Start Time: -
Attack Probability: low
   Attack Timeline: 6/15/2024 21:13:01
 Number of Attacks: 1

ARP対象のVolumeで新しい拡張子が検出されたので、Snapshot作成の通知の他に以下のようなメール通知も実施されます。

qiita-square

2-6. Reportの表示

攻撃レポートを指定したVolume上へ生成し、内容を確認する事ができます。

> security anti-ransomware volume attack generate-report -volume cifs100 -vserver vs_cifs11 -dest-path vs_cifs11:report
Report "report_file_vs_cifs11_cifs100_15-06-2024_21-25-15" available at path "vs_cifs11:report".
qiita-square

参考

拡張子をランサムウェア攻撃として知られたものに変更した上で、同様のファイル圧縮と暗号化を実施すると、以下のように攻撃されているとしてAutosupportの通知がなされます。

> security anti-ransomware volume show -vserver vs_cifs11 -volume cifs100

      Vserver Name: vs_cifs11
       Volume Name: cifs100
             State: enabled
Dry Run Start Time: -
Attack Probability: moderate
   Attack Timeline: 6/15/2024 21:45:09
 Number of Attacks: 1
qiita-square

また、NetAppのサポートサイトでもAlart通知を確認する事ができます。
qiita-square

3. 異常検知への対応

3-1. False positive(偽陽性)への対応

問題無いファイル拡張子にも関わらず、検知してしまった際には、許可されたリストへの追加を実施します。

# False positive(偽陽性)への対応
> security anti-ransomware volume attack clear-suspect -vserver vs_cifs11 -volume cifs100 -extension encrypted -false-positive true
Suspect records cleared: 1.

3-2. ランサムウェア攻撃からの復旧

本記事ではVolumeをSnapsotからRestoreを例に実施します。
(Clone Volumeの作成やSnapMirror先からの復旧については記載しない)

まずは、ARPで自動作成されたSnapshotからVolumeをリストアします。

>  snapshot restore -vserver vs_cifs11 -volume cifs100 -snapshot Anti_ransomware_backup.2024-06-15_2113

Warning: Snapshot copy "Anti_ransomware_backup.2024-06-15_2113" is not the most recent copy. Promoting this Snapshot
         copy will delete all copies made after it.
Do you want to continue? {y|n}: y

Warning: Quota rules currently enforced on volume "cifs100" might change during this operation. If the currently
         enforced quota rules are different from those in Snapshot copy "Anti_ransomware_backup.2024-06-15_2113", you
         might have to resize or reinitialize quotas on this volume after this operation.
Do you want to continue? {y|n}: y

Warning: Export policies currently enforced on the qtrees of volume "cifs100" will not change during this operation.
         If the currently enforced export policies are different from those in Snapshot copy
         "Anti_ransomware_backup.2024-06-15_2113", reassign the export policies of the qtrees on this volume after
         this operation.
Do you want to continue? {y|n}: y

ファイルが暗号化された事で検知し作成されたSnapshotからのリストアの為、いくつかのファイルは安全なSnapshotからの上書きコピーで元に戻す必要があります
(本記事では学習時に大量のファイルコピーも実施しており、検知に時間が多少かかっている)

  • リストアされたVolumeの状態
     (暗号化されたファイルが確認できる)
qiita-square
  • ARPのSnapshotより前のSnapshotから作成したClone Volumeの状態
    (暗号化されたファイルは無い状態)
qiita-square

なお、できるだけ被害を最小にするにはFpolicy機能を併用して、怪しい拡張子の書き込み自体をフィルタリングしておくといった対応が考えられます。

さらに影響範囲の把握や、攻撃ユーザの即時ブロックというような対応が必要な場合には、SaaS型のStorage Workload Securityの利用を検討頂くと良いのではないかと思います。

参考及びリンク

自動ランサムウェア対策による保護のユースケースと考慮事項
自動ランサムウェア対策を有効化
ランサムウェア攻撃のあとにデータをリストア
ARPスナップショット保護と攻撃検出の概要
Storage Workload Security(旧名:Cloud Secure)導入手順
ランサムウェアに強いストレージとは
Storage Workload Security
NetApp Ransomware Blog Series
ONTAPのSecurity機能について1【FPolicy編】
ONTAPのSecurity機能について5【Tamperproof Snapshot】
ONTAPのSecurity機能について6【Multi-admin Verification(マルチ管理者検証)】

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0