1
0
Fork 0
mirror of https://github.com/atom0s/Steamless.git synced 2024-12-28 23:37:41 +01:00

Unpacker: (variant31.x86) Fixed AES decryption not properly handling the code section, leading to junk data being copied into unpacked file.

Unpacker: (variant31.x86) Fixed AES decryption not properly preserving non-encrypted data.
This commit is contained in:
atom0s 2024-03-29 22:04:56 -07:00
parent 4c2c218a72
commit a278875e1c
No known key found for this signature in database
GPG key ID: 37D5FD3494D79AF8

View file

@ -404,9 +404,9 @@ namespace Steamless.Unpacker.Variant31.x86
this.Log($" --> {codeSection.SectionName} section is encrypted.", LogMessageType.Debug); this.Log($" --> {codeSection.SectionName} section is encrypted.", LogMessageType.Debug);
// Obtain the code section data.. // Obtain the code section data..
var codeSectionData = new byte[codeSection.SizeOfRawData + this.StubHeader.CodeSectionStolenData.Length]; var codeSectionData = new byte[(long)this.StubHeader.CodeSectionRawSize + this.StubHeader.CodeSectionStolenData.Length];
Array.Copy(this.StubHeader.CodeSectionStolenData, 0, codeSectionData, 0, this.StubHeader.CodeSectionStolenData.Length); Array.Copy(this.StubHeader.CodeSectionStolenData, 0, codeSectionData, 0, this.StubHeader.CodeSectionStolenData.Length);
Array.Copy(this.File.FileData, this.File.GetFileOffsetFromRva(codeSection.VirtualAddress), codeSectionData, this.StubHeader.CodeSectionStolenData.Length, codeSection.SizeOfRawData); Array.Copy(this.File.FileData, this.File.GetFileOffsetFromRva(codeSection.VirtualAddress), codeSectionData, this.StubHeader.CodeSectionStolenData.Length, (long)this.StubHeader.CodeSectionRawSize);
// Create the AES decryption helper.. // Create the AES decryption helper..
var aes = new AesHelper(this.StubHeader.AES_Key, this.StubHeader.AES_IV); var aes = new AesHelper(this.StubHeader.AES_Key, this.StubHeader.AES_IV);
@ -417,8 +417,11 @@ namespace Steamless.Unpacker.Variant31.x86
if (data == null) if (data == null)
return false; return false;
// Set the code section override data.. // Merge the code section data into the original..
this.CodeSectionData = data; var sectionData = this.File.SectionData[this.CodeSectionIndex];
Array.Copy(data, sectionData, (long)this.StubHeader.CodeSectionRawSize);
this.CodeSectionData = sectionData;
return true; return true;
} }