[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7B4WX2D1X53BCSPGFAE6P50":3,"skill-same:01M7B4WX2D1X53BCSPGFAE6P50":98},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":15,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":62,"commitSha":63,"skillDirectory":64,"forksCount":13,"repositoryHtmlUrl":65,"repositoryHomepageUrl":6,"ownerHtmlUrl":66,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":67,"install":68,"resources":81},"01M7B4WX2D1X53BCSPGFAE6P50","analyzing-ransomware-encryption-mechanisms",null,"Analyzes encryption algorithms, key management, and file encryption routines used by ransomware families to assess decryption feasibility, identify implementation weaknesses, and support recovery efforts. Covers AES, RSA, ChaCha20, and hybrid encryption schemes. Activates for requests involving ransomware cryptanalysis, encryption analysis, key recovery assessment, or ransomware decryption feasibility.","vikasvardhanv\u002Fjerry_skills","vikasvardhanv","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F99010657?v=4","01M7B2B0VN78W7529RQX5BR6DZ","01M7B2B0WDNTXJHRK3QNPNWRP6",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fvikasvardhanv\u002Fjerry_skills\u002Fblob\u002Fmain\u002Fskills\u002Fcurated_premium_skills\u002FAnthropic-Cybersecurity-Skills\u002Fskills\u002Fanalyzing-ransomware-encryption-mechanisms\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fvikasvardhanv\u002Fjerry_skills\u002Fblob\u002Fmain\u002Fskills\u002Fcurated_premium_skills\u002FAnthropic-Cybersecurity-Skills\u002Fskills\u002Fanalyzing-ransomware-encryption-mechanisms\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: analyzing-ransomware-encryption-mechanisms\ndescription: 'Analyzes encryption algorithms, key management, and file encryption\n  routines used by ransomware families to assess decryption feasibility, identify\n  implementation weaknesses, and support recovery efforts. Covers AES, RSA, ChaCha20,\n  and hybrid encryption schemes. Activates for requests involving ransomware cryptanalysis,\n  encryption analysis, key recovery assessment, or ransomware decryption feasibility.\n\n  '\ndomain: cybersecurity\nsubdomain: malware-analysis\ntags:\n- malware\n- ransomware\n- encryption\n- cryptanalysis\n- reverse-engineering\nversion: 1.0.0\nauthor: mahipal\nlicense: Apache-2.0\nnist_csf:\n- DE.AE-02\n- RS.AN-03\n- ID.RA-01\n- DE.CM-01\nmitre_attack:\n- T1486\n- T1573.001\n- T1573.002\n- T1027\nmitre_f3:\n  version: '1.1'\n  tactics:\n  - monetization\n  - positioning\n  techniques:\n  - id: F1018\n    name: Convert to Cryptocurrency\n    tactic: monetization\n    source: f3\n  - id: F1047\n    name: Transfer of funds\n    tactic: monetization\n    source: f3\n  - id: T1219\n    name: Remote Access Tools\n    tactic: positioning\n    source: attack\n---\n\n# Analyzing Ransomware Encryption Mechanisms\n\n## When to Use\n\n- A ransomware infection has occurred and recovery requires understanding the encryption scheme used\n- Assessing whether decryption is possible without paying the ransom (implementation flaws, known decryptors)\n- Reverse engineering ransomware to identify the encryption algorithm, key derivation, and key storage mechanism\n- Developing a decryptor tool when a weakness in the ransomware's cryptographic implementation is identified\n- Classifying a ransomware sample by its encryption approach to attribute it to a known family\n\n**Do not use** for production data recovery operations without first verifying the decryption method on test copies of encrypted files.\n\n## Prerequisites\n\n- Ghidra or IDA Pro for reverse engineering the ransomware binary\n- Python 3.8+ with `pycryptodome` library for testing encryption\u002Fdecryption routines\n- Sample encrypted files and their corresponding plaintext originals (known-plaintext pairs)\n- Access to the ransomware binary (unpacked if applicable)\n- Familiarity with symmetric (AES, ChaCha20) and asymmetric (RSA) cryptographic algorithms\n- NoMoreRansom.org database for checking existing free decryptors\n\n## Workflow\n\n### Step 1: Identify the Encryption Algorithm\n\nDetermine which cryptographic algorithm the ransomware uses:\n\n```python\n# Check for Windows Crypto API usage in imports\nimport pefile\n\npe = pefile.PE(\"ransomware.exe\")\n\ncrypto_apis = {\n    \"CryptAcquireContextA\": \"Windows CryptoAPI\",\n    \"CryptAcquireContextW\": \"Windows CryptoAPI\",\n    \"CryptGenKey\": \"Windows CryptoAPI key generation\",\n    \"CryptEncrypt\": \"Windows CryptoAPI encryption\",\n    \"CryptImportKey\": \"Windows CryptoAPI key import\",\n    \"BCryptOpenAlgorithmProvider\": \"Windows CNG (modern crypto)\",\n    \"BCryptEncrypt\": \"Windows CNG encryption\",\n    \"BCryptGenerateKeyPair\": \"Windows CNG asymmetric key gen\",\n}\n\nprint(\"Crypto API Imports:\")\nfor entry in pe.DIRECTORY_ENTRY_IMPORT:\n    for imp in entry.imports:\n        if imp.name and imp.name.decode() in crypto_apis:\n            print(f\"  {entry.dll.decode()} -> {imp.name.decode()}: {crypto_apis[imp.name.decode()]}\")\n```\n\n```\nCommon Ransomware Encryption Schemes:\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\nAES-256-CBC + RSA-2048:    Most common hybrid scheme (LockBit, REvil, Conti)\nAES-256-CTR + RSA-4096:    Stream cipher mode variant (BlackCat\u002FALPHV)\nChaCha20 + RSA-4096:       Modern stream cipher (Hive, Royal)\nSalsa20 + ECDH:            Curve25519 key exchange (Babuk)\nAES-128-ECB:               Weak mode - potential decryption via known-plaintext\nXOR-only:                  Trivial encryption - always recoverable\nCustom algorithm:          Often contains implementation flaws\n```\n\n### Step 2: Analyze Key Generation and Management\n\nReverse engineer how encryption keys are generated and stored:\n\n```\nKey Management Patterns in Ransomware:\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n1. STRONG (no recovery possible without key):\n   - Per-file AES key generated with CryptGenRandom\n   - AES key encrypted with embedded RSA public key\n   - Encrypted key appended to each file or stored separately\n   - RSA private key held only by attacker's C2 server\n\n2. WEAK (potential recovery):\n   - AES key derived from predictable seed (timestamp, PID)\n   - Same AES key used for all files (single key compromise = full recovery)\n   - Key transmitted to C2 before encryption starts (PCAP may contain key)\n   - XOR with short repeating key (brute-forceable)\n   - PRNG seeded with GetTickCount or time() (limited keyspace)\n\n3. FLAWED IMPLEMENTATION:\n   - ECB mode (preserves plaintext patterns)\n   - Initialization vector (IV) reuse across files\n   - Key stored in plaintext in memory (recoverable from memory dump)\n   - Partial encryption (only first N bytes encrypted)\n```\n\n### Step 3: Examine File Encryption Routine\n\nReverse engineer the file processing logic:\n\n```c\n\u002F\u002F Typical ransomware file encryption flow (decompiled pseudo-code from Ghidra):\n\nvoid encrypt_file(char *filepath) {\n    \u002F\u002F 1. Check file extension against target list\n    if (!is_target_extension(filepath)) return;\n\n    \u002F\u002F 2. Generate per-file AES key (32 bytes for AES-256)\n    BYTE aes_key[32];\n    CryptGenRandom(hProv, 32, aes_key);\n\n    \u002F\u002F 3. Generate random IV (16 bytes)\n    BYTE iv[16];\n    CryptGenRandom(hProv, 16, iv);\n\n    \u002F\u002F 4. Read file contents\n    HANDLE hFile = CreateFile(filepath, GENERIC_READ, ...);\n    BYTE *plaintext = read_entire_file(hFile);\n\n    \u002F\u002F 5. Encrypt with AES-256-CBC\n    aes_cbc_encrypt(plaintext, file_size, aes_key, iv);\n\n    \u002F\u002F 6. Encrypt AES key with RSA public key\n    BYTE encrypted_key[256];  \u002F\u002F RSA-2048 output\n    rsa_encrypt(aes_key, 32, rsa_pubkey, encrypted_key);\n\n    \u002F\u002F 7. Write: encrypted_data + encrypted_key + IV to file\n    write_file(filepath, encrypted_data, encrypted_key, iv);\n\n    \u002F\u002F 8. Rename file with ransomware extension\n    rename_file(filepath, strcat(filepath, \".locked\"));\n}\n```\n\n### Step 4: Check for Cryptographic Weaknesses\n\nTest the implementation for exploitable flaws:\n\n```python\nfrom Crypto.Cipher import AES\nimport os\nimport struct\n\n# Test 1: Check if same key is used for multiple files\n# Compare encrypted versions of known files\ndef check_key_reuse(file1_enc, file2_enc):\n    with open(file1_enc, \"rb\") as f:\n        data1 = f.read()\n    with open(file2_enc, \"rb\") as f:\n        data2 = f.read()\n\n    # Extract IVs (location depends on ransomware family)\n    # If IVs are same and files share encrypted blocks -> same key\n    iv1 = data1[-16:]  # Example: IV at end\n    iv2 = data2[-16:]\n    if iv1 == iv2:\n        print(\"[!] Same IV detected - key reuse likely\")\n\n# Test 2: Check for predictable key derivation\n# If key is derived from timestamp, iterate possible values\ndef brute_force_timestamp_key(encrypted_file, known_header, timestamp_range):\n    with open(encrypted_file, \"rb\") as f:\n        encrypted_data = f.read()\n\n    for ts in timestamp_range:\n        # Derive key the same way ransomware does\n        import hashlib\n        key = hashlib.sha256(str(ts).encode()).digest()\n        iv = encrypted_data[-16:]\n        cipher = AES.new(key, AES.MODE_CBC, iv)\n        decrypted = cipher.decrypt(encrypted_data[:16])\n\n        if decrypted[:len(known_header)] == known_header:\n            print(f\"[!] Key found! Timestamp: {ts}\")\n            return key\n\n    return None\n\n# Test 3: Check for ECB mode (pattern preservation)\ndef check_ecb_mode(encrypted_file):\n    with open(encrypted_file, \"rb\") as f:\n        data = f.read()\n    # ECB produces identical ciphertext for identical plaintext blocks\n    blocks = [data[i:i+16] for i in range(0, len(data), 16)]\n    unique = len(set(blocks))\n    total = len(blocks)\n    if unique \u003C total * 0.95:\n        print(f\"[!] ECB mode likely: {total-unique} duplicate blocks out of {total}\")\n```\n\n### Step 5: Attempt Key Recovery\n\nUse identified weaknesses for key recovery:\n\n```python\n# Recovery Method 1: Extract key from memory dump\n# Volatility plugin to scan for AES key schedules\n# vol3 -f memory.dmp windows.yarascan --yara-rule \"aes_key_schedule\"\n\n# Recovery Method 2: Known-plaintext attack (weak algorithms)\ndef xor_key_recovery(encrypted_file, known_plaintext):\n    \"\"\"Recover XOR key from known plaintext-ciphertext pair\"\"\"\n    with open(encrypted_file, \"rb\") as f:\n        ciphertext = f.read()\n\n    key = bytes(c ^ p for c, p in zip(ciphertext, known_plaintext))\n    # Find repeating key length\n    for key_len in range(1, 256):\n        candidate = key[:key_len]\n        if all(key[i] == candidate[i % key_len] for i in range(min(len(key), key_len * 4))):\n            print(f\"XOR key (length {key_len}): {candidate.hex()}\")\n            return candidate\n    return None\n\n# Recovery Method 3: Check NoMoreRansom for existing decryptors\n# https:\u002F\u002Fwww.nomoreransom.org\u002Fen\u002Fdecryption-tools.html\n```\n\n### Step 6: Document Encryption Analysis\n\nCompile findings into a structured report:\n\n```\nAnalysis should document:\n- Algorithm identified (AES, RSA, ChaCha20, custom)\n- Key size and mode of operation (CBC, CTR, ECB, GCM)\n- Key generation method (CSPRNG, predictable seed, static key)\n- Key storage location (appended to file, registry, C2 transmission)\n- File modification pattern (full encryption, partial, header-only)\n- Targeted file extensions\n- Ransom note format and payment infrastructure\n- Decryption feasibility assessment (possible\u002Fimpossible\u002Fpartial)\n- Recommended recovery approach\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| **Hybrid Encryption** | Combining symmetric (AES) for fast file encryption with asymmetric (RSA) for secure key wrapping; the standard ransomware approach |\n| **Key Wrapping** | Encrypting the per-file symmetric key with the attacker's RSA public key so only the attacker's private key can decrypt it |\n| **ECB Mode** | Electronic Codebook mode encrypts each block independently; preserves patterns in plaintext, a critical weakness enabling partial recovery |\n| **Known-Plaintext Attack** | Using a known original file and its encrypted version to derive the encryption key; effective against XOR and weak stream ciphers |\n| **Key Schedule** | The expanded form of an AES key in memory; scannable in memory dumps to recover encryption keys before they are erased |\n| **CSPRNG** | Cryptographically Secure Pseudo-Random Number Generator; ransomware using CryptGenRandom produces unpredictable keys |\n| **Partial Encryption** | Some ransomware only encrypts the first N bytes or every Nth block for speed; unencrypted portions may aid recovery |\n\n## Tools & Systems\n\n- **Ghidra**: Reverse engineering suite for analyzing ransomware encryption routines at the assembly level\n- **PyCryptodome**: Python cryptographic library for implementing and testing decryption routines\n- **NoMoreRansom.org**: Free decryption tool repository maintained by Europol and security vendors for known ransomware families\n- **Volatility**: Memory forensics framework for extracting encryption keys from RAM dumps of infected systems\n- **CryptoTester**: Tool for identifying cryptographic algorithms based on constants and code patterns\n\n## Common Scenarios\n\n### Scenario: Assessing Decryption Feasibility for a Ransomware Incident\n\n**Context**: An organization is hit with ransomware encrypting file servers. Management needs to know if decryption is possible without paying the ransom before making a recovery decision.\n\n**Approach**:\n1. Identify the ransomware family from ransom note, file extension, and sample hash (check ID Ransomware)\n2. Check NoMoreRansom.org for existing free decryptors for this family\n3. Reverse engineer the encryption routine in Ghidra to identify the algorithm and key management\n4. Test for implementation weaknesses (key reuse, predictable seeds, ECB mode)\n5. Check if PCAP from the incident captured the key transmission to C2 (if key was sent before encryption)\n6. Scan memory dumps from affected machines for AES key schedules in RAM\n7. Report findings: decryption possible\u002Fimpossible with specific technical justification\n\n**Pitfalls**:\n- Testing decryption methods on the only copy of encrypted files (always work on copies)\n- Assuming all files use the same key without verifying (some ransomware uses per-file keys)\n- Not checking for volume shadow copies (vssadmin) which ransomware may have failed to delete\n- Confusing the file encryption algorithm with the key wrapping algorithm in reports\n\n## Output Format\n\n```\nRANSOMWARE ENCRYPTION ANALYSIS\n================================\nSample:           lockbit3.exe\nFamily:           LockBit 3.0 \u002F LockBit Black\nSHA-256:          abc123def456...\n\nENCRYPTION SCHEME\nFile Cipher:      AES-256-CTR (per-file unique key)\nKey Wrapping:     RSA-2048 (public key embedded in binary)\nKey Generation:   CryptGenRandom (CSPRNG - unpredictable)\nIV Generation:    Random 16 bytes per file\nFile Structure:   [encrypted_data][rsa_encrypted_key(256B)][iv(16B)][magic(8B)]\n\nTARGETED EXTENSIONS\nTotal:            412 extensions targeted\nCategories:       Documents (.doc, .xls, .pdf), Databases (.sql, .mdb),\n                  Archives (.zip, .7z), Source code (.py, .java, .cs)\nExcluded:         .exe, .dll, .sys, .lnk (system files preserved)\n\nIMPLEMENTATION ANALYSIS\nKey Strength:     STRONG - per-file random keys, no reuse\nMode Security:    STRONG - CTR mode with unique nonces\nKey Storage:      RSA-encrypted key appended to each file\nShadow Copies:    Deleted via vssadmin and WMI\n\nDECRYPTION FEASIBILITY\nWithout Key:      NOT POSSIBLE\n  - No implementation flaws identified\n  - RSA-2048 key wrapping prevents brute force\n  - CSPRNG prevents key prediction\n  - No existing free decryptor available\n\nRECOVERY OPTIONS\n1. Restore from offline backups (recommended)\n2. Check for volume shadow copies (low probability - ransomware deletes them)\n3. Memory forensics if machine was not rebooted (key may persist in RAM)\n4. Negotiate with attacker (last resort - no guarantee of decryption)\n```\n","# Analyzing Ransomware Encryption Mechanisms\n\n## When to Use\n\n- A ransomware infection has occurred and recovery requires understanding the encryption scheme used\n- Assessing whether decryption is possible without paying the ransom (implementation flaws, known decryptors)\n- Reverse engineering ransomware to identify the encryption algorithm, key derivation, and key storage mechanism\n- Developing a decryptor tool when a weakness in the ransomware's cryptographic implementation is identified\n- Classifying a ransomware sample by its encryption approach to attribute it to a known family\n\n**Do not use** for production data recovery operations without first verifying the decryption method on test copies of encrypted files.\n\n## Prerequisites\n\n- Ghidra or IDA Pro for reverse engineering the ransomware binary\n- Python 3.8+ with `pycryptodome` library for testing encryption\u002Fdecryption routines\n- Sample encrypted files and their corresponding plaintext originals (known-plaintext pairs)\n- Access to the ransomware binary (unpacked if applicable)\n- Familiarity with symmetric (AES, ChaCha20) and asymmetric (RSA) cryptographic algorithms\n- NoMoreRansom.org database for checking existing free decryptors\n\n## Workflow\n\n### Step 1: Identify the Encryption Algorithm\n\nDetermine which cryptographic algorithm the ransomware uses:\n\n```python\n# Check for Windows Crypto API usage in imports\nimport pefile\n\npe = pefile.PE(\"ransomware.exe\")\n\ncrypto_apis = {\n    \"CryptAcquireContextA\": \"Windows CryptoAPI\",\n    \"CryptAcquireContextW\": \"Windows CryptoAPI\",\n    \"CryptGenKey\": \"Windows CryptoAPI key generation\",\n    \"CryptEncrypt\": \"Windows CryptoAPI encryption\",\n    \"CryptImportKey\": \"Windows CryptoAPI key import\",\n    \"BCryptOpenAlgorithmProvider\": \"Windows CNG (modern crypto)\",\n    \"BCryptEncrypt\": \"Windows CNG encryption\",\n    \"BCryptGenerateKeyPair\": \"Windows CNG asymmetric key gen\",\n}\n\nprint(\"Crypto API Imports:\")\nfor entry in pe.DIRECTORY_ENTRY_IMPORT:\n    for imp in entry.imports:\n        if imp.name and imp.name.decode() in crypto_apis:\n            print(f\"  {entry.dll.decode()} -> {imp.name.decode()}: {crypto_apis[imp.name.decode()]}\")\n```\n\n```\nCommon Ransomware Encryption Schemes:\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\nAES-256-CBC + RSA-2048:    Most common hybrid scheme (LockBit, REvil, Conti)\nAES-256-CTR + RSA-4096:    Stream cipher mode variant (BlackCat\u002FALPHV)\nChaCha20 + RSA-4096:       Modern stream cipher (Hive, Royal)\nSalsa20 + ECDH:            Curve25519 key exchange (Babuk)\nAES-128-ECB:               Weak mode - potential decryption via known-plaintext\nXOR-only:                  Trivial encryption - always recoverable\nCustom algorithm:          Often contains implementation flaws\n```\n\n### Step 2: Analyze Key Generation and Management\n\nReverse engineer how encryption keys are generated and stored:\n\n```\nKey Management Patterns in Ransomware:\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n1. STRONG (no recovery possible without key):\n   - Per-file AES key generated with CryptGenRandom\n   - AES key encrypted with embedded RSA public key\n   - Encrypted key appended to each file or stored separately\n   - RSA private key held only by attacker's C2 server\n\n2. WEAK (potential recovery):\n   - AES key derived from predictable seed (timestamp, PID)\n   - Same AES key used for all files (single key compromise = full recovery)\n   - Key transmitted to C2 before encryption starts (PCAP may contain key)\n   - XOR with short repeating key (brute-forceable)\n   - PRNG seeded with GetTickCount or time() (limited keyspace)\n\n3. FLAWED IMPLEMENTATION:\n   - ECB mode (preserves plaintext patterns)\n   - Initialization vector (IV) reuse across files\n   - Key stored in plaintext in memory (recoverable from memory dump)\n   - Partial encryption (only first N bytes encrypted)\n```\n\n### Step 3: Examine File Encryption Routine\n\nReverse engineer the file processing logic:\n\n```c\n\u002F\u002F Typical ransomware file encryption flow (decompiled pseudo-code from Ghidra):\n\nvoid encrypt_file(char *filepath) {\n    \u002F\u002F 1. Check file extension against target list\n    if (!is_target_extension(filepath)) return;\n\n    \u002F\u002F 2. Generate per-file AES key (32 bytes for AES-256)\n    BYTE aes_key[32];\n    CryptGenRandom(hProv, 32, aes_key);\n\n    \u002F\u002F 3. Generate random IV (16 bytes)\n    BYTE iv[16];\n    CryptGenRandom(hProv, 16, iv);\n\n    \u002F\u002F 4. Read file contents\n    HANDLE hFile = CreateFile(filepath, GENERIC_READ, ...);\n    BYTE *plaintext = read_entire_file(hFile);\n\n    \u002F\u002F 5. Encrypt with AES-256-CBC\n    aes_cbc_encrypt(plaintext, file_size, aes_key, iv);\n\n    \u002F\u002F 6. Encrypt AES key with RSA public key\n    BYTE encrypted_key[256];  \u002F\u002F RSA-2048 output\n    rsa_encrypt(aes_key, 32, rsa_pubkey, encrypted_key);\n\n    \u002F\u002F 7. Write: encrypted_data + encrypted_key + IV to file\n    write_file(filepath, encrypted_data, encrypted_key, iv);\n\n    \u002F\u002F 8. Rename file with ransomware extension\n    rename_file(filepath, strcat(filepath, \".locked\"));\n}\n```\n\n### Step 4: Check for Cryptographic Weaknesses\n\nTest the implementation for exploitable flaws:\n\n```python\nfrom Crypto.Cipher import AES\nimport os\nimport struct\n\n# Test 1: Check if same key is used for multiple files\n# Compare encrypted versions of known files\ndef check_key_reuse(file1_enc, file2_enc):\n    with open(file1_enc, \"rb\") as f:\n        data1 = f.read()\n    with open(file2_enc, \"rb\") as f:\n        data2 = f.read()\n\n    # Extract IVs (location depends on ransomware family)\n    # If IVs are same and files share encrypted blocks -> same key\n    iv1 = data1[-16:]  # Example: IV at end\n    iv2 = data2[-16:]\n    if iv1 == iv2:\n        print(\"[!] Same IV detected - key reuse likely\")\n\n# Test 2: Check for predictable key derivation\n# If key is derived from timestamp, iterate possible values\ndef brute_force_timestamp_key(encrypted_file, known_header, timestamp_range):\n    with open(encrypted_file, \"rb\") as f:\n        encrypted_data = f.read()\n\n    for ts in timestamp_range:\n        # Derive key the same way ransomware does\n        import hashlib\n        key = hashlib.sha256(str(ts).encode()).digest()\n        iv = encrypted_data[-16:]\n        cipher = AES.new(key, AES.MODE_CBC, iv)\n        decrypted = cipher.decrypt(encrypted_data[:16])\n\n        if decrypted[:len(known_header)] == known_header:\n            print(f\"[!] Key found! Timestamp: {ts}\")\n            return key\n\n    return None\n\n# Test 3: Check for ECB mode (pattern preservation)\ndef check_ecb_mode(encrypted_file):\n    with open(encrypted_file, \"rb\") as f:\n        data = f.read()\n    # ECB produces identical ciphertext for identical plaintext blocks\n    blocks = [data[i:i+16] for i in range(0, len(data), 16)]\n    unique = len(set(blocks))\n    total = len(blocks)\n    if unique \u003C total * 0.95:\n        print(f\"[!] ECB mode likely: {total-unique} duplicate blocks out of {total}\")\n```\n\n### Step 5: Attempt Key Recovery\n\nUse identified weaknesses for key recovery:\n\n```python\n# Recovery Method 1: Extract key from memory dump\n# Volatility plugin to scan for AES key schedules\n# vol3 -f memory.dmp windows.yarascan --yara-rule \"aes_key_schedule\"\n\n# Recovery Method 2: Known-plaintext attack (weak algorithms)\ndef xor_key_recovery(encrypted_file, known_plaintext):\n    \"\"\"Recover XOR key from known plaintext-ciphertext pair\"\"\"\n    with open(encrypted_file, \"rb\") as f:\n        ciphertext = f.read()\n\n    key = bytes(c ^ p for c, p in zip(ciphertext, known_plaintext))\n    # Find repeating key length\n    for key_len in range(1, 256):\n        candidate = key[:key_len]\n        if all(key[i] == candidate[i % key_len] for i in range(min(len(key), key_len * 4))):\n            print(f\"XOR key (length {key_len}): {candidate.hex()}\")\n            return candidate\n    return None\n\n# Recovery Method 3: Check NoMoreRansom for existing decryptors\n# https:\u002F\u002Fwww.nomoreransom.org\u002Fen\u002Fdecryption-tools.html\n```\n\n### Step 6: Document Encryption Analysis\n\nCompile findings into a structured report:\n\n```\nAnalysis should document:\n- Algorithm identified (AES, RSA, ChaCha20, custom)\n- Key size and mode of operation (CBC, CTR, ECB, GCM)\n- Key generation method (CSPRNG, predictable seed, static key)\n- Key storage location (appended to file, registry, C2 transmission)\n- File modification pattern (full encryption, partial, header-only)\n- Targeted file extensions\n- Ransom note format and payment infrastructure\n- Decryption feasibility assessment (possible\u002Fimpossible\u002Fpartial)\n- Recommended recovery approach\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| **Hybrid Encryption** | Combining symmetric (AES) for fast file encryption with asymmetric (RSA) for secure key wrapping; the standard ransomware approach |\n| **Key Wrapping** | Encrypting the per-file symmetric key with the attacker's RSA public key so only the attacker's private key can decrypt it |\n| **ECB Mode** | Electronic Codebook mode encrypts each block independently; preserves patterns in plaintext, a critical weakness enabling partial recovery |\n| **Known-Plaintext Attack** | Using a known original file and its encrypted version to derive the encryption key; effective against XOR and weak stream ciphers |\n| **Key Schedule** | The expanded form of an AES key in memory; scannable in memory dumps to recover encryption keys before they are erased |\n| **CSPRNG** | Cryptographically Secure Pseudo-Random Number Generator; ransomware using CryptGenRandom produces unpredictable keys |\n| **Partial Encryption** | Some ransomware only encrypts the first N bytes or every Nth block for speed; unencrypted portions may aid recovery |\n\n## Tools & Systems\n\n- **Ghidra**: Reverse engineering suite for analyzing ransomware encryption routines at the assembly level\n- **PyCryptodome**: Python cryptographic library for implementing and testing decryption routines\n- **NoMoreRansom.org**: Free decryption tool repository maintained by Europol and security vendors for known ransomware families\n- **Volatility**: Memory forensics framework for extracting encryption keys from RAM dumps of infected systems\n- **CryptoTester**: Tool for identifying cryptographic algorithms based on constants and code patterns\n\n## Common Scenarios\n\n### Scenario: Assessing Decryption Feasibility for a Ransomware Incident\n\n**Context**: An organization is hit with ransomware encrypting file servers. Management needs to know if decryption is possible without paying the ransom before making a recovery decision.\n\n**Approach**:\n1. Identify the ransomware family from ransom note, file extension, and sample hash (check ID Ransomware)\n2. Check NoMoreRansom.org for existing free decryptors for this family\n3. Reverse engineer the encryption routine in Ghidra to identify the algorithm and key management\n4. Test for implementation weaknesses (key reuse, predictable seeds, ECB mode)\n5. Check if PCAP from the incident captured the key transmission to C2 (if key was sent before encryption)\n6. Scan memory dumps from affected machines for AES key schedules in RAM\n7. Report findings: decryption possible\u002Fimpossible with specific technical justification\n\n**Pitfalls**:\n- Testing decryption methods on the only copy of encrypted files (always work on copies)\n- Assuming all files use the same key without verifying (some ransomware uses per-file keys)\n- Not checking for volume shadow copies (vssadmin) which ransomware may have failed to delete\n- Confusing the file encryption algorithm with the key wrapping algorithm in reports\n\n## Output Format\n\n```\nRANSOMWARE ENCRYPTION ANALYSIS\n================================\nSample:           lockbit3.exe\nFamily:           LockBit 3.0 \u002F LockBit Black\nSHA-256:          abc123def456...\n\nENCRYPTION SCHEME\nFile Cipher:      AES-256-CTR (per-file unique key)\nKey Wrapping:     RSA-2048 (public key embedded in binary)\nKey Generation:   CryptGenRandom (CSPRNG - unpredictable)\nIV Generation:    Random 16 bytes per file\nFile Structure:   [encrypted_data][rsa_encrypted_key(256B)][iv(16B)][magic(8B)]\n\nTARGETED EXTENSIONS\nTotal:            412 extensions targeted\nCategories:       Documents (.doc, .xls, .pdf), Databases (.sql, .mdb),\n                  Archives (.zip, .7z), Source code (.py, .java, .cs)\nExcluded:         .exe, .dll, .sys, .lnk (system files preserved)\n\nIMPLEMENTATION ANALYSIS\nKey Strength:     STRONG - per-file random keys, no reuse\nMode Security:    STRONG - CTR mode with unique nonces\nKey Storage:      RSA-encrypted key appended to each file\nShadow Copies:    Deleted via vssadmin and WMI\n\nDECRYPTION FEASIBILITY\nWithout Key:      NOT POSSIBLE\n  - No implementation flaws identified\n  - RSA-2048 key wrapping prevents brute force\n  - CSPRNG prevents key prediction\n  - No existing free decryptor available\n\nRECOVERY OPTIONS\n1. Restore from offline backups (recommended)\n2. Check for volume shadow copies (low probability - ransomware deletes them)\n3. Memory forensics if machine was not rebooted (key may persist in RAM)\n4. Negotiate with attacker (last resort - no guarantee of decryption)\n```\n",{"name":5,"tags":24,"author":30,"domain":31,"license":14,"version":32,"mitre_f3":33,"nist_csf":50,"subdomain":55,"description":56,"mitre_attack":57},[25,26,27,28,29],"malware","ransomware","encryption","cryptanalysis","reverse-engineering","mahipal","cybersecurity","1.0.0",{"tactics":34,"version":37,"techniques":38},[35,36],"monetization","positioning","1.1",[39,43,46],{"id":40,"name":41,"source":42,"tactic":35},"F1018","Convert to Cryptocurrency","f3",{"id":44,"name":45,"source":42,"tactic":35},"F1047","Transfer of funds",{"id":47,"name":48,"source":49,"tactic":36},"T1219","Remote Access Tools","attack",[51,52,53,54],"DE.AE-02","RS.AN-03","ID.RA-01","DE.CM-01","malware-analysis","Analyzes encryption algorithms, key management, and file encryption routines used by ransomware families to assess decryption feasibility, identify implementation weaknesses, and support recovery efforts. Covers AES, RSA, ChaCha20, and hybrid encryption schemes. Activates for requests involving ransomware cryptanalysis, encryption analysis, key recovery assessment, or ransomware decryption feasibility.\n",[58,59,60,61],"T1486","T1573.001","T1573.002","T1027","main","1eb986d0b0ecc180291597e08eb5a58288843536","skills\u002Fcurated_premium_skills\u002FAnthropic-Cybersecurity-Skills\u002Fskills\u002Fanalyzing-ransomware-encryption-mechanisms","https:\u002F\u002Fgithub.com\u002Fvikasvardhanv\u002Fjerry_skills","https:\u002F\u002Fgithub.com\u002Fvikasvardhanv","2026-08-25 13:16:33",{"source":8,"skillName":5,"commands":69,"prompt":79,"zipAvailable":80},[70,73,76],{"tool":71,"command":72},"npx","npx skills add vikasvardhanv\u002Fjerry_skills --skill analyzing-ransomware-encryption-mechanisms",{"tool":74,"command":75},"bunx","bunx skills add vikasvardhanv\u002Fjerry_skills --skill analyzing-ransomware-encryption-mechanisms",{"tool":77,"command":78},"pnpm","pnpm dlx skills add vikasvardhanv\u002Fjerry_skills --skill analyzing-ransomware-encryption-mechanisms","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fvikasvardhanv\u002Fjerry_skills\u002Fblob\u002Fmain\u002Fskills\u002Fcurated_premium_skills\u002FAnthropic-Cybersecurity-Skills\u002Fskills\u002Fanalyzing-ransomware-encryption-mechanisms\u002FSKILL.md",true,[82,86,92],{"path":83,"resourceType":83,"resourceTypeDesc":84,"sizeBytes":85,"sourceHtmlUrl":15},"LICENSE","许可证",11255,{"path":87,"resourceType":88,"resourceTypeDesc":89,"sizeBytes":90,"sourceHtmlUrl":91},"references\u002Fapi-reference.md","REFERENCE","参考文档",4076,"https:\u002F\u002Fgithub.com\u002Fvikasvardhanv\u002Fjerry_skills\u002Fblob\u002Fmain\u002Fskills\u002Fcurated_premium_skills\u002FAnthropic-Cybersecurity-Skills\u002Fskills\u002Fanalyzing-ransomware-encryption-mechanisms\u002Freferences\u002Fapi-reference.md",{"path":93,"resourceType":94,"resourceTypeDesc":95,"sizeBytes":96,"sourceHtmlUrl":97},"scripts\u002Fagent.py","SCRIPT","脚本",13807,"https:\u002F\u002Fgithub.com\u002Fvikasvardhanv\u002Fjerry_skills\u002Fblob\u002Fmain\u002Fskills\u002Fcurated_premium_skills\u002FAnthropic-Cybersecurity-Skills\u002Fskills\u002Fanalyzing-ransomware-encryption-mechanisms\u002Fscripts\u002Fagent.py",[99,107,114,121,128,135],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":103,"licenseFileUrl":6,"sourceHtmlUrl":104,"categories":105,"keywords":106,"publishedAt":19},"01M7BESR1CJ3H5SP9XM8KYJZ9W","syllabus","Generates a curated supplementary reading list from any course syllabus using Consensus academic search. Grill-me intake (syllabus input format + course audience + year range) plus a grouping forcing-options checkpoint before any search runs — so the reading list matches the course's level and recency need. Parses the syllabus to extract topics and learning outcomes, searches Consensus for recent peer-reviewed papers per topic, and produces a professionally formatted .docx with clickable Consensus links, plain-language summaries calibrated to audience level, and Bloom-higher-order discussion questions tied to course learning goals. Use when the user uploads a syllabus, course outline, or curriculum document and wants supplementary readings (e.g., 'create a reading list from this syllabus', 'find recent papers for my course') — even casual mentions with a syllabus attached should trigger this skill.","MIT","https:\u002F\u002Fgithub.com\u002Fvikasvardhanv\u002Fjerry_skills\u002Fblob\u002Fmain\u002Fskills\u002Fresearch\u002Fsyllabus\u002Fskills\u002Fsyllabus\u002FSKILL.md",[],[],{"skillNo":108,"name":109,"nameZh":6,"description":110,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":103,"licenseFileUrl":6,"sourceHtmlUrl":111,"categories":112,"keywords":113,"publishedAt":19},"01M7BES1YA6R97W7QPMFFM1PED","pulse","Multi-source recency research skill that takes the pulse of any topic across Reddit, Hacker News, the open web, and optionally X\u002FTwitter within a configurable recent window (default 30 days). Forcing intake clarifies topic specificity, angle (trend\u002Fsentiment\u002Fproblems\u002Fopportunities\u002Fcomparison), time window, and platform scope before searching. Returns a synthesized briefing with citations, engagement metrics, and cross-platform pattern analysis. Use when the user requests multi-source recency intelligence on a topic (e.g., 'pulse on [topic]', 'what's happening with [topic]', 'what are people saying about [topic]', 'current conversation about [topic]', 'take the pulse of [topic]', 'trending: [topic]', 'find me info on [topic]'), and for competitor research, trend discovery, tool comparisons, and audience sentiment analysis.","https:\u002F\u002Fgithub.com\u002Fvikasvardhanv\u002Fjerry_skills\u002Fblob\u002Fmain\u002Fskills\u002Fresearch\u002Fpulse\u002Fskills\u002Fpulse\u002FSKILL.md",[],[],{"skillNo":115,"name":116,"nameZh":6,"description":117,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":103,"licenseFileUrl":6,"sourceHtmlUrl":118,"categories":119,"keywords":120,"publishedAt":19},"01M7BERNHYGY035AR00VRT03KE","patent","Patent prior-art and landscape intelligence skill — not generic patent help. Commits to one of five sub-use-cases via forcing intake (novelty search \u002F freedom-to-operate \u002F competitive landscape \u002F acquisition diligence \u002F litigation prior-art) before any search runs. Searches Google Patents, Espacenet, USPTO, and optionally Lens.org for citation-graph signals. Output is an editable Word document (.docx) with verdict, ranked closest art (claim-text extracted), CPC-class-aware landscape, family-resolved hits, geographic coverage, FTO flags where applicable, strategy recommendations, and full audit log. Use when the user asks for patent searching or analysis (e.g., 'prior art search for [invention]', 'freedom to operate analysis for [product]'). Produces search signal, not legal advice — always recommends consulting a patent attorney before filing or licensing decisions. Trademark, copyright, and trade-secret questions are out of scope.","https:\u002F\u002Fgithub.com\u002Fvikasvardhanv\u002Fjerry_skills\u002Fblob\u002Fmain\u002Fskills\u002Fresearch\u002Fpatent\u002Fskills\u002Fpatent\u002FSKILL.md",[],[],{"skillNo":122,"name":123,"nameZh":6,"description":124,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":103,"licenseFileUrl":6,"sourceHtmlUrl":125,"categories":126,"keywords":127,"publishedAt":19},"01M7BERCK1EAKTWW7R436WAR0J","notebooklm","Browser automation skill for controlling Google's NotebookLM. Use when the user wants anything done in NotebookLM (e.g., 'open NotebookLM', 'check my [name] notebook', 'ask my notebook about X', 'add [source] to NotebookLM', 'generate a Video Overview from my notebook', 'use NotebookLM Studio'). Handles reading and querying notebooks, adding sources (URLs, text, files, YouTube links, synthesized content), generating Studio outputs (Audio\u002FVideo Overviews, Mind Maps, Reports incl. Briefing Doc\u002FStudy Guide\u002FFAQ, Flashcards, Quiz, slide decks, infographics — discover the exact set from the live Studio panel; the UI evolves fast), and creating new notebooks. Requires browser automation environment — fails gracefully when unavailable.","https:\u002F\u002Fgithub.com\u002Fvikasvardhanv\u002Fjerry_skills\u002Fblob\u002Fmain\u002Fskills\u002Fresearch\u002Fnotebooklm\u002Fskills\u002Fnotebooklm\u002FSKILL.md",[],[],{"skillNo":129,"name":130,"nameZh":6,"description":131,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":103,"licenseFileUrl":6,"sourceHtmlUrl":132,"categories":133,"keywords":134,"publishedAt":19},"01M7BEQZAZAQRTXFJRY7RHV3TY","litreview","Academic literature orientation skill that searches papers via free keyless APIs (PubMed E-utilities + OpenAlex) by default — with the Consensus MCP as an optional enhancement lane when connected — builds a strategic search plan using PICO (default) or SPIDER \u002F Decomposition \u002F hybrid as fallbacks, and synthesizes findings into a formatted Word (.docx) research guide. Grill-me intake (research question specificity + framework hint + tentative depth) before the recon search; a second forcing checkpoint after Phase 2 confirms framework + sub-areas + depth before searches consume budget. Configurable depth (5\u002F10\u002F20 queries) controls coverage vs. speed. Output is a 'launching pad' — an orientation guide that lets a researcher dive in confidently, not a finished review. Use when the user starts literature-oriented research (e.g., 'litreview on [topic]', 'literature review on [topic]', 'I'm starting a literature review on X', 'I'm writing a paper on X', 'help me research X', 'I'm doing research on X', 'can you help me research X'). Do NOT use for single one-off paper searches wanting a quick list — that's a plain PubMed\u002FOpenAlex (or Consensus) query.","https:\u002F\u002Fgithub.com\u002Fvikasvardhanv\u002Fjerry_skills\u002Fblob\u002Fmain\u002Fskills\u002Fresearch\u002Flitreview\u002Fskills\u002Flitreview\u002FSKILL.md",[],[],{"skillNo":136,"name":137,"nameZh":6,"description":138,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":103,"licenseFileUrl":6,"sourceHtmlUrl":139,"categories":140,"keywords":141,"publishedAt":19},"01M7BEQKJ45K31QK5VRAQSVJCJ","grants","NIH grant research skill for clinical researchers. Grill-me intake (research idea + career stage + preliminary data + environment + submission posture + known institute targets) locks down the funding strategy before any search runs. Runs a 5-facet Consensus positioning analysis (with draft Significance\u002FInnovation language), maps the research to the right NIH institutes and study sections via RePORTER, finds NOSIs and funded overlap, and produces an editable Word document (.docx) with budget\u002Fscope-aware mechanism recommendations, submission timelines, and a mandatory program officer recommendation. Use when the user asks about research funding or makes any grant-related request (e.g., 'grants for [topic]', 'find grants for my research idea', 'what grants match my research', 'help me find NIH funding', 'grant opportunities for my research'). NIH-only scope — non-NIH funders (PCORI, DOD CDMRP, VA, foundations) are out of scope and flagged at intake.","https:\u002F\u002Fgithub.com\u002Fvikasvardhanv\u002Fjerry_skills\u002Fblob\u002Fmain\u002Fskills\u002Fresearch\u002Fgrants\u002Fskills\u002Fgrants\u002FSKILL.md",[],[]]