r/blackhat • u/Sartux7 • May 20 '19
Ransomware source code
Hi All,
I'm looking for the source code for some recent-ish ransomware (open source project is fine either). I'm looking for something recent (win10) but I don't really mind what language it is as long as its not in something too obscure.
Doesn't need to be anything too crazy, it's just for learning purposes but I'm not looking for just a basic proof of concept as I'm really wanting to get to grips with the 'whole product'
14
u/Acewrap May 20 '19
Here you go:
2
u/Sartux7 May 29 '19
Thanks for this, I found a few repositories before but nothing with actual source code along with the binaries.
Much appreciated.
7
u/willrandship May 21 '19
Writing your own ransomware payload is not difficult. You could write one in less than 100 lines of python.
If your target method is, eg, RSA encryption of the files, all you have to do is:
Setup
Calculate a private/public keypair (e+n and d+n, you can find how to get these from large prime numbers on wikipedia), and store only the public as a variable in your program. Typically this will be e=65537 (for performance reasons) and n=two large primes multiplied together, where the secret d satisfies xd % n = y AND ye % n = x.
Payload
Identify a list of potentially useful target files, like all of documents. You typically don't want to encrypt anything that would make it difficult for customers to pay you, like executables or windows DLLs. Bricking a computer doesn't make any money.
Have your ransomware use the key to encrypt files, by splitting them into chunks < n bits wide, then calculating chunke % n, then storing that back into an encrypted file. (eg same name + a .rekt extension)
Delete the original file.
Repeat until all files are encrypted.
Pop up an angry message saying "Pay me"
Have a dialog box to paste in the value for d.
When payment has been processed, provide d (manually with a throwaway email would work) and do the same process, splitting the encrypted files into the same sized chunks to reverse back to the original.
Once you have a working payload you just need a way to infect computers with it, which is outside the scope of ransomware specifically.
Please note that I have not:
Recommended that you attempt to infiltrate systems
Provided a method to infiltrate systems
I have only done the equivalent of telling you how to trash someone's room, not how to break into their house.
2
u/Sartux7 May 29 '19
Thanks for this, it's a good flow of how it works. For me I'm mostly interested in looking at the source as this is a learning rather than building excercise but still appreciate the well thought out post.
22
u/ETTR May 20 '19
Just for learning purposes but no language in mind? Suuuure.
7
u/lleti May 20 '19
That'd honestly make me think he was more legitimate in wanting to learn. If he requested a specific language, it'd likely be one he's familiar enough with to just change a few vars, compile, and distribute.
4
May 20 '19
[removed] — view removed comment
2
u/lleti May 20 '19
I imagine the learning here would moreso be in how the ransomware application traverses the directory tree, mass-encrypting files but avoiding important system files etc.
They'd also likely have interesting/novel "phone home" methods, since just hitting a static web address/IP would be fairly unsafe as a lone server could be easily shut down.
Following that then, it'd be interesting to see if the crypto wallet automates file unlocks and the likes - and what sort of protections are in place to prevent someone from just spoofing the "they've paid" packet, or what sort of compilation minification took place to prevent someone from just flat out reading the encryption used.
Honestly though, if you wanted to get a real learning experience like the above - in seeing what type of errors are made which can nullify the application, you'd want to find a leaked piece of source, rather than something available for public consumption.
1
u/Sartux7 May 29 '19
That's exactly it - whilst I'm no coding 'rockstar' (or whatever the term is these days) I'm comfortable enough with a enough with most mainstream languages (hence nothing obscure) to understand what's being written, but I've never seen decent code of newer ransomware (as you say, something leaked not just a random github).
3
u/Angrymilks May 29 '19
I guess this needed to be said, but don’t go on Blackhat stuff with a persona that you already burned by openly admitting to committing a crime.
Not everyone here has your best interests in mind, ensure you have yours.
Also, you have no clue who else is on this subreddit with LEO ties looking for someone with bad opsec (protect yourself and don’t bridge personas).
1
1
1
-5
u/mjohnson90 May 20 '19
"but I don't really mind what language it is as long as its not in something too obscure " - Or you could learn to code. I think somewhere like HackForums would be lovely for you :)
-9
May 20 '19
Learn how to look up CVEs, and the answer will reveal itself to you.
2
May 24 '19
Not sure why I was downvoted to hell. I ain't gonna give the guy who wants to actively setup ransomware the easy to find keys to the castle.
28
u/Angrymilks May 20 '19
Probably shouldn't openly advertise that you participate in carding http://offensivecommunity.net/showthread.php?tid=254054 ...