diff --git a/src/packer.cpp b/src/packer.cpp index 4753e227..15e88f98 100644 --- a/src/packer.cpp +++ b/src/packer.cpp @@ -719,21 +719,19 @@ int Packer::patch_le32(void *b, int blen, const void *old, unsigned new_) { **************************************************************************/ static const char *getIdentstr(unsigned *size, int small) { - // IMPORTANT: we do NOT change "http://upx.sf.net" - static char identbig[] = - "\n\0" - "$Info: " - "This file is packed with the UPX executable packer http://upx.sf.net $" - "\n\0" - "$Id: UPX " UPX_VERSION_STRING4 " Copyright (C) 1996-" UPX_VERSION_YEAR - " the UPX Team. All Rights Reserved. $" - "\n"; - static char identsmall[] = - "\n" - "$Id: UPX " - "(C) 1996-" UPX_VERSION_YEAR " the UPX Team. All Rights Reserved. http://upx.sf.net $" - "\n"; - static char identtiny[] = UPX_VERSION_STRING4; + // Modified to remove UPX detection strings + static char identbig[] = "\n\0" + "$Info: " + "This file is compressed with a binary packer $" + "\n\0" + "$Id: PACKER " UPX_VERSION_STRING4 + " Copyright (C) 1996-" UPX_VERSION_YEAR " Team. All Rights Reserved. $" + "\n"; + static char identsmall[] = "\n" + "$Id: PACK " + "(C) 1996-" UPX_VERSION_YEAR " Team. All Rights Reserved. $" + "\n"; + static char identtiny[] = "PACK"; static upx_std_once_flag init_done; upx_std_call_once(init_done, []() noexcept { diff --git a/src/pefile.cpp b/src/pefile.cpp index f05b387c..affe2eda 100644 --- a/src/pefile.cpp +++ b/src/pefile.cpp @@ -2524,10 +2524,18 @@ void PeFile::pack0(OutputFile *fo, ht &ih, ht &oh, unsigned subsystem_mask, memcpy(&oh, &ih, sizeof(oh)); oh.filealign = oh_filealign; // identsplit depends on this + // Modify timestamp to break compilation date detection + // Timestamp is at offset 8 in the PE header (after magic and machine) + set_le32((byte *) &oh + 8, 0x12345678); + oh.entry = upxsection; oh.objects = oobjs; oh.chksum = 0; + // Modify timestamp to break compilation date detection + // Timestamp is at offset 8 in the PE header (after magic and machine) + set_le32((byte *) &oh + 8, 0x12345678); + // fill the data directory ODADDR(PEDIR_DEBUG) = 0; // dbgCET later ODSIZE(PEDIR_DEBUG) = 0; @@ -2709,6 +2717,12 @@ void PeFile::pack0(OutputFile *fo, ht &ih, ht &oh, unsigned subsystem_mask, fo->write(ibuf, sizeof(LEXX) - ic); fo->write(otls, aligned_sotls); fo->write(oloadconf, soloadconf); + + // Add random padding to break static analysis patterns + for (int i = 0; i < 64; i++) { + byte random_pad = (byte) (rand() % 256); + fo->write(&random_pad, 1); + } if (dbgCET) { ic = fo->getBytesWritten(); dbgCET->fpos = ic + sizeof(*dbgCET);