Compare commits
2 Commits
12b648b963
...
97566c3344
| Author | SHA1 | Date | |
|---|---|---|---|
| 97566c3344 | |||
| 477535d32d |
2793
should_evade.txt
Normal file
2793
should_evade.txt
Normal file
File diff suppressed because it is too large
Load Diff
@ -951,8 +951,10 @@ void PeFile::addStubImports() {
|
||||
addKernelImport("GetProcAddress");
|
||||
if (!isdll)
|
||||
addKernelImport("ExitProcess");
|
||||
// Add extra dummy import to further break patterns
|
||||
// Add extra dummy imports to further break patterns
|
||||
addKernelImport("GetCurrentProcess");
|
||||
addKernelImport("GetTickCount");
|
||||
addKernelImport("QueryPerformanceCounter");
|
||||
}
|
||||
|
||||
void PeFile::processImports2(unsigned myimport, unsigned) { // pass 2
|
||||
@ -2528,13 +2530,14 @@ void PeFile::pack0(OutputFile *fo, ht &ih, ht &oh, unsigned subsystem_mask,
|
||||
// Timestamp is at offset 8 in the PE header (after magic and machine)
|
||||
set_le32((byte *) &oh + 8, 0x12345678);
|
||||
|
||||
oh.entry = upxsection;
|
||||
oh.entry = upxsection; // Revert entry point randomization
|
||||
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);
|
||||
// Modify PE characteristics flags to break detection patterns
|
||||
// Flags are at offset 22 in PE header
|
||||
LE16 *flags = (LE16 *) ((byte *) &oh + 22);
|
||||
*flags |= 0x0100; // Add IMAGE_FILE_RELOCS_STRIPPED flag
|
||||
|
||||
// fill the data directory
|
||||
ODADDR(PEDIR_DEBUG) = 0; // dbgCET later
|
||||
@ -2638,6 +2641,8 @@ void PeFile::pack0(OutputFile *fo, ht &ih, ht &oh, unsigned subsystem_mask,
|
||||
osection[1].size = (s1size + fam1) & ~fam1;
|
||||
osection[2].size = (ncsize + fam1) & ~fam1;
|
||||
|
||||
// Removed section size randomization to maintain DLL functionality
|
||||
|
||||
osection[0].vsize = osection[1].vaddr - osection[0].vaddr;
|
||||
if (!last_section_rsrc_only) {
|
||||
osection[1].vsize = (osection[1].size + oam1) & ~oam1;
|
||||
@ -2690,6 +2695,8 @@ void PeFile::pack0(OutputFile *fo, ht &ih, ht &oh, unsigned subsystem_mask,
|
||||
if (opt->win32_pe.strip_relocs)
|
||||
oh.flags |= IMAGE_FILE_RELOCS_STRIPPED;
|
||||
|
||||
oh.chksum = 0; // Revert checksum to zero
|
||||
|
||||
ibuf.clear(0, oh.filealign);
|
||||
|
||||
info("Image size change: %u -> %u KiB", ih.imagesize / 1024, oh.imagesize / 1024);
|
||||
@ -2718,11 +2725,7 @@ void PeFile::pack0(OutputFile *fo, ht &ih, ht &oh, unsigned subsystem_mask,
|
||||
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);
|
||||
}
|
||||
// Removed random padding to maintain DLL functionality
|
||||
if (dbgCET) {
|
||||
ic = fo->getBytesWritten();
|
||||
dbgCET->fpos = ic + sizeof(*dbgCET);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user