Monday, October 26, 2015

Customizable aspr_ide.dll With Source Code

Sometimes, after unpacking an asprotect target, the application may still rely on the functions and procedures provided by asprotect in its aspr_ide.dll. While the sdk allows for custom functions to be added to it, the generic functions include  CheckKeyAndDecrypt, SetUserKey, GetHardwareID, GetTrialExecs, GetExpirationDate, GetRegistrationKeys, CheckKey, GetModeInformation, GetRegistrationInformation, GetTrialDays, GetKeyDate, and GetKeyExpirationDate. The aspr_ide.dll and its source code provided below simulate all of these functions and return the correct values to register the application. Using the delphi source code, you can modify it to fit the requirements of your target.

aspr_ide.dll Download:


Source Code Download:

Thursday, August 27, 2015

Delphi Tips: Hashing a String With Delphi Encryption Compendium(DEC)

Today, I wanted to use the Delphi Encryption Compendium(DEC) to hash a string. It is a little bit difficult to figure out how to use the components since they are poorly documented, but after a few minutes, I came up with this. At first, I tried to use the CalcBinary function, which allows you pass a string to it. It worked fine, but it is limited due to the fact that it would cast all input strings as an ansistring type. As a result, I switched to the CalcStream type to overcome this limitation. Here are two functions which you can use to calculate an MD5 hash for either a UnicodeString or AnsiString. These functions can be easily converted to a different hash type simply by changing the declaration and create type. The available hash types are: 
THash_MD2, THash_MD4, THash_MD5, THash_RipeMD128, THash_RipeMD160, THash_RipeMD256, THash_RipeMD320, THash_SHA, THash_SHA1, THash_SHA256, THash_SHA384, THash_SHA512, THash_Haval128, THash_Haval160, THash_Haval192, THash_Haval224, THash_Haval256, Thash_Tiger, THash_Panama, THash_Whirlpool, THash_Whirlpool1, THash_Square, THash_Snefru128, THash_Snefru256, and THash_Sapphire. 
You can specify haval rounds like this: hash.rounds:=3; //(3,4,and 5 are valid round types.)

Uses DECHash, DECFmt; 

Function GetMD5_Unicode(input: UnicodeString):String;
var
val: tStringStream;
hash: tHash_MD5;
len: int64;
Begin
val:=tStringStream.Create;
len:=length(input)*2;
val.Write(input[1], len);
val.Seek(0, soFromBeginning);
hash:=tHash_MD5.Create();
result:=string(hash.CalcStream(val, len, TFormat_HEX));

hash.Free;
val.Free;
End;

Function GetMD5_Ansi(input: AnsiString):String;
var
val: tStringStream;
hash: tHash_MD5;
len: int64;
Begin
val:=tStringStream.Create;
len:=length(input);
val.Write(input[1] ,len);
val.Seek(0, soFromBeginning);
hash:=tHash_MD5.Create();
result:=string(hash.CalcStream(val, len, TFormat_HEX));

hash.Free;
val.Free;
End;


The Delphi Encryption Compendium(DEC) can be downloaded here:
https://github.com/winkelsdorf/DelphiEncryptionCompendium/releases
 
Until next time, happy programming and reversing. :)

Friday, August 7, 2015

Gilisoft Password Recovery Tool












Gilisoft Password Recovery Tool is a simple utility that allows you to recover the master password for 4 Gilisoft applications.

This utility has been successfully tested on the following Gilisoft programs and versions:
  • Gilisoft Exe Lock 5.0.0
  • Gilisoft File Lock 10.0.0
  • Gilisoft USB Lock 5.5.0
  • Gilisoft Privacy Protector 7.0.0

Download:
https://mega.co.nz/#!4sVhWD7b!Ziz0GatsIyjMrMga6MJXr_kuolbtG1kthh_2Gz6R5AA

Source Code:
https://mega.co.nz/#!F4sBVK6Z!twyh3gbZkj9ZUCH9-7NQhqHQ2fUYYfZP_JK8n9Q1Gis

Monday, June 1, 2015

String Xoring Utility 1.0

























String Xoring Utility 1.0 is an application that will xor encrypt a text string, output it in an array format, and generate a decryption routine for both C++ and Delphi. This will help a programmer hide sensitive strings in their code. Since this will prevent the encrypted text from showing up in string references, this will make reverse engineering slightly more difficult.

Download:
https://mega.co.nz/#!AlUFyAzQ!2EMpQdIUraxsU8b_v3L-S_j5QmFV3dBkg3A0Oo8J2tM

Source:
https://mega.co.nz/#!slcUjIYS!sl0EKHmdUjXOBTOYrQEpeM4zkw44Vix8aG9v11qcxnU


Sample Programs + Source:
https://mega.co.nz/#!AokSXSZK!zUjQgfpTqng6h1uqcd2XMlwaRb3XY7ViLrZih2XZ9Ds

The program is 100% free and open source. However, if used for commercial purposes, a small donation would be greatly appreciated, though not required.

Saturday, May 23, 2015

Random Serial Generator 1.0















Random Serial Generator 1.0 is a simple application that allows you to generate a random serial number for testing license algorithms or implementing them into your own application.

Features:
1. Predefined Character Sets: A-Z, a-z, 0-9, 0-F, 0-f, 0-9 + A-Z, 0-9 + a-z, and 0-9, A-Z, + a-z.
2. Define a Custom Character Set.
3. Input length in either Decimal or Hexadecimal format.
4. Insert Dashes in Insert or Replace Mode.

I did not add any size limits on the input length, so use large numbers with caution. 

VirusTotal Scan (100% Clean):
https://www.virustotal.com/en/file/eb970e0cd75d0324f9ef3b81ad1198377e08ac82b3f51f0222183dc8d6815ac3/analysis/1432434294/

Download:
https://mega.co.nz/#!x18TRabY!9eKZ4H7FyJ8Lt6xz9uBj8s2yZwEZy55AbLvuqtyrT98

Source Code:
https://mega.co.nz/#!c1UwVYQZ!VQVLdrfRDfnDnOB7_DHtXPNjlAKgEobxXbpN7mFEkSk

This software is 100% free and open source. It comes with no warranty.

Icon borrowed from: http://www.iconarchive.com/show/aeon-icons-by-kyo-tux/Sign-LogOff-icon.html

Saturday, May 9, 2015

Hashing Utility Extended 1.0















Hashing Utility Extended 1.0 is an extended version of Hashing Utility 2.0 which supports 77 types of character encoding sets and 14 types of hash encoding schemes.

Supported hash algorithms:
SHA1
SHA256
SHA384
SHA512
MD2
MD4
MD5
HAVAL(ALL)
RIPEMD128
RIPEMD160
RIPEMD256
RIPEMD320

Supported String Encoding:
ANSI
US-ASCII
UNICODE
UNICODEFFFE
ISO-8859-1
ISO-8859-2
ISO-8859-3
ISO-8859-4
ISO-8859-5
ISO-8859-6
ISO-8859-7
ISO-8859-8
ISO-8859-9
ISO-8859-13
ISO-8859-15
WINDOWS-874
WINDOWS-1250
WINDOWS-1251
WINDOWS-1252
WINDOWS-1253
WINDOWS-1254
WINDOWS-1255
WINDOWS-1256
WINDOWS-1257
WINDOWS-1258
UTF-7
UTF-8
UTF-32
UTF-32BE
SHIFT_JIS
GB2312
KS_C_5601-1987
BIG5
ISO-2022-JP
ISO-2022-KR
EUC-JP
EUC-KR
MACINTOSH
X-MAC-JAPANESE
X-MAC-CHINESETRAD
X-MAC-KOREAN
X-MAC-ARABIC
X-MAC-HEBREW
X-MAC-GREEK
X-MAC-CYRILLIC
X-MAC-CHINESESIMP
X-MAC-ROMANIAN
X-MAC-UKRAINIAN
X-MAC-THAI
X-MAC-CE
X-MAC-ICELANDIC
X-MAC-TURKISH
X-MAC-CROATIAN
ASMO-708
DOS-720
DOS-862
IBM037
IBM437
IBM500
IBM737
IBM775
IBM850
IBM852
IBM855
IBM857
IBM00858
IBM860
IBM861
IBM863
IBM864
IBM865
CP866
IBM869
IBM870
CP875
KOI8-R
KOI8-U

Supported Hash Encoding:
HEX
BASE64
MODBASE64
BASE32
BASE58
UU
QP
URL
Q
B
URL_OAUTH
URL_RFC1738
URL_RFC2396
URL_RFC3986

Download:
https://mega.co.nz/#!ogcy3a4T!0D5SAMZ5mdeBJkTYYr7-GTivPMS77MRcWUL-HWE8g3s

Source:
https://mega.co.nz/#!ooUE0JQT!_peZ4Qw-C_xa42D8uuDalPsH-47FmunyMw8tus0_Wpg

This software uses the Chilkat Delphi Libraries:
http://www.chilkatsoft.com/delphiDll.asp

Sunday, February 8, 2015

The Exaggerated Promises of ClickLocker: An Unpacking Tutorial
















ClickLocker is marketed as a digital security solution that allows a content author to easily manage their digital rights by enabling them to regulate access to their ebook, video, or software product. While the ClickLocker website claims that "ClickLocker provides the industrial-strength security you deserve", this is a blatant exaggeration and misleading statement. When we think of industrial-strength security, we assume that this implies the use of cryptography. However, this is not the case with ClickLocker. In this tutorial, we will reverse engineer the ClickLocker Demo application to show you how easy it is to extract an embedded file without the need of a valid license code. To begin, let's download the demo application below.

Demo Application:
http://www.clicklocker.com/ClickLockerDemo.exe

After you have finished downloading, let's scan the file with a protection scanner. In this example, I used ExeInfoPE.
















As we can see, the target application is simply compressed with UPX. This is quite common with most clicklocker applications I have encountered. To remove this, we will simply use the UPX command line utility with the -d parameter to decompress the target.














Now that it is unpacked, we can begin debugging the application. However, before we start, I will give you a quick rundown of how ClickLocker works so that we can understand how the unpacking process works.






















When you start a clicklocker protected application, it will ask you to enter a license code to unlock the program. Once you have entered the 8 digit key, it will connect to the clicklocker server and to verify the license code. Once it checks the license key, it will return 1 of 5 possible strings from the server. Those strings are "good", "bad", "new", "used", "expired", or "suspended". By looking at these, I am sure you can guess that the value we need returned by the server in order to unlock the program is "good". When we enter the key 12345678, chances are, that the server will return the value "bad". In order to exploit this, we will just need to change the returned value to "good". Once the license has been verified, the program will extract the file to the TEMP directory under a random name, apply a super hidden attribute, execute the file, and then delete it. Our goal is to arrive directly after it extracts the file to disk and before it applies the super hidden attribute. To begin, let's go ahead and open the application in Ollydbg and search for all referenced text strings.



First, let's set a breakpoint on all 4 references to the string "good". Afterwards, we need to search for the string "Authenticated Successfully!" This value is returned after the unlocking process is successful. Once you have the breakpoints set as in the picture above, let's start the program in ollydbg and enter the key "12345678".
















After clicking Unlock Now, we will break on one of our "good" breakpoints.















Once we arrive here, we can see that both EAX points to the "bad" string returned from the server while ECX contains its size of 3. In order to trick the program into believing it was authenticated by the server, we need to change the string "bad" to "good" and the size in ECX to 4, which is the length of the new string. Let's follow the dword of EAX in the dump so that we can alter the string value.














Now, let's simply change the value to "good".













Once you are finished, we just need to change the value of ECX to 4 so that it is the same length as our new string.















Now, let's run the program. If everything was done correctly,  we should arrive at the "Authenticated Successfully!" string 2 breakpoints later.




At this point, we simply need to press f8(step over) 8 times to arrive here:





At this point, follow the value of EDX, which was assigned by the instruction at 4DBF26 in the dump to get the path and name of the file that will be extracted.





Let's note this path and file name and press F8. After the called routine is finished, it will have extracted the protected file to the temp directory under the name we had above. Let's open our temp directory and find it.








As you can see, we have found our extracted file. If for some reason you are unable to see your file, it may  already have a super hidden attribute which is often the case with PDF files. In that case you need to change your folder settings to show hidden files and uncheck the option which says hide protected operating system files.






























After doing this, you should be able to find your file. If I recall correctly, a pdf file may have a .tmp extension in order to better hide it. Once you have found the file, you can simply move it to a new directory, rename it if you like, and use the command line parameter attrib -s -h filename.ext to remove the supper hidden attribute if needed.




















Once you are finished, you have successfully beaten this protection. Let's run the application to verify:

























Now that we are finished, I must state that the goal of this tutorial was NOT to teach you how to pirate a ClickLocker protected product, but rather to show you that this product is not as strong as their website implies. A good DRM management software would employ encryption that could not be broken without a valid decryption key being supplied by the server upon activation. This is far from the case with ClickLocker. While my goal here is not to defame ClickLocker, I hope that you will consider these factors before using their low security product. Until next time, happy reversing.