[BUG Innounp-mod] Unable to unpack encrypted setups

Started by Markus, December 19, 2020, 06:30:15 PM

Previous topic - Next topic

Markus

The Innounp-mod package is not able to decrypt setup *.exe files which were protected by a password.

This happens both with the standalone innounp.exe (application crash) and with the Observer module innounp.so (nothing happens when trying to view/copy/...)

I looked at the source code and found the two code fragments which needs to be patched in order to allow decryption. They patches are attached in diff format:

--- ArcFour.pas.old 2018-12-25 10:26:04.946166300 +0100
+++ ArcFour.pas.new 2020-12-19 18:09:52.307024800 +0100
@@ -62,7 +62,8 @@
procedure ArcFourCrypt(var Context: TArcFourContext; const InBuffer;
   var OutBuffer; Length: Cardinal);
var
-  i, tmp: byte;
+  i: Cardinal;
+  tmp: byte;
   InBuf, OutBuf: ^byte;
begin
   InBuf := @InBuffer;


--- Observer.pas.old 2020-04-13 10:14:54.222916600 +0200
+++ Observer.pas.new 2020-12-19 18:09:55.203788000 +0100
@@ -261,7 +261,8 @@
     {$IFDEF LOG} Log('- Detination filename: %s', [string(Params.DestPath)]); {$ENDIF}
     Inno := TInnoSetupFileEx(Handle);
     Inno.SetCallbacks(Params.Callbacks);
-    Inno.Password := {$IFDEF UNICODE} string {$ENDIF} (AnsiString(Params.Password));
+    if (Params.Password <> '') then
+        Inno.Password := {$IFDEF UNICODE} string {$ENDIF} (AnsiString(Params.Password));
     if (Params.ItemIndex < 0) or (Params.ItemIndex >= Inno.FileCount) then begin
       {$IFDEF LOG} Log('- No more files'); {$ENDIF}
       Result := SER_ERROR_READ;

pepak

Quote from: Markus on December 19, 2020, 06:30:15 PM
The Innounp-mod package is not able to decrypt setup *.exe files which were protected by a password.
That is not entirely unexpected - as I wrote in the readme, I don't have a single protected installer to try it on.

QuoteI looked at the source code and found the two code fragments which needs to be patched in order to allow decryption. They patches are attached in diff format:
Thanks. However, what would help the most, would be a demonstration installer which I could use for tests.

Quote--- ArcFour.pas.old 2018-12-25 10:26:04.946166300 +0100
+++ ArcFour.pas.new 2020-12-19 18:09:52.307024800 +0100
@@ -62,7 +62,8 @@
procedure ArcFourCrypt(var Context: TArcFourContext; const InBuffer;
   var OutBuffer; Length: Cardinal);
var
-  i, tmp: byte;
+  i: Cardinal;
+  tmp: byte;
   InBuf, OutBuf: ^byte;
begin
   InBuf := @InBuffer;
This is definitely a thing to fix.

Quote--- Observer.pas.old 2020-04-13 10:14:54.222916600 +0200
+++ Observer.pas.new 2020-12-19 18:09:55.203788000 +0100
@@ -261,7 +261,8 @@
     {$IFDEF LOG} Log('- Detination filename: %s', [string(Params.DestPath)]); {$ENDIF}
     Inno := TInnoSetupFileEx(Handle);
     Inno.SetCallbacks(Params.Callbacks);
-    Inno.Password := {$IFDEF UNICODE} string {$ENDIF} (AnsiString(Params.Password));
+    if (Params.Password <> '') then
+        Inno.Password := {$IFDEF UNICODE} string {$ENDIF} (AnsiString(Params.Password));
     if (Params.ItemIndex < 0) or (Params.ItemIndex >= Inno.FileCount) then begin
       {$IFDEF LOG} Log('- No more files'); {$ENDIF}
       Result := SER_ERROR_READ;

I don't think this has any influence at all. The result is exactly the same in both versions.

Markus2

The InnoSetup application includes an example in C:\Program Files (x86)\Inno Setup 6\Examples\. The only thing you need to change is to enable encryption (disabled by default):

--- AllPagesExample.iss.old   2020-12-19 22:13:15.844179600 +0100
+++ AllPagesExample.iss.new   2020-12-19 22:12:46.413226600 +0100
@@ -18,6 +18,7 @@
LicenseFile=license.txt
#define Password 'password'
Password={#Password}
+Encryption=yes
InfoBeforeFile=readme.txt
UserInfoPage=yes
PrivilegesRequired=lowest


The Observer.pas patch is not exactly the same. The unpacking routine will ask for the password one time when opening the setup and every time when reading a file. But Observer will only provide the password to innounp.so when opening the setup, not when reading files. This patch assures that the already stored password is not overwritten by an empty one.

pepak

Thank you. I will test it today and everything is fine, I will release yet another version.

pepak


Quick Reply

Note: this post will not display until it has been approved by a moderator.

Name:
Email:
Verification:
Please leave this box empty:
Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:
Shortcuts: ALT+S post or ALT+P preview