decipher
Ransomware decryption PoC
Proof of concept that recovers files encrypted by ransomware from a memory dump.

- Fields
- Interests
- Language
- Year
- 2024 · last push 2024-12-02
- GitHub
- 0 (2026-11-07)
README
Straight from the project’s GitHub repository. (2026-11-07) · GitHub
Deciphering Ransomware - Analysis and working PoC
ToC
Introduction
- To see the analytical research part of the project check the
reportfolder:- Analysis (
analysis.md) - Markdown Slides in English and Slovak (
slides_en.md,slides_sk.md)
- Analysis (
- To get the idea of how the code in
srcfunctions (used to capture key from memory and decipher files) see these sections below:- Included Modules (
modules) - RSA Functions (
src/_rsa) - Main Functions (
src/main) - Main Procedure (How we obtain the private key)
- Included Modules (
Note: Biggest hurdle is that this only works up to Windows 7 (Windows Server 2008) and therefore DOESN'T include today's most popular Windows 10 and Windows 11 compatibility. Currently only WannaCry is supported.
Dependencies
In order for the code to work you will need to get the OpenSSL toolkit libraries installed. A copy of openssl alongside a working Visual Studio solution is provided in the wanakiwi repository (https://github.com/gentilkiwi/wanakiwi/), I purposefully left them out (plan to add a downloader or detect existing OpenSSL install). Other modules are included.
Included Modules (module_*)
All of these are included in the modules and used:
- File: Exists, Write, Read, Find
- Memory: Open, Copy, ReverseBytes
- MiniDump: Open, Close, RVAtoPTR, Stream, Copy
- String: ArgsByName
- Process: ProcInfo, PIDforName, MemInfo, NTQuerySysInfo
- Output: Echo
RSA Functions (_rsa)
- QuickImport
- ToPrivateKeyBlob
- PubKeyBlobToRSA
- PubKeyFileToNewPubKeyEN
- SimpleModuleCryptoHKEY
- InitDefaultKey
- FreeDefaultKey
- DecryptFileWithKey
- NormalizedEntropy
Main Functions
- wmain
- findProcess
- memoryAnalysis
- fileCallbackPublicKey
- fileCallbackWannaCry
- echoBigNum
- checkValidArchitecture
- regDeletePendingFileRenameOps
Main Procedure
Entire procedure is in the wmain function; see the following comments in main.c:
- Handle args e.g. private/public key on input
- Start working from public key if we didn't get private key on input
- Process memory or minidump
- Entropy
- Try to get private key from memory
- Start working with private key
License
See LICENSE file. This project began as a rewrite of memory dump and private key recovery procedures from wanakiwi for a more generic approach, which is intended to include future ransomware behavior.


