Ransomware Encryption: The math, time and energy required to brute-force an encryption key
.
Encryption is the process of encoding a message or information (converting a plaintext message into ciphertext) which can be decoded back into the original message in such a way that only authorized parties can access it. An encryption algorithms along with a key is used in the encryption and decryption of data. There are several types of data encryptions and encryption schemes typically are based on block or stream ciphers.
- What Is Encryption, and How Does It Work?
- What is SSL Cryptography, Asymmetric Encryption, Symmetric Encryption
- What are encryption keys and how do they work?
- Types of Encryption Algorithms
- 5 Common Encryption Algorithms and the Unbreakables of the Future
- Encryption 101: How to break encryption
Whether you can recover (decrypt) your files or not depends on what ransomware infection you are dealing with, the type and strength of encryption used by the malware writers and a variety of other factors as explained here. All crypto malware ransomware use some form of encryption algorithms, most of which are secure and unbreakable. Thus, the possibility of decryption depends on the thoroughness of the malware creator, what algorithm the creator utilized for encryption, discovery of any flaws and sometimes just plain luck. Reverse engineering the malware itself does not guarantee experts will be able to crack it especially if there isn't a known flaw as noted here by Emsisoft's CTO, Fabian Wosar.
Malware developers typically use a public and private key system where the public key is used to encrypt and the private key is used to decrypt. The private key is stored on a central server maintained by the cyber-criminals ensuring it is much harder to break unless at some point, law enforcement authorities track down, arrest the criminals, seize the C2 server, find and release the private RSA decryption keys to the public. Cyber-criminals are not likely to continue using methods which can easily be cracked.
Brute-forcing a decryption key is not possible (not a feasible option) with current technology and quantum computers capable of running Shor's algorithm. This is due to how the keys are generated using complicated math operations, an infinite number of possibilities to try and the length of time required to break a private encryption key. Some ransomware (such as Conti) will use a unique AES-256 encryption key per file which is then encrypted with a bundled RSA-4096 public encryption key unique to each victim. Experts believe we are 20-30+ years away from using quantum computers to break encryption. The inability to self-correct errors by copying encoded data over and over has been a major barrier to scaling up technology with Quantum Computers.
- How secure is AES against brute force attacks?
- The Math Behind Cracking RSA with Shor’s Algorithm
- How Quantum Computers Break Encryption | Shor's Algorithm Explained
- Time and energy required to brute-force a AES-256 encryption key
- For AES-128 (or any secure 128-bit symmetric cipher for that matter), there are 2128 possible keys.
- How to estimate the time needed to crack RSA encryption?
- How long would it take to break a 1024 bit OpenPGP encrypted email?
Without the criminal's master private encryption key that can be used to decrypt your files, decryption is impossible. That usually means the key is unique (specific) for each victim and generated in a secure way (i.e. RSA, AES, Salsa20, ChaCha20, ECDH, ECC) that cannot be brute-forced...the public key alone that encrypted files is useless for decryption. In most cases, unless the keys are leaked or the criminals are arrested by the authorities and the keys are recovered, then provided to the public, there is no possibility that anyone can provide a decryption solution.
According to Emsisoft's CTO, Fabian Wosar some ransomware has been...
...reverse engineered to death by the entire malware research community. If a flaw existed that enabled the encryption to be broken, it would almost certainly have been discovered a long time ago. To break Dharma within any of our lifetimes without having discovered a flaw would require access to a quantum computer that is capable of running Shor's algorithm. The highest number ever factorized using said algorithm and quantum computers is 21, which is just short of the 307 digits that would be required to break Dharma."
According to Demonslay335 (Michael Gillespie), a trusted Security Colleague (Expert), a ransomware researcher/analyst with the MalwareHunterTeam (Post #1307)
AES-192 and AES-256 is more or less resilient to quantum computing. AES-128 is the only version that would "possibly" be broken by quantum computing.
According to rivitna (Andrey Zhdanov), a Malware analyst, reverse engineer, APT researcher and programmer (Post #11993)
...to decrypt one file, you need to brute the 112-bit number (2^112 possible combinations).
For comparison:
Phobos - 256-bit number (2^256 possible combinations)
LockBit - 512-bit number (2^512 possible combinations)
Dr.Web: Encryption ransomware - Threat No. 1
According to Doctor Web’s statistics, the probability of restoring corrupted files is roughly 1%...That means that most of user data has been lost for good!.
.
Decryption vs Data Recovery of Ransomware
Data Recovery is a process of salvaging (retrieving) inaccessible, lost, deleted, corrupted, damaged or formatted data as explained here. Since Windows NTFS file system saves the file description information, that makes it easier for recovery software to find these files using that information. Data recovery software uses complex algorithms that search for pieces (fragments) of recoverable information left on the hard drive in order to guess where the file was originally physically stored. The recovery program then attempts to put back together that information in a salvageable format. However, if the data has been overwritten, complete recovery cannot be guaranteed. Data recovery does not decrypt encrypted data.
- What Is Data Recovery And How Does It Work?
- How Does a Data Recovery Software Program Function?
- How Does Data Recovery Software Work
When dealing with ransomware, in some cases the use of file recovery software or JpegMedic ARWE may be helpful to recover (not decrypt) some of your original files but there is no guarantee that it will work. However, it never hurts to try in case the malware did not do what it was supposed to do. It is not uncommon for ransomware infections to sometimes fail to encrypt all data, fail to leave ransom notes, fail to delete all shadow copy snapshots, add an extension but fail to encrypt files or only execute partial encryption of large files especially if the encryption process was interrupted by the victim (i.e. shutting down the computer), encountered encryption glitches, involved shoddy malware programming code or was hindered by installed security software.
Some ransomware (STOP Djvu, LockFile, BlackCat (ALPHV), Qyick, Agenda, Black Basta, LockBit 2.0, DarkSide, BlackMatter, Ryuk, Nemty, Play) only partially encrypt a file (first so many KB's at the beginning and/or end especially if it is very large). This is deliberate in order to avoid detection and encrypt the data as quickly as possible (before anyone notices) so it does not actually read/write/encrypt the entirety of data.
- Ransomware Developers Turn to Intermittent (Partial) Encryption to Evade Detection
- Intermittent Encryption Analysis
- Ransomware gangs switching to new intermittent encryption tactic
Since only parts of the file may actually be encrypted, data recovery programs sometimes work to recover partial files with certain ransomware infections but do not work with those which overwrite data. With a few other types of ransomware, it is even possible to manually recover/reconstruct (file repair) certain file formats (i.e. .JPG and video files) since the malware only encrypts 150KB of the file as explained here by Demonslay335.
Unfortunately, partial (intermittent) encryption often results in file corruption and renders the encrypted data useless since the encryption is usually irreversible for these files...the encryption code overwrites part of the file with the encrypted data of another part and there is no way to restore the overwritten data.
- Partial Encryption can corrupt large files
- Ransomware can partially encrypt files and cause corruption
Although it never hurts to try this approach, in the end you still may have no choice but to backup/save your encrypted data as is and wait for a possible solution at a later time.
Important Note: Keep in mind that the more you use your computer after files are deleted, encrypted or corrupted the more difficult it will be for data recovery programs to recover any deleted, unencrypted and uncorrupted data. The less that is done with the hard drive between the time of the data loss and the attempted recovery, the more likely it is that some or all of the files can be successfully recovered. The more the hard drive with the lost data is used, the less chances of recovery because there is a greater risk that new data can be written to the drive, overwriting and destroying deleted files that could have otherwise been recovered. When you delete a file, its content physically remains intact on the media, but the occupied space becomes marked as free. The next file saved to the disk may overwrite the contents of the deleted file. Therefore, the sooner that data recovery is attempted after a loss the greater the possibility that data can be successfully recovered. It is also very important to make sure that no application (including the recovery program) writes to the drive or partition where the deleted file is located since every new file may overwrite the deleted file.
The chances of success also will be greater if the drive is not defragmented and that you install and use a data recovery program on a drive other than the drive you want to recover files from (i.e. second hard drive, separate partition or USB flash drive) otherwise it could overwrite recoverable files. You could also "slave" the original hard drive and install the software on the new drive.
Data Recovery Tools
- 20 Best Free Data Recovery Software Tools
- 27 Best Free Data Recovery Software For Windows
- Free Data Recovery Software
- 10 Best Free Data Recovery Software [2021 Edition]
.
Updated: 02/20/24