-
Notifications
You must be signed in to change notification settings - Fork 10
Problem with the UEFI Bootloader #4
Comments
Hi, It seems like I haven't handled the case where the function that parses the first record of the $MFT returns an empty list. Could you tell me a bit more about your VM specification ? Do you have Bitlocker activated ? Because that's a scenario I've never tested. EDIT: By reading my code again I found out that the only scenario where |
I saw that your code always assumes that 1 cluster is 8 sectors but this might not be the case everywhere as NotPetya kernel reads SectorsPerCluster field from NTFS Boot Sector and uses it to calculate MFT Starting Position. Also I think this might be helpful for you: https://shasaurabh.blogspot.com/2017/07/technical-analysis-notpetypetya-mbr.html |
You're right, I'm aware that the size of cluster isn't of 8 sectors but I coded it that way because I wanted to do it fast.
That's cool feature I didn't know about, I may implement that later but it's gonna be to much trouble for me to do it before the deliverable of my school project.
What a shame I didn't encounter that article before, It's a gold mine of information. Thanks again ! |
Could you make your UEFI bootloader encrypt the MFT the same way that NotPetya does and display number of MFT sectors during encryption? |
I can myself adding that feature without too much trouble. |
@sven-eliasen NotPetya determines the total number of MFT Sectors by reading the first MFT Record which belongs to $MFT itself and from this record with 0x80 attribute determines the total number of sectors to be encrypted and the absolute sector from which to start and skips the first 32 MFT sectors. |
Didn't know about that, what's the benefits of skipping the first 32 MFT sectors ? If that's about encryption time it's pretty worthless. |
It seems that the first 32 MFT Sectors store information about system files and when you said the first 16 MFT records, because one MFT Record is 1024 bytes(2 sectors) and one sector is 512 bytes 32 / 2 = 16 MFT Records , and notpetya kernel skips it, while Red Petya kernel encrypts full MFT but skips first 2 MFT sectors, also how does your ransomware knows if entered key is correct or not? Also how can I contact you if possible? |
@sven-eliasen I have tried your improved ntfs.rs on my VM and it shows this: https://imgur.com/a/gFrSRQX |
I didn't have time to test it, I just pushed the branch to save it.
You can find my email address on my Github profile where I'll be pleased to answer your questions. |
@sven-eliasen Thanks, also btw could you tell me how does your NotPetyaAgain knows if the key entered by the user is correct or not? |
After the key generation process, the program writes in the EFI variable "NotPetyaAgainProof" a static string encrypted with the newly generated key. In the ransom note prompt, the input is taken as a key and is decrypting what's inside the EFI variable, if the result is not equal to the static string than it's not the right key. In the code, the static string is "slava ukraini " but it could be anything. |
@sven-eliasen okay thanks, btw did you know that original Petya 2016 used secp192k1 curve? |
Hi, So I tried to work back on this yesterday but I went into to much trouble. And frankly I forgot I much it was a pain in the a** to debug a UEFI bootloader. I tried to fix this in the other branch but there seems to be a problem getting the right ranges of the $MFT. I don't want to put any more efforts and I'm closing this issue as well as I'm archiving this repos because I won't work on this project anymore. |
Building the UEFI BootLoader works but after I put it in the EFI System Partition and vm boots the following problem appears: https://imgur.com/a/gU76nxP and after this occurs, the VM shutdowns automatically.
Could you explain me why this problem occurs?
The text was updated successfully, but these errors were encountered: