Developing And Cracking Simple DotNET CrackMe Program

We are going to make a simple program which will check license key , later we will try to crack it by different methods.

Tools Used :


Coding Our Program


Design :



Add a TextBox which will accept the license key entered by user. "txtkey" will be the name of this TextBox.

Add a Button with Text Register which on click will check the license key. Name it as "btnregister".

Add a label with text "UnRegistered". Change its font color to red. Name it as "regcheck".

Now add some elements according to your choice or add according to image shown above.


Aim :

Let our license key be " This-Is-V_A_L_I_D-Lic_ENCE-K_EY " . On entering other key than this , there will be a message that " The Key is Wrong ". If the key is correct , the label "regcheck" text will changed to "Registered" with font color Green.

Code For Button "Register" :

 


Testing Our Program


As you can see , i tried any random text in license key , it throws error.

Now try the original key


On registering with correct license key , The "regcheck" text changed to "Registered".

Cracking The Program

We are going to crack this program so that we can able to see what its working license key or make some changes so that any license key is treated as correct key.

Method 1 : Finding Its License Key

In This method we will use .Net Reflector which is a decompiler for dotnet programs.

Open The Program In .NET Reflector. Now Expand It From Form1 And View btnregister's code



So here you can view the license key [right side] , Use this license key to register the CrackMe program

OR

We can change this license key to our desired one. For this we have to use Reflexil Plugin.


Add Your Desired Key And Update It



Now Save This Modified Program And Try Entering The New Key "Key123"


As you can see , the program got successfully registered after entering our new key. In This way , we have successfully cracked our CrackMe Program by using First Method. Now move to method 2nd.

Method 2:

In this method we will modify the program in such a way that whenever Register button is pressed , the program will gets register without checking any conditions or license key. We will use dnSpy for this method. dnSpy is an assembly editor for .net programs [open source project]

Open CrackMe Program in dnSpy and Expand it from Form1. Now check btnregister's code


Right click on the code and choose option Edit Method [Shortcut key : Ctrl+Shift+E] 

Now Remove all the if statements where license checks are being carried out in such a way that code looks like that


After that compile and save the project , Run the CrackMe program to check whether it is registering on any license key or not.


Yes its working , it shows Registered on Registering with any text. 

In this way we cracked our first simple CrackMe Program