{"id":1244,"date":"2016-05-24T18:12:19","date_gmt":"2016-05-24T18:12:19","guid":{"rendered":"http:\/\/www.gironsec.com\/blog\/?p=1244"},"modified":"2016-05-24T18:12:19","modified_gmt":"2016-05-24T18:12:19","slug":"smartermail-password-decryption-updates","status":"publish","type":"post","link":"https:\/\/www.gironsec.com\/blog\/2016\/05\/smartermail-password-decryption-updates\/","title":{"rendered":"SmarterMail Password Decryption Updates"},"content":{"rendered":"<p>Greetings and salutations!<\/p>\n<p>One of my faithful readers reminded me that one of my old programs I wrote no longer works. This is due to SmarterMail updating their source code and me not updating enough.<\/p>\n<p>So to fix this, I have come up with a half-ass solution. <\/p>\n<p>For those wondering how to decrypt SmarterMail hashes, here&#8217;s how: It&#8217;s DES encryption with a 14 character key and 4 byte initialization vector. <\/p>\n<p>I started to write a project for decryption, but I never quite finished. Here&#8217;s what I put together:<br \/>\n<a href=\"http:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2016\/05\/Untitled.png\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2016\/05\/Untitled.png\" alt=\"Untitled\" width=\"403\" height=\"445\" class=\"alignnone size-full wp-image-1245\" srcset=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2016\/05\/Untitled.png 403w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2016\/05\/Untitled-272x300.png 272w\" sizes=\"(max-width: 403px) 100vw, 403px\" \/><\/a><\/p>\n<p>The main part of the code is this:<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;\">\n<pre style=\"margin: 0; line-height: 125%\"><span style=\"color: #0000ff\">using<\/span> System;\r\n<span style=\"color: #0000ff\">using<\/span> System.Collections.Generic;\r\n<span style=\"color: #0000ff\">using<\/span> System.ComponentModel;\r\n<span style=\"color: #0000ff\">using<\/span> System.Data;\r\n<span style=\"color: #0000ff\">using<\/span> System.Drawing;\r\n<span style=\"color: #0000ff\">using<\/span> System.Linq;\r\n<span style=\"color: #0000ff\">using<\/span> System.Text;\r\n<span style=\"color: #0000ff\">using<\/span> System.Threading.Tasks;\r\n<span style=\"color: #0000ff\">using<\/span> System.Windows.Forms;\r\n<span style=\"color: #0000ff\">using<\/span> System.Xml;\r\n<span style=\"color: #0000ff\">using<\/span> System.Security.Cryptography;\r\n<span style=\"color: #0000ff\">using<\/span> System.Globalization;\r\n<span style=\"color: #0000ff\">using<\/span> System.IO;\r\n\r\n<span style=\"color: #0000ff\">namespace<\/span> SmarterMail_Password_Decryptor_v2\r\n{\r\n    <span style=\"color: #0000ff\">public<\/span> <span style=\"color: #0000ff\">partial<\/span> <span style=\"color: #0000ff\">class<\/span> <span style=\"color: #2b91af\">Form1<\/span> : Form\r\n    {\r\n        <span style=\"color: #0000ff\">public<\/span> <span style=\"color: #0000ff\">static<\/span> <span style=\"color: #2b91af\">string<\/span> PasswordKey = <span style=\"color: #a31515\">&quot;03a8ur98qhfa9h&quot;<\/span>;\r\n\r\n        <span style=\"color: #0000ff\">public<\/span> Form1()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        <span style=\"color: #0000ff\">private<\/span> <span style=\"color: #0000ff\">void<\/span> BtnDecrypt_Click(<span style=\"color: #2b91af\">object<\/span> sender, EventArgs e)\r\n        {\r\n            <span style=\"color: #2b91af\">string<\/span> hashval = tbHash.Text;\r\n            label2.Text = <span style=\"color: #a31515\">&quot;&quot;<\/span>;\r\n\r\n            <span style=\"color: #0000ff\">if<\/span> (hashval == <span style=\"color: #a31515\">&quot;&quot;<\/span>)\r\n            {\r\n                label2.Text = <span style=\"color: #a31515\">&quot;Error, missing pass hash, try again!&quot;<\/span>;\r\n                <span style=\"color: #0000ff\">return<\/span>;\r\n            }\r\n            <span style=\"color: #2b91af\">byte<\/span>[] bytepass = Convert.FromBase64String(tbHash.Text);\r\n            File.WriteAllBytes(<span style=\"color: #a31515\">&quot;temp.wut&quot;<\/span>, bytepass);\r\n            DecryptFile(<span style=\"color: #a31515\">&quot;temp.wut&quot;<\/span>, <span style=\"color: #a31515\">&quot;temp.huh&quot;<\/span>, PasswordKey);\r\n           <span style=\"color: #008000\">\/\/ string password = CryptographyHelper.DecodeFromBase64(0, PasswordKey, hashval);<\/span>\r\n            <span style=\"color: #008000\">\/\/label2.Text = &quot;Pass is &quot; + password;<\/span>\r\n  \r\n        }\r\n\r\n        <span style=\"color: #0000ff\">static<\/span> <span style=\"color: #0000ff\">void<\/span> DecryptFile(<span style=\"color: #2b91af\">string<\/span> sInputFilename, <span style=\"color: #2b91af\">string<\/span> sOutputFilename, <span style=\"color: #2b91af\">string<\/span> sKey)\r\n        {\r\n            <span style=\"color: #2b91af\">byte<\/span>[] my_IV = <span style=\"color: #0000ff\">new<\/span> <span style=\"color: #2b91af\">byte<\/span>[]\r\n\t\t\t\t{\r\n\t\t\t\t\t155,\r\n\t\t\t\t\t26,\r\n\t\t\t\t\t93,\r\n\t\t\t\t\t86\r\n\t\t\t\t};\r\n            DESCryptoServiceProvider DES = <span style=\"color: #0000ff\">new<\/span> DESCryptoServiceProvider();\r\n\r\n            DES.Key = UnicodeEncoding.ASCII.GetBytes(sKey);\r\n            DES.IV = my_IV;\r\n            DES.Mode = CipherMode.CFB;\r\n            DES.Padding = PaddingMode.ISO10126;\r\n            FileStream fsread = <span style=\"color: #0000ff\">new<\/span> FileStream(sInputFilename, FileMode.Open, FileAccess.Read);\r\n            ICryptoTransform desdecrypt = DES.CreateDecryptor();\r\n            CryptoStream cryptostreamDecr = <span style=\"color: #0000ff\">new<\/span> CryptoStream(fsread, desdecrypt, CryptoStreamMode.Read);\r\n            FileStream fsDecrypted = <span style=\"color: #0000ff\">new<\/span> FileStream(sOutputFilename, FileMode.Create, FileAccess.Write);\r\n            cryptostreamDecr.CopyTo(fsDecrypted);\r\n            fsDecrypted.Flush();\r\n            fsDecrypted.Close();\r\n        }\r\n       \r\n    }\r\n}\r\n<\/pre>\n<\/div>\n<p>I am of course omitting several classes I derived from the decompiled mail server code, but this is included in the attachment below.<\/p>\n<p>As you can see we have our encryption type type (symmetrical \/ DES), our key, and our IV, as well as a method to decrypt. This project is not complete, but most of the pieces are here: <a href=\"http:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2016\/05\/SmarterMail_Password_Decryptor_v2_pass_12345.7z\">SmarterMail_Password_Decryptor_v2_pass_12345<\/a><\/p>\n<p>Happy hacking!<\/p>\n<p><a href=\"http:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2016\/05\/164-aladdin.png\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2016\/05\/164-aladdin.png\" alt=\"164-aladdin\" width=\"800\" height=\"353\" class=\"alignnone size-full wp-image-1247\" srcset=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2016\/05\/164-aladdin.png 800w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2016\/05\/164-aladdin-300x132.png 300w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2016\/05\/164-aladdin-768x339.png 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Greetings and salutations! One of my faithful readers reminded me that one of my old programs I wrote no longer works. This is due to SmarterMail updating their source code and me not updating enough. So to fix this, I have come up with a half-ass solution. For those wondering how to decrypt SmarterMail hashes, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4,5,7],"tags":[24],"_links":{"self":[{"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/posts\/1244"}],"collection":[{"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/comments?post=1244"}],"version-history":[{"count":1,"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/posts\/1244\/revisions"}],"predecessor-version":[{"id":1248,"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/posts\/1244\/revisions\/1248"}],"wp:attachment":[{"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/media?parent=1244"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/categories?post=1244"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/tags?post=1244"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}