$Revision: 1.1 $ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Cracking CoffeeCup Applet Password Wizard XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX by Morten Poulsen m0rtenp@ofir.dk http://www.coffeecup.com/java/password/ "All this and more make CoffeeCup Applet Password Wizard the easiest way to password protect your pages" Introduction ~~~~~~~~~~~~ CooffeeCup Applet Password Wizard is a Java applet to password "protect" your webpages. This is NOT secure. You can just request the URL directly. I will explain how to recover the encrypted URL later. First, let's find out how to make it a registered version. You will need a few tools to help you do the job: - Java decompiler (Jad) - editor (vim) And as always - C compiler (gcc) to make the job faster. Trial vs. Registered Version ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Decompile the applet (joylock.class), and open the resulting Java file. Look at it. LOL. It's not even obfuscated. Look at the method init() (line 16, using Jad). It parses the parameter "GENERAL". The lines 22-26 looks like this: if(Integer.parseInt(stringtokenizer.nextToken()) == 11) registered = true; else if(getDocumentBase().toString().startsWith("file")) registered = true; So, if token two is 11 (it's 1 by default in the trial version) or the codebase starts with "file" it will work as registered. As we can't be serving the applet from the local disk all the time (hey, this is for the Internet, right?), change the "1" to "11" in the applet parameter "GENERAL", and we're done. String Encryprion ~~~~~~~~~~~~~~~~~ Now, seek to the method decript() (line 175). Here we have the input string s, three other strings and a string array. It looks like this is what they are for: s1 = result s2 = key (input chars 0-26) s3 = buf (input chars 26-) as[52] = mapping Ah! The first 26 chars is a mapping from the encrypted chars to unencrypted chars. Just like this: 0000000000111111111122222222223333 (index) 0123456789012345678901234567890123 abcdefghijklmnopqrstuvwxyz (the alphabet, duh) laocygubimvfdreksxhwjtnpzqvoqvvoqv (example string) So to decrypt the string we just need to loop through s3, mapping each char. Upper case chars are mapped through the same table, uppercasing the result. Other chars are not encrypted. So in our example above the decrypted string will be: v -> t o -> e q -> s v -> t v -> t o -> e q -> s v -> t You can now recover the strings given as arguments to the applet, and thereby get peoples usernames and passwords and their URLs. Below I have written a short program to do the job. joylock.c: ------------------------------------------------------------------------------ #include #include int main(int argc, char **argv) { int i; if (argc != 2) { fprintf(stderr, "Usage: %s string\n", argv[0]); exit(EXIT_FAILURE); } for (i=26; i= 'a' && argv[1][i] <= 'z') { printf("%c", argv[1][argv[1][i]-'a']); } else if (argv[1][i] >= 'A' && argv[1][i] <= 'Z') { printf("%c", argv[1][argv[1][i]-'A']+('A'-'a')); } else { printf("%c", argv[1][i]); } } printf("\n"); return EXIT_SUCCESS; } ------------------------------------------------------------------------------