abusing-dpapi-for-cred…
Extract and decrypt Windows DPAPI-protected secrets (Credential Manager, browser logins/cookies, Wi-Fi credentials, KeePass keys)…
Analyzes encryption algorithms, key management, and file encryption
Claude Code
$ npx -y skills add mukul975/Anthropic-Cybersecurity-Skills --skill analyzing-ransomware-encryption-mechanisms --agent claude-code
Codex
$ npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill analyzing-ransomware-encryption-mechanisms -a codex -y
Cursor
$ npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill analyzing-ransomware-encryption-mechanisms -a cursor -y
Gemini CLI
$ npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill analyzing-ransomware-encryption-mechanisms -a gemini-cli -y
GitHub Copilot
$ npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill analyzing-ransomware-encryption-mechanisms -a github-copilot -y
OpenCode
$ npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill analyzing-ransomware-encryption-mechanisms -a opencode -y
Windsurf
$ npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill analyzing-ransomware-encryption-mechanisms -a windsurf -y
name: analyzing-ransomware-encryption-mechanisms
description: '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.
'
domain: cybersecurity
subdomain: malware-analysis
tags:
- malware
- ransomware
- encryption
- cryptanalysis
- reverse-engineering
version: 1.0.0
author: mahipal
license: Apache-2.0
nist_csf:
- DE.AE-02
- RS.AN-03
- ID.RA-01
- DE.CM-01
mitre_attack:
- T1486
- T1573.001
- T1573.002
- T1027
mitre_f3:
version: '1.1'
tactics:
- monetization
- positioning
techniques:
- id: F1018
name: Convert to Cryptocurrency
tactic: monetization
source: f3
- id: F1047
name: Transfer of funds
tactic: monetization
source: f3
- id: T1219
name: Remote Access Tools
tactic: positioning
source: attack**Do not use** for production data recovery operations without first verifying the decryption method on test copies of encrypted files.
Determine which cryptographic algorithm the ransomware uses:
# Check for Windows Crypto API usage in imports
import pefile
pe = pefile.PE("ransomware.exe")
crypto_apis = {
"CryptAcquireContextA": "Windows CryptoAPI",
"CryptAcquireContextW": "Windows CryptoAPI",
"CryptGenKey": "Windows CryptoAPI key generation",
"CryptEncrypt": "Windows CryptoAPI encryption",
"CryptImportKey": "Windows CryptoAPI key import",
"BCryptOpenAlgorithmProvider": "Windows CNG (modern crypto)",
"BCryptEncrypt": "Windows CNG encryption",
"BCryptGenerateKeyPair": "Windows CNG asymmetric key gen",
}
print("Crypto API Imports:")
for entry in pe.DIRECTORY_ENTRY_IMPORT:
for imp in entry.imports:
if imp.name and imp.name.decode() in crypto_apis:
print(f" {entry.dll.decode()} -> {imp.name.decode()}: {crypto_apis[imp.name.decode()]}")Common Ransomware Encryption Schemes: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ AES-256-CBC + RSA-2048: Most common hybrid scheme (LockBit, REvil, Conti) AES-256-CTR + RSA-4096: Stream cipher mode variant (BlackCat/ALPHV) ChaCha20 + RSA-4096: Modern stream cipher (Hive, Royal) Salsa20 + ECDH: Curve25519 key exchange (Babuk) AES-128-ECB: Weak mode - potential decryption via known-plaintext XOR-only: Trivial encryption - always recoverable Custom algorithm: Often contains implementation flaws
Reverse engineer how encryption keys are generated and stored:
Key Management Patterns in Ransomware: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1. STRONG (no recovery possible without key): - Per-file AES key generated with CryptGenRandom - AES key encrypted with embedded RSA public key - Encrypted key appended to each file or stored separately - RSA private key held only by attacker's C2 server 2. WEAK (potential recovery): - AES key derived from predictable seed (timestamp, PID) - Same AES key used for all files (single key compromise = full recovery) - Key transmitted to C2 before encryption starts (PCAP may contain key) - XOR with short repeating key (brute-forceable) - PRNG seeded with GetTickCount or time() (limited keyspace) 3. FLAWED IMPLEMENTATION: - ECB mode (preserves plaintext patterns) - Initialization vector (IV) reuse across files - Key stored in plaintext in memory (recoverable from memory dump) - Partial encryption (only first N bytes encrypted)
Reverse engineer the file processing logic:
// Typical ransomware file encryption flow (decompiled pseudo-code from Ghidra):
void encrypt_file(char *filepath) {
// 1. Check file extension against target list
if (!is_target_extension(filepath)) return;
// 2. Generate per-file AES key (32 bytes for AES-256)
BYTE aes_key[32];
CryptGenRandom(hProv, 32, aes_key);
// 3. Generate random IV (16 bytes)
BYTE iv[16];
CryptGenRandom(hProv, 16, iv);
// 4. Read file contents
HANDLE hFile = CreateFile(filepath, GENERIC_READ, ...);
BYTE *plaintext = read_entire_file(hFile);
// 5. Encrypt with AES-256-CBC
aes_cbc_encrypt(plaintext, file_size, aes_key, iv);
// 6. Encrypt AES key with RSA public key
BYTE encrypted_key[256]; // RSA-2048 output
rsa_encrypt(aes_key, 32, rsa_pubkey, encrypted_key);
// 7. Write: encrypted_data + encrypted_key + IV to file
write_file(filepath, encrypted_data, encrypted_key, iv);
// 8. Rename file with ransomware extension817 structured cybersecurity skills for AI agents · Mapped to 6 frameworks: MITRE ATT&CK, NIST CSF 2.0, MITRE ATLAS, D3FEND, NIST AI RMF & MITRE F3 (Fight Fraud) · agentskills.io standard · Works with Claude Code, GitHub Copilot, Codex CLI, Cursor, Gemini CLI & 20+ platforms · 29 security domains · Apache 2.0
Extract and decrypt Windows DPAPI-protected secrets (Credential Manager, browser logins/cookies, Wi-Fi credentials, KeePass keys)…
Take over Active Directory accounts by writing attacker-controlled public keys to msDS-KeyCredentialLink (Shadow Credentials)…
Prepare a defense-contractor environment for CMMC Level 2 certification: scope CUI and FCI, implement the 110 NIST SP 800-171 Rev…
Create forensically sound bit-for-bit disk images with dd or dcfldd on a Linux forensic workstation, preserving evidence…
Detect dangerous ACL misconfigurations in Active Directory using ldap3
Perform static analysis of Android APK malware using apktool for resource decompilation, jadx for Java source recovery, and…
Use for authorized security assessment of REST, GraphQL, WebSocket, or SOAP APIs, including discovery, authentication,…
Clean and finalize authorized natural-language text intended for readers by auditing suspicious invisible Unicode and rewriting…
Vercel AI SDK patterns for the installed major (ui/package.json: `ai` 6.x, `@ai-sdk/react` 3.x). The skill name is historical;…