You are on page 1of 16

Cracking J2ME

Applications

By –Back2Figure1 (Annada Prasad Behera)

Disclaimer: - By reading this pdf file you agree that the author, Back2Figure1, is not
responsible, in anyway, for your actions. You take the sole responsibility for what you do. If
you do not agree, then please stop reading further and delete this electronic file.
Introduction
I saw a lot of Tutorials at UC Browser Forum and almost all the tutorials only show you
how to translate language but no tutorial ever talked
about cracking or patching the serial key or modifying
the java files. In this tutorial, however, I will say you how This is a sidebar. I will give important points
to do that. This cracking is for beginners, so I will here. Look for sidebar for more information.
demonstrate simple cracking and not very detailed
explanations. But I will give all the details of whatever
we will be doing. I will first give some basics and then I will give a step by step explanation
for cracking a very simple software. Before we get into any cracking I would assume that
you are a programmer, although, you will not need any programming to follow the 1st
tutorial. It is better if you know JavaME or JavaSE, but even if you are a C or a C++
programmer you’d have no problem in what I’d be talking about.

What does this Book Contain?


There are basically 2 things that are here in this book, and according to the level of
difficulty – the first one is the easy and the second one is tough, they are:

1. Modifying the Strings – In this tutorial I will show you how to change strings in a
java class file. This is mostly used in translating. And yeah, you can put your name
on your favorite app. This is the most discussed tutorial in UC Forum an also the
most complained one. Everyone keeps complaining that this doesn’t work. I’d do
this tutorial all over again for those who are confused what to do? I’d be explaining
them in details. So keep up!!!
2. Cracking and patching – Now we come to the programmers part and the
beginning of the purpose of this book. We will patch and crack a application that
require a serial key.

Things that you will need:


You will need these software to crack. These are my personal
choices; you may choose to use alternative software. I have You may choose to download specific software
provided the links along with. if you want to follow only specific part of this
tutorial. We will need these:
1. 7zip (http://www.7-zip.org/download.html) – This is free
software that is used in packing or unpacking For Tutorial 1 : 7zip , JD-GUI , HEdit (or Class
compressed files and folders. Ignore this if you have Editor)

WinZip or WinRAR or any similar software. For Tutorial 2: 7zip, JD-GUI, Java DeObfuscator,
2. JD-GUI (http://java.decompiler.free.fr/?q=jdgui) – This is a HEdit,(or Class Editor)
free java decompiler. It can recreate the main source
code from the compiled machine binary code. You can
use any other decompilers, like cavaj, JAD, Mocha or JD.
3. mirkes.de Tiny Hexer(http://www.mirkes.de) – This is a hex editor. Any hex editor is
okay.
4. Class Explorer(ClassExp) (http://www.codexterity.com/classexp.htm)– This is a java
disassembler. As usual, you can have any other disassemble or SUN’s own javap
disassembler.
5. Java DeObfuscator (http://www.softpedia.com/get/Programming/Debuggers-
Decompilers-Dissasemblers/Java-DeObfuscator.shtml) – It will deobfuscate the java
code, to make it easier to crack.
6. Class Editor (http://classeditor.sourceforge.net/) - This is a class editor that can do
the work of both Hex Editor and the disassembler. The reason that I didn’t prefer it
at the first place is that it requires JRE (Java Runtime Environment) to be installed
on the system. If you want to get JRE you can get it here :
http://www.java.com/en/download/

Now I really want you to download these software before you read any further. Because
we will be doing cracking from now onwards.

Getting Started…
Oh ! There is nothing here, just the beginning. I just want you to follow this steps just to
begin our tutorial. Nothing else. These are important things to do before we follow up the
tutorials.

Along with this file there were 4 more files that are basically mobile applications created
by me. They are Usefull App, French App and their jad files. Extract them to your hard
disk. These are the application that the tutorial will be based upon. You will be cracking
these tutorials applications. Even though they are simple (yes they are simple because this
tutorials are for beginners!!!), they will build solid base for you to pry upon. You can try to
crack bigger files and challenge, thereafter.

Be Warned: Cracking is a very very boring and tedious job. But the outcomes are fantastic.
Believe me cracking will take a lot of time. DO NOT expect fast result. Sometimes you may
spend, like, 9-10 days on a software and still get nothing and begin from the start.

Don’t say I didn’t warn.

Tutorial 1: Modifying the Strings


This tutorial is a very basic tutorial and is an easy one to follow. There has been many
tutorials like this on UC Browser Forum. You may follow those, but, I am writing this
tutorial all over again so that anyone who is confused about this can look at this tutorial. I
am therefore giving a very detailed instruction here.

What is a JAR file? It is, basically, a way of compressing files and putting them
together. So a .jar file is also a compressed set of files. JAR file is nothing BUT a ZIP file.
So if you rename a JAR file to ZIP file you’d have no problem. And that’s it! That’s the
base to understand and smoothly follow this tutorial. So let’s begin.

Copy the French App.jar onto your Mobile Phone. I have a Nokia phone so only French
App.jar is enough. But if you have a Samsung or any other phone model then you will
require a French App.jad file. If you are still confused see your user manual.

Run the app on your phone. This is a very simple Application. It only displays some texts on
your phone. But it is not in understandable. Because it’s in French (how romantic!). So we
will translate it into our language. I can understand Oriya but many others won’t. So let’s
convert it into English.

Opening and Getting the Code:


1. Go to the place where you have extracted the tutorial files.
2. Now open French App.jar in 7zip. (Right Click > Open with > Choose
Program…>Select 7zip > OK).
3. You will find there is class file called French.class and a folder called META-INF.
Most of the tutorials at UC Browser Forum will
4. We are not concerned about META-INF right now. actually try to change a language file that is
We are more interested at French.class. present in the jar file. But here there is no
language file. So we will modify the class file to
achieve our Goal.

For Example in UC Browser there is a ab.htm


file and h.htm file that you can change to
convert it from Mandarin Chinese to British
English.

5. Open French App.jar with JD-GUI.


6. Click on French under the French App.jar tab. And presto. You can see the
decompiled source code.

7. Look at the String called “Application utile (en français)”. Obviously this is what we
want to change to English.
8. If you use Google Translate or Yahoo! Babel Fish Translation, you would see that it
means “Useful Application(French)”.
9. Go ahead and Make a Backup of the file if you haven’t already.

Translating it into English:


1. Go to 7zip which you had opened earlier.
2. Now open mirkes.de Tiny Hexer.
3. Drag the French.class from 7zip into Tiny Hexer.

4. Then you will see a lot of machine code. Like this:

5. Click on Edit > Find/Replace. Search for “Application”. Make sure you have ticked
“Find text” check Box.
6. Now be careful. “Application utile (en français)” has 31 characters. But its English
conversion “Useful Application” has only 18 Characters. You have to make sure that
its English conversion has 31 characters like “Useful Application-Back2Figure1” or
you can simply put spaces like this “Useful Application “.But Always make
sure that there are 31 characters.
7. Go the place and start editing the hex. Replace “Application utile (en français)” to
“Useful Application-Back2Figure1”. (BE Warned: Don’t mess with any other things.)

8. Click on File > Save As.


9. Save it a suitable location on your hard drive as the name “French.class”.
10. Now update the French App.jar by dragging the French.class into 7zip.
11. Your translation of the Title is over now. Let’s Do a quick check and see whether
the language has changed or not. Just open the file in “French.jar” in JD-GUI.
12. You must see something like this :

13. Now you have successfully changed the title. Now open the file on your phone and
PRESTO! The file has changed successfully.

Conclusion
In this tutorial we didn’t do much about any programming. We just changed the title
of the Application from French to English. Now go ahead and change the rest part of
the application which says “Ceci est une application J2ME échantillon écrit à des fins de
démonstration. Il est fait par Back2Figure1. Ici, je vais vous apprendre à le traduire en
anglais.” Into English. You can use Google Translate or Yahoo! Babel Fish to get the
English version of the text. Personally I like Google Translate. Do the same step as I
have done in this tutorial.
Some Tips:

1. Always make sure that the total number of characters before and after the
modification of string is same. If they are not same then the application will not work.
You can add spaces or shorten the text to accommodate the new string.

2. NEVER mess with any other hex characters. These are machine instruction. And if
modified, it will crash your application.

We actually didn’t need the decompiling but I did it just to make sure that you follow
what’s going on. Now, you know how to modify you strings. So you can translate any
J2ME Application from foreign language into your language. Good LUCK.
Tutorial 2: Cracking and Patching
This tutorial is the real deal. The ‘Tutorial 1’ is not very difficult. Here we will be cracking
Software made by me. This tutorial is tougher than the last one. We will be doing low-
level cracking here. If you skip steps, you will not get the application patched.

Open “Usefull App” on your phone. This is a simple application that will ask you
for a registration number. If you really want to register, then you have to go to a
site called www.facebook.com/back2figure1 (don’t worry this is my personal
profile. Message me and I will tell me the registration code. It costs Rs.50. It’s just a
joke). But you dont want to pay the money, do you? Hell, NO—that’s why we
want to crack this software so that we get it for free. Let’s begin…

Warning: You must be a programmer if you want to follow this tutorial. If you are
not a programmer, I am sorry, you will not get what I will be talking about. You must
be a JavaSE, C, C++ programmer or even better a JavaME programmer.

Here we will crack the application. Cracking is basically modifying the assembly so that
the application doesn’t ask you to register. Or it will register the code even if you put
the wrong registration.

1. Open “Usefull App.jar” on your phone or any j2me emulator. You will be asked to
enter a registration code. We, obviously, don’t have that. Enter anything. If you are
not the luckiest person on Earth, then you will get it wrong.
2. Note the error code. It is something like this : “Wrong Serial Key. This serial key is not
valid. Check your spelling and try again. Make sure that all the letters are in
capital.”
(Note Carefully: In real life application like UC Browser Opera Mini, the class file will
NOT have meaningful names like register.class, match.class but they will have
names like – a.class, b.class, c.class so you have to deobfuscate like this. The Steps
are here. You will not follow these steps 3, 4, 5, 6, 7, 8 and 9 because my file is not
obfuscated. )
You must have a Microsoft .NET Framework
3. Now open Java DeObfuscator. Unfortunately my java 2.0.50727 to run Java DeObfuscator. If you are
deobfuscator doesn’t support direct manipulation of running Windows 7, don’t worry, its already
JAR files. But if your DeObfuscator supports JAR file, there on your system. If you are running
deobfuscate it and don’t next two steps. But if you are Windows XP, then download it from Microsoft’s
official site. Its free. That’s why this tutorials is
using the same as me, then follow the steps.
in Windows 7.
4. Extract “Usefull App” into a folder using 7zip. There will
be 3 class files (register.class, Usefull.class, match.class)
and a META-INF folder.
5. Open the a.class, b.class and c.class using Java DeObfuscator.

6. Choose your output directory by clicking the button named “…” next to text box
called out put directory.

Why DeObfuscate? You may be asking this


question that why am I deobfuscating.

There are a number of java decompilers


available in the internet, free of cost. So it is not
a difficult job the get the source code from the
7. Not click on “Deobfuscate” at the bottom of the class files. So to protect their code from
screen. Make sure that the “Rename Classes” and potential crackers like us, the company started
to deobfuscate their code so that these is a
same class name, method name, complicated
overloaded methods and confusing code. So
that a cracker like us can’t get into their code.
But deobfuscating a code is simply renaming
the class name, method name and variables so
that you don’t have get confused while cracking
the code.

“Unique Numbers” are turned on. But crackers like us, who have been cracking
8. You will get a message saying “DeObfuscated hard coded low-level languages, obfuscating
the code is not a big deal.
everything ok”.
9. Now take a look at your output directories. There
must be 3 classes with different name and same code but the variables have
changed. My classes are named Class_a_050, Class_b_111 and Class_c_012. Now the
deobfuscation has been done.
10. Open the file ‘Usefull App’ in JD-GUI. And look at the code.
11. Click on Search > Search.
12. Enter the error code which was “Wrong Serial Key”. Tick on String Constant. You
will see matching items.

13. Click on ‘Usefull’ and then click on Open.


14. ‘Usefull’ has been opened and the String “Wrong Serial Key” has been highlighted.
15. Take a note of the variable that represents the string “Wrong Serial Key”. Mine is
“wrong”. It is a variable of the type Alert class.
16. Search for the variable in the class and you will see this section of code :

17. Examine the code carefully and analyze what the code is trying to tell you. Let me
analyze it for you.
Analysis: The ‘if’ part is directing the match to check for
something. Something that we don’t know. Let it be. But if the result
is true then it will display whatever the variable ‘correct’ contains.

Lets us check what the variable ‘correct’ contains. And scroll up and
you will find that it contains an alert that the software key has been
accepted. And that’s the thing we will crack. And this is basically
what we want. So what will happen if we alter the code like this.
Now you must be thinking that why not
recompile the code and change the things. Yes,
Please notice the ‘!’ sign before the
you can do this to ‘Usefull App.jar’. But for
class match.If the code is changed to that application like Opera Mini, Bolt Browser,
the meaning will differ completely. Its new Mobipdf, it will not be possible because they
meaning will be this. If the validity check have been obfuscated. It will cause some error.
made by ‘match’ is true, then ‘!’ sign before Another reason is that this program “Usefull
will make it false and vice verse. So if a App” is a simple one and recompiling may be
wrong code is entered then the code will easier. But if you look into real life application,
display Alert ‘correct’. Which means that it will be so much difficult it will become
software key is accepted. impossible. So we will do bit-level manipulation
to crack this.
18. According to our analysis, we have found that we
have to make the statement
“ if(match.validSerial(this.textBox.getString()))” into
“ if(!match.validSerial(this.textBox.getString()))”. But wait this not an
easy thing to do. We cannot modify the class file directly in JD-GUI because it is not
possible. So we will change it using binary.
19. Now we will dis-assemble the code to see what’s going on at the machine level.
20. So open the class “Usefull.class” in ClassExp.
21. Click on Methods > commandAction > Disassembly. This will show the disassembled
code for “Usefull.class”. This is what we look at and see what’s going on at machine
level.
22. Now Search for the “ ifeq” and you see that it is there on the line 38 as “ifeq 55”.
23. What does it mean? It means that if line 35: ‘invokestatic 37 –
match.validSerial is true then “goto line: 55”.

24. If we convert it into ifeq into ifne, then we it will


mean this: if line 35: ‘invokestatic 37 –
If you are getting confused about what is
match.validSerial’ is false then “ goto line: 55”.
ifeq, infe, 9900, 9A00. ‘ifne ’
Our Thing will then be patched. and ‘ifeq’ are java virtual
machine(JVM) mnemonics. And 9900
and 9A00 are its hex counter-parts. Please
wait, I will cover it in details in my next tutorial.
And I will write my next tutorial only if I get
enough good feedback. My email and web are
at the bottom of the page. Send me feedbacks.
25. The question is how to convert ifeq to ifne ? That’s why I am here. I will now tell
you how to accomplish that.
26. Now open “usefull.class” from the original app in mirkes.de Tiny Hexer.
27. Click on Edit > Find/Replace.
28. Type “ 9900” and click Find. Do not tick ‘Find text’.

29. Click on close and change “ 9900” into “9A00”.

30. Save it and update your “Usefull App.jar” by replacing the original Usefull.class by
modified class. And now the thing has been patched. Hurray ! We have done it.
31. Now install the application on and enter any value. You will see that you will be
successfully registered.

Conclusion
This tutorial has shown you how to crack a simple application. Cracking it was easy
because it didn’t have many functions and variables and was not obfuscated. But if
you are cracking any other applications be careful, you will be lost in codes -- a lot of
codes.

Some Tips:

1. DeObfuscate the code first. Never proceed without deobfuscating the code.
Because without deobfuscating the code you will not get anything and simply
jump from here and there.
2. NEVER mess with any other hex characters. These are machine instruction.
And if modified, it will crash your application.
3. Always make sure you are cracking the correct if…else statement. My program
had only one if…else statement. But on real life programs, there will be many
other if…else statement.
4. While changing the hex from ‘9900’ to ‘9A00’ make sure you are changing the
correct one. To determine which one is correct use Class Explorer.
5. I haven’t given any instructions about JAVA BYTECODE OPCODES,
HEXADECIMAL and STACKS. They are not required here. But if you want to be a
real life cracker and develop KEYGENS , then you will require them.

Good Luck with your cracking. Go ahead and crack some applications you wanted to
crack. If you face any problem you can message me. My contacts are at the bottom of
this book.

A word from the Author…


I am a simple guy, not a professional IT expert and I am not working in any computer
firm.

 So please do not send me suggestion to crack software for you. I have my own
homework to do. All requests will be ignored.
 Never tell anyone that you are cracker. Believe me it’s not good.
 If you crack any software, do not disclose it to anyone. Use it personally.

Coming Up
I am thinking of doing more cracking tutotials. But I will do only if I get enough good
feedback. The next tutorial I will probably teach you how to:

 Create Keygen. A keygen is a different piece of software that will generate


keys for you to register.
 Remove Advertisements from adware. Adware - A game that will only start
only of you connect to internet for advertisement.
 Add functionality. For example. You can add functionality to UC Browser so
that a small calculator will appear when you refresh page or do some specific
task.

These tutorials will require higher level of understanding of JAVA BYTECODE OPCODES,
HEXADECIMAL and STACKS. So I will explain them in details in that tutorial. If you
really want to learn them please send me feedback.

I know that you will try modify this pdf file and put your name instead of my name.
Please don’t do that if you really want me to write those tutorials. If I find a modified
version of this pdf anywhere on Internet I will not write the further tutorials. If you find
your own work being published under someone’s name it feels like shit.

Goodbye
My tutorials are over. You have now the great power to crack the application. And all
cracking is basically these steps and the most difficult step is finding the function that is
validating the registering key. This cracking was easy because it has a fewer functions
and easy to track. But things out there are really obfuscated at so high level it will take
a long time to crack them. Here BE MONSTERS. So good luck with your cracking.

Send me suggestion at:

Email : munabsb@gmail.com

Web: www.facebook.com/back2figure1.

You might also like