reverse-engineering-ransomware-encryption-routine
यह क्या करती है
यह टूल समझने में मदद करता है कि एक खास तरह का दुर्भावनापूर्ण प्रोग्राम (ransomware) आपकी फ़ाइलों को कैसे एन्क्रिप्ट करता है। यह उन गुप्त तरीकों का पता लगाने की कोशिश करता है जिनसे फ़ाइलें लॉक की जाती हैं, और देखता है कि क्या कोई कमज़ोरी है जिसका फायदा उठाकर बिना फिरौती दिए फ़ाइलें वापस खोली जा सकें।
कब इस्तेमाल करें
- ✓अधिकृत सुरक्षा टेस्टिंग करते समय।
- ✓सुरक्षित वातावरण में दुर्भावनापूर्ण प्रोग्राम का विश्लेषण करते समय।
- ✓कमज़ोरियाँ खोजने के लिए हमलों की नकल (simulate) करते समय।
Skill का लिंक
https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/reverse-engineering-ransomware-encryption-routine/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“इस प्रोग्राम का विश्लेषण करो और देखो कि यह फ़ाइलों को कैसे एन्क्रिप्ट करता है और क्या डेटा रिकवरी संभव है।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
यह टूल दुर्भावनापूर्ण प्रोग्राम के कोड की जांच करता है और ज्ञात encryption पैटर्न तथा संभावित गलतियाँ खोजता है। यह देखता है कि कौन से एन्क्रिप्शन फ़ंक्शन इस्तेमाल हुए हैं और keys कैसे बनती और सुरक्षित रखी जाती हैं।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Reverse Engineering Ransomware Encryption Routine
Overview
Modern ransomware uses hybrid encryption combining symmetric algorithms (AES-256-CBC/CTR, ChaCha20, Salsa20) for file encryption with asymmetric algorithms (RSA-2048/4096, Curve25519) for key protection. The encryption routine typically generates a random symmetric key per file, encrypts file contents, then encrypts the symmetric key with the attacker's embedded public key. Reverse engineering these routines identifies the specific algorithms, key derivation methods, initialization vectors, file targeting patterns, and potential implementation flaws that could enable decryption without paying the ransom. Notable examples include Rhysida (AES-256-CTR + RSA-4096), Qilin.B (AES-256-CTR with AES-NI or ChaCha20 fallback), and Medusa (AES-256 + RSA).
When to Use
- When performing authorized security testing that involves reverse engineering ransomware encryption routine
- When analyzing malware samples or attack artifacts in a controlled environment
- When conducting red team exercises or penetration testing engagements
- When building detection capabilities based on offensive technique understanding
Prerequisites
- IDA Pro or Ghidra for static disassembly
- x64dbg/WinDbg for dynamic debugging
- Python 3.9+ with
pycryptodome,pefile - Understanding of AES, RSA, ChaCha20, Curve25519 algorithms
- Knowledge of Windows CryptoAPI and CNG (BCrypt) functions
- Sandbox environment for safe execution
Key Concepts
Hybrid Encryption Model
Ransomware generates a unique AES key and IV for each file. The file content is encrypted with this symmetric key. The symmetric key is then encrypted with the attacker's RSA public key (embedded in the binary or fetched from C2). The encrypted key is appended or prepended to the encrypted file. Only the attacker holding the RSA private key can decrypt the per-file symmetric keys.
Cryptographic API Identification
Windows ransomware typically uses CryptoAPI (CryptAcquireContext, CryptGenKey, CryptEncrypt) or CNG (BCryptGenerateSymmetricKey, BCryptEncrypt). Some use OpenSSL or custom implementations. Identifying these API calls provides immediate insight into the algorithm, key size, and mode of operation.
Implementation Flaws
Decryption opportunities arise from: hardcoded encryption keys, weak PRNG for key generation (using GetTickCount or time() as seed), reuse of IVs across files, ECB mode usage, keys remaining in memory post-encryption, and race conditions where keys can be captured during encryption.
Workflow
Step 1: Identify Cryptographic Functions
#!/usr/bin/env python3
"""Identify cryptographic functions in ransomware PE files."""
import pefile
import sys
CRYPTO_APIS = {
# Windows CryptoAPI
"CryptAcquireContextA": "CryptoAPI context acquisition",
"CryptAcquireContextW": "CryptoAPI context acquisition",
"CryptGenKey": "Key generation",
"CryptDeriveKey": "Key derivation",
"CryptEncrypt": "Encryption operation",
"CryptDecrypt": "Decryption operation",
"CryptImportKey": "Key import (public key?)",
"CryptExportKey": "Key export",
"CryptGenRandom": "Random number generation",
"CryptCreateHash": "Hash creation",
"CryptHashData": "Hashing operation",
# Windows CNG (BCrypt)
"BCryptOpenAlgorithmProvider": "CNG algorithm initialization",
"BCryptGenerateSymmetricKey": "CNG symmetric key generation",
"BCryptEncrypt": "CNG encryption",
"BCryptDecrypt": "CNG decryption",
"BCryptGenerateKeyPair": "CNG key pair generation",
"BCryptImportKeyPair": "CNG key import",
# OpenSSL
"EVP_EncryptInit_ex": "OpenSSL encrypt init",
"EVP_EncryptUpdate": "OpenSSL encrypt update",
"EVP_EncryptFinal_ex": "OpenSSL encrypt final",
"RSA_public_encrypt": "OpenSSL RSA encryption",
"AES_set_encrypt_key": "OpenSSL AES key setup",
# File operations
"CreateFileW": "File open (target files)",
"ReadFile": "File read (before encryption)",
"WriteFile": "File write (after encryption)",
"FindFirstFileW": "File enumeration (targeting)",
"FindNextFileW": "File enumeration",
"MoveFileW": "File rename (extension change)",
"DeleteFileW": "File deletion (originals)",
}
AES_SBOX = bytes([
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5,
0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
])
CHACHA20_CONSTANT = b"expand 32-byte k"
def analyze_imports(filepath):
…
अक्सर पूछे जाने वाले सवाल
ransomware क्या है?
Ransomware एक तरह का दुर्भावनापूर्ण सॉफ़्टवेयर है जो आपकी फ़ाइलों या सिस्टम की पहुंच बंद कर देता है और उन्हें वापस देने के लिए भुगतान (फिरौती) मांगता है।
रिवर्स इंजीनियरिंग क्या है?
रिवर्स इंजीनियरिंग किसी चीज़ को खोलकर समझने की प्रक्रिया है कि वह कैसे काम करती है, आमतौर पर उसे दोबारा बनाने या उसकी कमियाँ खोजने के लिए।
क्या मैं इसका उपयोग करके हमले का शिकार होने पर अपनी फ़ाइलें वापस पा सकता हूँ?
यह टूल सुरक्षा विशेषज्ञों के लिए मैलवेयर के विश्लेषण हेतु है। इससे रिकवरी के तरीके मिल सकते हैं, लेकिन यह पीड़ितों के लिए कोई अपने-आप काम करने वाला हल नहीं है।
जानकारी
लेखक का मूल विवरण
Reverse engineer ransomware encryption routines to identify cryptographic algorithms, key generation flaws, and potential decryption opportunities using static and dynamic analysis.
लोकप्रियता
- GitHub स्टार
- 35k
- रैंकिंग में स्थान
- #8354
- लाइसेंस
- Apache-2.0
- अपडेट की गई
- 31/8/2026
कमेंट
- …
इस repository की और skills
abusing-dpapi-for-credential-access
35kआपके AI एजेंट को किसी खास काम के लिए तैयार instructions देता है, ताकि वह उसे बेहतर और तेज़ी से कर सके।
abusing-shadow-credentials-for-privesc
35kआपके AI एजेंट को साफ़ और अच्छी तरह से व्यवस्थित लिखना सिखाता है।
achieving-cmmc-level-2-compliance
35kयह आपके एजेंट को CMMC Level 2 compliance के लिए environment तैयार करने में मदद करता है। यह security requirements लागू करता है और ज़रूरी documentation संभालता है।
acquiring-disk-image-with-dd-and-dcfldd
35kआपके एजेंट को hard drives की exact copies बनाने में मदद करता है। जाँच के दौरान किसी भी जानकारी के खोने या बदलने से बचाने के लिए यह उपयोगी है।
मिलती-जुलती skills
reverse-engineer-anything
422kयह आपके एजेंट को REA टूल से शिप हुई ऐप्स और पैकेज को अंदर से समझने, वर्ज़न की तुलना करने या दोबारा बनाने में मदद करती है।
1password
394kयह आपके एजेंट को 1Password CLI सेट करने, साइन इन करने और सीक्रेट्स की वैल्यू चैट में छापे बिना उन्हें पढ़ने या इस्तेमाल करने में मदद करती है।
healthcheck
394kयह आपके एजेंट को उस कंप्यूटर या सर्वर का सुरक्षा ऑडिट करने देती है जिस पर OpenClaw चलता है, जिसमें SSH, firewall, अपडेट और बैकअप शामिल हैं, और फिर सुरक्षित सुधार सुझाती है।