Reversing WannaCry Part 3 - The encryption component

  Рет қаралды 115,118

stacksmashing

stacksmashing

4 жыл бұрын

In this video we take a quick look at the encryption component of WannaCry! We also check out how the 'decrypt' functionality of the WannaDecryptor probably is implemented.
Playlist: • Reversing WannaCry Par...
- Part 1: • Reversing WannaCry Par...
- Part 2: • Reversing WannaCry Par...
The scripts and Ghidra projects can be found here: github.com/ghidraninja/Revers...
Twitter: / ghidraninja

Пікірлер: 124
@JohnnyUtah488
@JohnnyUtah488 3 жыл бұрын
Good to know WannaCry cleans up its temporary files. There's nothing worse than ransomware that doesn't clean up after itself!
@davecool42
@davecool42 4 жыл бұрын
As mostly a regular guy, with a bit of programming knowledge... I don’t know why, but I had assumed that the core of the malware would be far less refined than it is. There are checks for things I wouldn’t have considered. It’s like they wanted to make sure they didn’t actually hurt your data... you know... as long as you paid them, I mean.
@billigerfusel
@billigerfusel 4 жыл бұрын
You can't display the ransom messages on a machine that doesn't boot anymore.
@Zekrom569
@Zekrom569 4 жыл бұрын
Well, there are rumors that this ransomware was brought by the North Korea, so i guess if it is true, they would want to get some money and "terrorize the western civillization", but they would not want to get a warhead launched to their territory....
@dieSpinnt
@dieSpinnt 4 жыл бұрын
@@Zekrom569 No, I'm sure you're behind it! Of course, I only say that, so that you notice how damn stupid accusations are without evidence. Of course I have nothing against stupid chatter / a good joke. Keep going. Well it is a business. A fishy business, but it is a business. So they likely have a quality assurance department. But there is nothing special or any knowledge that otherwise should be good practice in the industry. That a budget gets cut and the code quality suffers from it is an old hat. The only thing you can learn from malware authors is that you later have a lot of time in prison to deepen your research. In my opinion, the artistic or interesting examples come from game programmers, anti-piracy measures or the elegant solution of mathematical problems on limited hardware.
@JustWasted3HoursHere
@JustWasted3HoursHere 4 жыл бұрын
@@dieSpinnt www.zdnet.com/article/how-us-authorities-tracked-down-the-north-korean-hacker-behind-wannacry/
@jdeleca
@jdeleca 4 жыл бұрын
@JustWasted3HoursHere There a big possibility that the korean created the virus, because they just wanted 300$, if it was other they would have asked thousands, and if you check the btc addresses it's still receiving btc transactions Also I remember you from the flattards videos, I stopped watching FE videos since beginning of last year and is the best thing
@pcsecuritychannel
@pcsecuritychannel 4 жыл бұрын
Great to see more RE content on KZfaq. Keep it up.
@GigantTech
@GigantTech 2 жыл бұрын
Oh hi
@abnormTrueCrime
@abnormTrueCrime 3 жыл бұрын
I can barely make a basic calculator in Python, but for some reason I watched this whole C++ RE video lol. I always found Malware fascinating, and seeing this being taken apart is really cool. Thank you!
@BlackHermit
@BlackHermit 3 жыл бұрын
Finally made it to the end, after so many months. Thanks a lot for this series!
@xtdycxtfuv9353
@xtdycxtfuv9353 4 жыл бұрын
you are an inspiration dude. I've always wanted to try software reverse engineering
@redpillcommando
@redpillcommando 4 жыл бұрын
Thank you for posting this. I had all but given up hope.
@ywanhk9895
@ywanhk9895 4 жыл бұрын
OMG i am waiting for this for sooooooooooooo long !!!!
@user-xn1oh6yo5t
@user-xn1oh6yo5t 4 жыл бұрын
That was great. In the final part, you need to write a program that decrypts files :DDD
@SuryaTejaKarra
@SuryaTejaKarra 4 жыл бұрын
yes please do write a program to decrypt wannacry encrypted files!!
@randomhumanbeing591
@randomhumanbeing591 4 жыл бұрын
@@SuryaTejaKarra wannacry uses aes and rsa to encrypt the files i dont think you will have any hope getting them back
@h3xad3cimaldev61
@h3xad3cimaldev61 3 жыл бұрын
It's most likely not possible unless you read the memory and find the key and used their same algorithm
@h3xad3cimaldev61
@h3xad3cimaldev61 3 жыл бұрын
@@KeijonAutoVuokra oh nice! What's it called?
@ludvigericson6930
@ludvigericson6930 4 ай бұрын
It’s not possible to recover. The private key is generated per machine and then encrypted with a public key, so to get the key back you need the attacker’s private key.
@filipposconstantinou799
@filipposconstantinou799 4 жыл бұрын
Great vid, I wondering with which program do you make the orchards and the step by step graphs of the malware? I could use something similar for my cases too. Also you are one of the few people which I have seen to cleanly organise the decompiled code than just slapping post it notes next to it, kudos for that.
@right_jehoon
@right_jehoon 4 жыл бұрын
Finally video! Thanks
@StarDust270
@StarDust270 3 жыл бұрын
Make part 4 please, I've been waiting!
@konstantinrebrov675
@konstantinrebrov675 4 жыл бұрын
Can you make a video as a guide to Ghidra IDE? A comprehensive tour of overview of all it's features and how to use them on a code sample. Ghidra has a lot of buttons, bells, and whistles, and I don't know what any of them do. So a tutorial about finding your way around the IDE would be great.
@notpetya
@notpetya 2 жыл бұрын
would you ever do a part 4 looking at the decryptor and mainly how the C2 protocol works? I've never seen anyone talk about it, only the worm and the encryptor mainly.
@yannickdhondt7757
@yannickdhondt7757 3 жыл бұрын
Quality content, thank you.
@hydejel3647
@hydejel3647 4 жыл бұрын
Great Video! :D
@SausyGuyFinn
@SausyGuyFinn 4 жыл бұрын
The only thing that makes me wanna cry is the light theme
@pasy
@pasy 4 жыл бұрын
Awesome video, respect!! How about RE of Petya/MEMZ/CEREBO?
@LiEnby
@LiEnby 4 жыл бұрын
What does it do if the rand() doesnt execute >10 times? Either by not enough files or just by chance? It also doesn't seem to count to 10. So maybe more than 10 are acturally decryptable ^^
@chidiobum6053
@chidiobum6053 4 жыл бұрын
Nice one!
@P-G-77
@P-G-77 Жыл бұрын
Thanks, good job.
@GoWokeGoBroke1
@GoWokeGoBroke1 4 жыл бұрын
Thanks!
@xxMrPHDxx
@xxMrPHDxx 4 жыл бұрын
Finally!!!!
@roccoranallo4027
@roccoranallo4027 2 жыл бұрын
Dude you are good, I am trying to get as good as you.
@mayuna_
@mayuna_ 4 жыл бұрын
finally!
@Euroliite
@Euroliite 4 жыл бұрын
When decrypting the 10 files, how does it differentiate between the embedded key encryption and the regular encryption. I assume it looks at headers. How would it find those 10 files out of all files? Does it do a search of all drives for those files?
@Demonslay335
@Demonslay335 4 жыл бұрын
They can do that a few ways. They can simply keep a list around of those files, mark it in the header, or, RSA also has the property where the padding check will fail when decrypted with the wrong key - so you can just blindly try your private key, and if it fails, you have a way of knowing and aborting. I haven't RE'd this ransomware, but just assuming what could be done based on how many other ransomware do it.
@cubedable
@cubedable 4 жыл бұрын
So the reason for including the embedded RSA key is to facilitate the partial decryption while allowing them to use the same encryption method, just by switching the key? Because it looks to me that using it to just obfuscate a bunch of wannacry files (as seen in 1 of previous parts) is a bit of an overkill.
@FracturedPixels
@FracturedPixels 3 жыл бұрын
It could literally just be to obfuscate a bunch of wannacry files. Perhaps they considered those files in particular to be the weak point of the program, and put extra care into encrypting them; just to avoid the chances of it being possible to correctly guess the obfuscation method.
@unbalancedbinarytree2194
@unbalancedbinarytree2194 4 жыл бұрын
You are my Netflix
@flymetothemoon297
@flymetothemoon297 3 жыл бұрын
i really love this video how you reverse this thing btw can you reverse bonzi buddy too?
@logiciananimal
@logiciananimal 3 жыл бұрын
On the set array to all zero that Ghidra doesn't understand: maybe - function inlining?
@h0x91B
@h0x91B 4 жыл бұрын
Why you are not using ENUMs for all of those `filetypes` code becomes much more readable..?
@metekaanaktay
@metekaanaktay 4 жыл бұрын
thx
@AdamBast
@AdamBast 3 жыл бұрын
:( i was hoping that this was going somewhere... what happens if the countdown expires? Is there a way to decrypt without paying? Who do the bitcoin addresses belong to?
@ManMartin
@ManMartin 3 жыл бұрын
So, is It possible to write a code to unencript all the files?
@crystalsheep1434
@crystalsheep1434 Жыл бұрын
Are you still planning to do a part 4
@kicknotes
@kicknotes Жыл бұрын
Great series. I almost feel bad for writing Wannacry now. Almost.
@OPFGBCUVBBCBCG
@OPFGBCUVBBCBCG 4 жыл бұрын
place this into playlists as well
@stacksmashing
@stacksmashing 4 жыл бұрын
Completely forgot, thanks!
@minicrazy4129
@minicrazy4129 4 жыл бұрын
is Wannacry still available?
@Korybagel
@Korybagel 4 жыл бұрын
yes
@fideriajeseline
@fideriajeseline 3 жыл бұрын
can you disassemble the ex4_to_mq4 decompiler :)
@crystalsheep1434
@crystalsheep1434 Жыл бұрын
So the files that you will be able to decrypt for free is disided at the time of encryption interesting
@colinliew1400
@colinliew1400 4 жыл бұрын
part4!!!! I want to see a key decrypt generator
@neloangelo__13
@neloangelo__13 4 жыл бұрын
Can you please do a series on NotPetya please? :D :D
@manstie
@manstie 4 жыл бұрын
Would you be able to do something like reverse engineer and patch the Decryptor .exe and make it so that the decrypt button decrypts everything? (without a payment)
@user-cs5rg1ny8l
@user-cs5rg1ny8l 4 жыл бұрын
Dude, I have a question I have a Set top box and to get into it. Currently the channels limited in it is managed at the box. I want to edit it. Other channel which i have not paid for should be accessible, when I move over the channels, a small piece of the programm just flashes
@redpillcommando
@redpillcommando 4 жыл бұрын
Does anyone know where I can find the wannacry binary. I would like to play along at home. Yes I know this is really bad software but I have an air gaped computer with virtualbox installed on it for just this kind of experimentation.
@stacksmashing
@stacksmashing 4 жыл бұрын
It’s linked in the description of part 1!
@redpillcommando
@redpillcommando 4 жыл бұрын
@@stacksmashing Oops, sorry, I already found it on my own. Thank you for the quick response and thank you for the video.
@stacksmashing
@stacksmashing 4 жыл бұрын
No worries, glad you like it!
@EMAGamers
@EMAGamers 3 жыл бұрын
Could you reverse the musallat.exe virus for the next serie?
@ipmshik
@ipmshik 8 ай бұрын
amazing but where is part4?
@wChris_
@wChris_ 4 жыл бұрын
so you actually can decrypt your files, if you paid them and this 10 file demo isn't some baiting tactic, to make you pay?
@Ma_X64
@Ma_X64 4 жыл бұрын
Just someone who loves what he doing.
@alexkart9239
@alexkart9239 4 жыл бұрын
Yeah. Years ago, one businessman ask me to convert couple of bucks to BTC. He paid to terrorist, and get all files back.
@kevinwydler4405
@kevinwydler4405 4 жыл бұрын
No, it's just a bait (as far as I understand it). These 10 files (possibly more) are encrypted with a known private key, so you can decrypt them. But for all other files, the seed is random and there is no functionality to keep track of these random seeds. Please correct me if I misunderstood this though!
@GoatyGoY
@GoatyGoY 4 жыл бұрын
@@kevinwydler4405 From my understanding of the previous video, the main encryption key pair is generated uniquely to each machine the first time it runs, and the private key (required to decrypt) is then encrypted with a fixed (public) key embedded by the ransomer. Theoretically, the ransomer could take the encrypted private key, decrypt it with their own key, and supply it back to the victim, thus allowing for the decryption of the files.
@GoatyGoY
@GoatyGoY 4 жыл бұрын
Interestingly (again, to my understanding and I’d love to be corrected with precise details!) a bug/exploit in windows’ implementation of the encryption meant that if you didn’t restart your computer after this was done, there was a chance that the (unencrypted) private key was still somewhere in memory, and thus with the right tools, in some cases it was possible to recover this and hence reverse the effects of the malicious encryption without paying the ransomer.
@ldohlj1
@ldohlj1 3 жыл бұрын
8:40 , can't we use this knowledge in order to put some very important files inside these folders to protect them against ransomware?
@ivanheinzer6829
@ivanheinzer6829 3 жыл бұрын
If all ransomeware work the same 😅🤷‍♂️ But I think it would not be a bad approch because the system needs files to run. If you place them between those the ransomeware first needs a logic to decide which are essential and which aren't
@ldohlj1
@ldohlj1 3 жыл бұрын
​@@ivanheinzer6829 I thought more about it, and I think it would be a nice idea to make your device give off "Virtual Machine" vibes while it's actually not, so malwares get spooked and stop running. (I actually don't know how you can fake being a virtual machine though)
@saeedmahmoodi7211
@saeedmahmoodi7211 3 жыл бұрын
where is private key?
@hoppy7375
@hoppy7375 4 жыл бұрын
Part 4 ?
@slendi9623
@slendi9623 4 жыл бұрын
Hell ye
@Carpediemefsane
@Carpediemefsane 2 жыл бұрын
How much time do I need to be in this knowledge level
@IcedDoubleYT
@IcedDoubleYT Ай бұрын
Did you attain this knowledge level yet
@daniweb90
@daniweb90 4 жыл бұрын
Now, does it mean it is possible to decrypt after you've paid the money or does it mean it isn't?
@project-bl2zz
@project-bl2zz 4 жыл бұрын
the change in your voice from 10:25 -> 10:26 is incredibly unnerving
@stacksmashing
@stacksmashing 4 жыл бұрын
Yea it was recorded on the next day, had some issues with a cold and had to stop - sorry about that :)
@project-bl2zz
@project-bl2zz 4 жыл бұрын
@@stacksmashing oh no worries, I figured it was something like that. Great content as always!
@KenSherman
@KenSherman Жыл бұрын
We didn't have to wait almost a year for another vid. Blame that on another type of r-ware - a biological one ☣ - Covid.
@MatheusCatarino
@MatheusCatarino 4 жыл бұрын
It would be interesting if you allow subtitles (human) for better understanding.
@stacksmashing
@stacksmashing 4 жыл бұрын
Yea unfortunately that’s a lot of work - have to look into it
@MatheusCatarino
@MatheusCatarino 4 жыл бұрын
@@stacksmashing, If you can release the option to add subtitles, if any subscribers are interested in doing so would be very helpful.
@stacksmashing
@stacksmashing 4 жыл бұрын
Ah i didn’t even know that’s possible! :) let me check that
@goldiemusic8394
@goldiemusic8394 Жыл бұрын
did not understand shit. I will just grab these videos, and go back in time in 2017. I will be so rich.
@scienceandmatter8739
@scienceandmatter8739 3 жыл бұрын
Hallo Thomas. Did i read it right? Grüße aus stuttgart
@Gameplayer55055
@Gameplayer55055 3 жыл бұрын
Why decompiled c++ is so dirty? Especially std::string I decompiled my own simple program and i can't understand c++ types here. But C is fine for decompiling, everything is understandable
@user-ir2fu4cx6p
@user-ir2fu4cx6p 3 жыл бұрын
OOP
@Gameplayer55055
@Gameplayer55055 3 жыл бұрын
@@user-ir2fu4cx6p Yes, i also thought it was OOP But can we decompile it? We can directly decompile exe file with c# code, cant we do this with c++?
@user-ir2fu4cx6p
@user-ir2fu4cx6p 3 жыл бұрын
@@Gameplayer55055 I think that because .net IS can be decompiled easy to it original functions structure type (there is tools specified to do that), but C++ I don't know maybe it's uses different approach for compile it to machine code make it relies less on the OS, C are much simpler language since it's very close to assembly in many ways, you maybe able to create complex code with C to make it harder to Decompile/read .
@Gameplayer55055
@Gameplayer55055 3 жыл бұрын
Yes, You're right. but after watching decompiled c++ code i want to write on pure c :)
@user-ir2fu4cx6p
@user-ir2fu4cx6p 3 жыл бұрын
@@Gameplayer55055 Lol same, but After I watch how they decompile C# codes, OG
@gabrielaccerboni6208
@gabrielaccerboni6208 4 жыл бұрын
Legend has it that some executables can detect that you are decompiling them and at the same time run some defensive script or destruction command. Would you have an example of this? How can we avoid the first trap?
@stacksmashing
@stacksmashing 4 жыл бұрын
Detecting decompiling is as such not possible, as the binary is never executed. The only way this would work is if the executable contained an exploit for whatever tool you are loading it in.
@gabrielaccerboni6208
@gabrielaccerboni6208 4 жыл бұрын
233/5000 Thanks for your answer, just two last questions... If someone is logically monitoring us (Rat), they will use a port that we could realize by monitoring the established connections. Is it possible that the attacker could hide that? Same question for a Man in the middle attack.
@SolomonUcko
@SolomonUcko 3 жыл бұрын
FWIW, there is sometimes anti-*debugging* code, since the debuggers need to actually run the code.
@gabrielaccerboni6208
@gabrielaccerboni6208 3 жыл бұрын
Yes, I found some information in the book of the Cat (Tamper proof). This led me to read about kernels, compilers, malware analysis. I finally ended up in computer forensics but there isn't much on this. In my country it is a concept born only two years ago. I don't know anyone in the business, I must be one of the few. Thanks for sharing these videos. They are my best school.
@ShimrraJamaane
@ShimrraJamaane 2 жыл бұрын
@@stacksmashing There are certain orders of bytes that can crash debuggers, decompilers, and disassemblers. There have even been RCEs on some of them. One CVE that I found to support the fact that such vectors can and have been attacked is CVE-2016-8390.
@error200http
@error200http 4 жыл бұрын
It's great WannaCry won't encrypt my Minecraft folder
@bill.zhanxg
@bill.zhanxg 3 жыл бұрын
Reverse engineering is so hard lol
@tismoineau2646
@tismoineau2646 3 жыл бұрын
my ghidra is dead because a virus disable my jdk and orale servers is actually down. someone can send me the source code ? T_T
@godfire6498
@godfire6498 3 жыл бұрын
How to reverse WannaCry:make CTRL+I !
@dr.vojislavhadzimilic3649
@dr.vojislavhadzimilic3649 9 ай бұрын
this guy looks like someone who create wannycry .. (I'm joking)
@johnhammer8668
@johnhammer8668 2 жыл бұрын
fasicnating
@leozendo3500
@leozendo3500 4 жыл бұрын
Wow just wow.. I'm sure you won't need to pay for any game/software if you decide to spend some time.
@Preinstallable
@Preinstallable 4 жыл бұрын
601th view
@laggybot1327
@laggybot1327 4 жыл бұрын
where is the etranalblue code ???? i came for etarnalblue
@stacksmashing
@stacksmashing 4 жыл бұрын
I’m sure asking this nicely will help :)
@AdoptedPoo
@AdoptedPoo Жыл бұрын
thsi virus wasnt done by one person, def made by a government.
WANNACRY: The World's Largest Ransomware Attack (Documentary)
29:52
The TWS Channel
Рет қаралды 546 М.
Why 111-1111111 is a valid Windows 95 key
6:26
stacksmashing
Рет қаралды 1,9 МЛН
Why You Should Always Help Others ❤️
00:40
Alan Chikin Chow
Рет қаралды 31 МЛН
When Steve And His Dog Don'T Give Away To Each Other 😂️
00:21
BigSchool
Рет қаралды 10 МЛН
ELE QUEBROU A TAÇA DE FUTEBOL
00:45
Matheus Kriwat
Рет қаралды 31 МЛН
Learn Reverse Engineering (for hacking games)
7:26
cazz
Рет қаралды 973 М.
everything is open source if you can reverse engineer (try it RIGHT NOW!)
13:56
Low Level Learning
Рет қаралды 1,2 МЛН
Getting JTAG on the iPhone 15
9:10
stacksmashing
Рет қаралды 330 М.
Bare-metal ARM firmware reverse engineering with Ghidra and SVD-Loader
14:40
GHIDRA for Reverse Engineering (PicoCTF 2022 #42 'bbbloat')
17:44
John Hammond
Рет қаралды 195 М.
How the Apple AirTags were hacked
8:38
stacksmashing
Рет қаралды 1,6 МЛН
Wana Decrypt0r (Wanacry Ransomware) - Computerphile
15:19
Computerphile
Рет қаралды 1,5 МЛН
Beginner Reverse Engineering  | Part 1: How To Find The Main Function
6:30
Exploring the Mew Glitch
10:31
stacksmashing
Рет қаралды 185 М.
Не обзор DJI Osmo Pocket 3 Creator Combo
1:00
superfirsthero
Рет қаралды 1,3 МЛН
С Какой Высоты Разобьётся NOKIA3310 ?!😳
0:43
😱НОУТБУК СОСЕДКИ😱
0:30
OMG DEN
Рет қаралды 3,2 МЛН
Mi primera placa con dios
0:12
Eyal mewing
Рет қаралды 576 М.