本文へスキップ
Skillpedia
エージェント35k · #7865

detecting-ransomware-encryption-behavior

できること

このシステムは、ランサムウェアがリアルタイムでファイルを暗号化していないかを検出します。ファイルがどのように変更されているか、また内容が非常にランダムになっていないか(高エントロピー)を監視します。これは暗号化の兆候です。

使う場面

  • ✓新しいタイプのランサムウェアを検知する仕組みを構築するとき。
  • ✓大量の暗号化からファイルサーバーやコンピューターを守るために監視するとき。
  • ✓多数のファイルを短時間で暗号化するなど、不審な動きをしているプログラムを調べるとき。

スキルのリンク

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/detecting-ransomware-encryption-behavior/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/detecting-ransomware-encryption-behavior/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“リアルタイムでランサムウェアによる暗号化の動きがないか確認してください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

このシステムは、ファイル内容の「ランダムさ」(エントロピー)を分析し、プログラムがファイルにアクセスして変更する様子を監視します。あるプログラムが多くのファイルを素早く変更し、その内容が非常にランダムになった場合、暗号化の可能性があるとして警告します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Detecting Ransomware Encryption Behavior

When to Use

  • Building or tuning a behavioral detection layer for ransomware that catches unknown/zero-day variants
  • Monitoring file servers and endpoints for mass encryption activity that evades signature-based detection
  • Implementing entropy-based detection to identify when files are being replaced with encrypted (high-entropy) content
  • Analyzing suspicious process behavior patterns: rapid sequential file opens, writes, renames, and deletes
  • Validating EDR detection rules against actual ransomware encryption patterns during red team exercises

Do not use entropy analysis alone as the only detection signal. Compressed files (ZIP, JPEG, MP4) naturally have high entropy and will cause false positives. Always combine entropy with behavioral signals like I/O rate and file rename patterns.

Prerequisites

  • Python 3.8+ with watchdog and psutil libraries
  • Administrative access for process monitoring and file system event capture
  • Understanding of Shannon entropy and its application to file content analysis
  • Windows: Sysmon installed for detailed process and file system event logging
  • Linux: auditd configured for file access monitoring, or inotify-based watchers
  • Baseline entropy values for common file types in the monitored environment

Workflow

Step 1: Establish Entropy Baselines

Calculate normal entropy ranges for files in the environment:

Entropy Baselines by File Type:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
File Type       Normal Entropy    Encrypted Entropy
.docx           3.5 - 6.5        7.8 - 8.0
.xlsx           4.0 - 6.8        7.8 - 8.0
.pdf            5.0 - 7.2        7.8 - 8.0
.txt            2.0 - 5.0        7.8 - 8.0
.csv            2.0 - 5.5        7.8 - 8.0
.sql            2.5 - 5.0        7.8 - 8.0
.jpg/.png       7.0 - 7.9        7.9 - 8.0 (hard to distinguish)
.zip/.7z        7.5 - 8.0        7.9 - 8.0 (hard to distinguish)

Key insight: Text-based files show the largest entropy jump when encrypted,
making them the best candidates for entropy-based detection.

Step 2: Implement Real-Time Entropy Monitoring

Monitor file writes and calculate entropy of new content:

import math
from collections import Counter

def shannon_entropy(data):
    """Calculate Shannon entropy of byte data (0.0 to 8.0 scale)."""
    if not data:
        return 0.0
    freq = Counter(data)
    length = len(data)
    return -sum((c / length) * math.log2(c / length) for c in freq.values())

def is_encryption_entropy(data, threshold=7.5):
    """Check if data entropy indicates encryption."""
    entropy = shannon_entropy(data)
    return entropy >= threshold, entropy

Step 3: Monitor File System I/O Patterns

Track process-level file operations for ransomware patterns:

Ransomware I/O Behavior Signatures:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1. Rapid sequential file modification:
   - >20 files modified per minute by single process
   - Read original → Write encrypted → Rename with new extension
   - Pattern: CreateFile → ReadFile → WriteFile → CloseHandle → MoveFile

2. File extension changes:
   - Original: report.docx → Encrypted: report.docx.locked
   - Many extensions changed within short time window

3. Ransom note creation:
   - Same text file (README.txt, DECRYPT.html) created in multiple directories
   - Created immediately after file encryption in each directory

4. Shadow copy deletion:
   - vssadmin.exe delete shadows /all /quiet
   - wmic.exe shadowcopy delete
   - PowerShell: Get-WmiObject Win32_Shadowcopy | Remove-WmiObject

5. Entropy spike pattern:
   - File read: entropy 3.5 (normal document)
   - File write: entropy 7.9 (encrypted content)
   - Delta > 3.0 is strong ransomware indicator

Step 4: Implement Behavioral Scoring

Combine multiple signals into a composite ransomware score:

def calculate_ransomware_score(process_metrics):
    """Score process behavior for ransomware likelihood (0-100)."""
    score = 0

    # High file modification rate
    files_per_min = process_metrics.get("files_modified_per_minute", 0)
    if files_per_min > 50:
        score += 30
    elif files_per_min > 20:
        score += 15

    # Entropy increase in written files
    avg_entropy_delta = process_metrics.get("avg_entropy_delta", 0)
    if avg_entropy_delta > 3.0:
        score += 30
    elif avg_entropy_delta > 2.0:
        score += 15

    # File extension changes

…
よくある質問

「エントロピー」とは何ですか?

エントロピーは、ファイルの内容がどれだけランダムで予測しにくいかを示す指標です。通常のファイルは予測しやすいエントロピーを持ちますが、暗号化されたファイルや圧縮されたファイルは、よりランダムに見えるため高いエントロピーを持ちます。

エントロピー分析だけを使ってはいけないのはなぜですか?

ZIPやJPEGなどの圧縮ファイルも高いエントロピーを持つため、誤検知の原因になることがあります。ファイルの変更速度や名前の変更パターンなど、ほかの情報と組み合わせることが重要です。

このツールを使うための前提条件は何ですか?

Python、watchdogやpsutilなどの特定のライブラリ、システムを監視するための管理者権限が必要です。OSによっては、Windowsの場合はSysmon、Linuxの場合はauditdなどのツールも必要になります。

詳細

作者による元の説明

Detects ransomware encryption activity in real time using entropy analysis, file system I/O monitoring (Sysmon, watchdog, psutil), and behavioral scoring to identify mass file modification, abnormal entropy spikes in written data, and suspicious process behavior characteristic of encryption routines. Use when building real-time ransomware detection, tuning entropy thresholds, or investigating susp

repo: mukul975/Anthropic-Cybersecurity-Skills

人気

GitHubのスター
35k
ランキング
#7865
ライセンス
Apache-2.0
更新日
2026/8/31

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル