|
|
|
@ -469,7 +469,7 @@ int cli_scanpe(int desc, cli_ctx *ctx) |
|
|
|
|
if(DETECT_BROKEN) { |
|
|
|
|
if(ctx->virname) |
|
|
|
|
*ctx->virname = "Broken.Executable"; |
|
|
|
|
return cli_checkfp(desc, ctx) ? CL_CLEAN : CL_VIRUS; |
|
|
|
|
return CL_VIRUS; |
|
|
|
|
} |
|
|
|
|
return CL_CLEAN; |
|
|
|
|
} |
|
|
|
@ -605,7 +605,7 @@ int cli_scanpe(int desc, cli_ctx *ctx) |
|
|
|
|
if(DETECT_BROKEN) { |
|
|
|
|
if(ctx->virname) |
|
|
|
|
*ctx->virname = "Broken.Executable"; |
|
|
|
|
return cli_checkfp(desc, ctx) ? CL_CLEAN : CL_VIRUS; |
|
|
|
|
return CL_VIRUS; |
|
|
|
|
} |
|
|
|
|
if(nsections) |
|
|
|
|
cli_warnmsg("PE file contains %d sections\n", nsections); |
|
|
|
@ -625,7 +625,7 @@ int cli_scanpe(int desc, cli_ctx *ctx) |
|
|
|
|
if(DETECT_BROKEN) { |
|
|
|
|
if(ctx->virname) |
|
|
|
|
*ctx->virname = "Broken.Executable"; |
|
|
|
|
return cli_checkfp(desc, ctx) ? CL_CLEAN : CL_VIRUS; |
|
|
|
|
return CL_VIRUS; |
|
|
|
|
} |
|
|
|
|
return CL_CLEAN; |
|
|
|
|
} |
|
|
|
@ -635,7 +635,7 @@ int cli_scanpe(int desc, cli_ctx *ctx) |
|
|
|
|
if(DETECT_BROKEN) { |
|
|
|
|
if(ctx->virname) |
|
|
|
|
*ctx->virname = "Broken.Executable"; |
|
|
|
|
return cli_checkfp(desc, ctx) ? CL_CLEAN : CL_VIRUS; |
|
|
|
|
return CL_VIRUS; |
|
|
|
|
} |
|
|
|
|
return CL_CLEAN; |
|
|
|
|
} |
|
|
|
@ -648,7 +648,7 @@ int cli_scanpe(int desc, cli_ctx *ctx) |
|
|
|
|
if(DETECT_BROKEN) { |
|
|
|
|
if(ctx->virname) |
|
|
|
|
*ctx->virname = "Broken.Executable"; |
|
|
|
|
return cli_checkfp(desc, ctx) ? CL_CLEAN : CL_VIRUS; |
|
|
|
|
return CL_VIRUS; |
|
|
|
|
} |
|
|
|
|
return CL_CLEAN; |
|
|
|
|
} |
|
|
|
@ -664,7 +664,7 @@ int cli_scanpe(int desc, cli_ctx *ctx) |
|
|
|
|
if(DETECT_BROKEN) { |
|
|
|
|
if(ctx->virname) |
|
|
|
|
*ctx->virname = "Broken.Executable"; |
|
|
|
|
return cli_checkfp(desc, ctx) ? CL_CLEAN : CL_VIRUS; |
|
|
|
|
return CL_VIRUS; |
|
|
|
|
} |
|
|
|
|
cli_dbgmsg("9x compatibility mode\n"); |
|
|
|
|
} |
|
|
|
@ -706,7 +706,7 @@ int cli_scanpe(int desc, cli_ctx *ctx) |
|
|
|
|
if(DETECT_BROKEN) { |
|
|
|
|
if(ctx->virname) |
|
|
|
|
*ctx->virname = "Broken.Executable"; |
|
|
|
|
return cli_checkfp(desc, ctx) ? CL_CLEAN : CL_VIRUS; |
|
|
|
|
return CL_VIRUS; |
|
|
|
|
} |
|
|
|
|
return CL_CLEAN; |
|
|
|
|
} |
|
|
|
@ -787,14 +787,14 @@ int cli_scanpe(int desc, cli_ctx *ctx) |
|
|
|
|
cli_dbgmsg("Bad virtual alignemnt\n"); |
|
|
|
|
if(ctx->virname) |
|
|
|
|
*ctx->virname = "Broken.Executable"; |
|
|
|
|
return cli_checkfp(desc, ctx) ? CL_CLEAN : CL_VIRUS; |
|
|
|
|
return CL_VIRUS; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (DETECT_BROKEN && !native && (!(pe_plus?EC32(optional_hdr64.FileAlignment):EC32(optional_hdr32.FileAlignment)) || (pe_plus?EC32(optional_hdr64.FileAlignment):EC32(optional_hdr32.FileAlignment))%0x200)) { |
|
|
|
|
cli_dbgmsg("Bad file alignemnt\n"); |
|
|
|
|
if(ctx->virname) |
|
|
|
|
*ctx->virname = "Broken.Executable"; |
|
|
|
|
return cli_checkfp(desc, ctx) ? CL_CLEAN : CL_VIRUS; |
|
|
|
|
return CL_VIRUS; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(fstat(desc, &sb) == -1) { |
|
|
|
@ -830,7 +830,7 @@ int cli_scanpe(int desc, cli_ctx *ctx) |
|
|
|
|
if(DETECT_BROKEN) { |
|
|
|
|
if(ctx->virname) |
|
|
|
|
*ctx->virname = "Broken.Executable"; |
|
|
|
|
return cli_checkfp(desc, ctx) ? CL_CLEAN : CL_VIRUS; |
|
|
|
|
return CL_VIRUS; |
|
|
|
|
} |
|
|
|
|
return CL_CLEAN; |
|
|
|
|
} |
|
|
|
@ -899,7 +899,7 @@ int cli_scanpe(int desc, cli_ctx *ctx) |
|
|
|
|
*ctx->virname = "Broken.Executable"; |
|
|
|
|
free(section_hdr); |
|
|
|
|
free(exe_sections); |
|
|
|
|
return cli_checkfp(desc, ctx) ? CL_CLEAN : CL_VIRUS; |
|
|
|
|
return CL_VIRUS; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (exe_sections[i].rsz) { /* Don't bother with virtual only sections */ |
|
|
|
@ -910,7 +910,7 @@ int cli_scanpe(int desc, cli_ctx *ctx) |
|
|
|
|
if(DETECT_BROKEN) { |
|
|
|
|
if(ctx->virname) |
|
|
|
|
*ctx->virname = "Broken.Executable"; |
|
|
|
|
return cli_checkfp(desc, ctx) ? CL_CLEAN : CL_VIRUS; |
|
|
|
|
return CL_VIRUS; |
|
|
|
|
} |
|
|
|
|
return CL_CLEAN; /* no ninjas to see here! move along! */ |
|
|
|
|
} |
|
|
|
@ -929,7 +929,7 @@ int cli_scanpe(int desc, cli_ctx *ctx) |
|
|
|
|
|
|
|
|
|
free(section_hdr); |
|
|
|
|
free(exe_sections); |
|
|
|
|
return cli_checkfp(desc, ctx) ? CL_CLEAN : CL_VIRUS; |
|
|
|
|
return CL_VIRUS; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
@ -945,7 +945,7 @@ int cli_scanpe(int desc, cli_ctx *ctx) |
|
|
|
|
if(DETECT_BROKEN) { |
|
|
|
|
if(ctx->virname) |
|
|
|
|
*ctx->virname = "Broken.Executable"; |
|
|
|
|
return cli_checkfp(desc, ctx) ? CL_CLEAN : CL_VIRUS; |
|
|
|
|
return CL_VIRUS; |
|
|
|
|
} |
|
|
|
|
return CL_CLEAN; |
|
|
|
|
} |
|
|
|
@ -957,7 +957,7 @@ int cli_scanpe(int desc, cli_ctx *ctx) |
|
|
|
|
*ctx->virname = "Broken.Executable"; |
|
|
|
|
free(section_hdr); |
|
|
|
|
free(exe_sections); |
|
|
|
|
return cli_checkfp(desc, ctx) ? CL_CLEAN : CL_VIRUS; |
|
|
|
|
return CL_VIRUS; |
|
|
|
|
} |
|
|
|
|
min = exe_sections[i].rva; |
|
|
|
|
max = exe_sections[i].rva + exe_sections[i].rsz; |
|
|
|
@ -968,7 +968,7 @@ int cli_scanpe(int desc, cli_ctx *ctx) |
|
|
|
|
*ctx->virname = "Broken.Executable"; |
|
|
|
|
free(section_hdr); |
|
|
|
|
free(exe_sections); |
|
|
|
|
return cli_checkfp(desc, ctx) ? CL_CLEAN : CL_VIRUS; |
|
|
|
|
return CL_VIRUS; |
|
|
|
|
} |
|
|
|
|
if(exe_sections[i].rva < min) |
|
|
|
|
min = exe_sections[i].rva; |
|
|
|
@ -988,7 +988,7 @@ int cli_scanpe(int desc, cli_ctx *ctx) |
|
|
|
|
if(DETECT_BROKEN) { |
|
|
|
|
if(ctx->virname) |
|
|
|
|
*ctx->virname = "Broken.Executable"; |
|
|
|
|
return cli_checkfp(desc, ctx) ? CL_CLEAN : CL_VIRUS; |
|
|
|
|
return CL_VIRUS; |
|
|
|
|
} |
|
|
|
|
return CL_CLEAN; |
|
|
|
|
} |
|
|
|
@ -1036,7 +1036,7 @@ int cli_scanpe(int desc, cli_ctx *ctx) |
|
|
|
|
if((((uint32_t)cli_readint32(pt) ^ (uint32_t)cli_readint32(pt + 4)) == 0x505a4f) && (((uint32_t)cli_readint32(pt + 8) ^ (uint32_t)cli_readint32(pt + 12)) == 0xffffb) && (((uint32_t)cli_readint32(pt + 16) ^ (uint32_t)cli_readint32(pt + 20)) == 0xb8)) { |
|
|
|
|
*ctx->virname = "W32.Parite.B"; |
|
|
|
|
free(exe_sections); |
|
|
|
|
return cli_checkfp(desc, ctx) ? CL_CLEAN : CL_VIRUS; |
|
|
|
|
return CL_VIRUS; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1119,7 +1119,7 @@ int cli_scanpe(int desc, cli_ctx *ctx) |
|
|
|
|
if (op==kzdsize+0x48 && *kzcode==0x75 && kzlen-(int8_t)kzcode[1]-3<=kzinitlen && kzlen-(int8_t)kzcode[1]>=kzxorlen) { |
|
|
|
|
*ctx->virname = "W32.Kriz"; |
|
|
|
|
free(exe_sections); |
|
|
|
|
return cli_checkfp(desc, ctx) ? CL_CLEAN : CL_VIRUS; |
|
|
|
|
return CL_VIRUS; |
|
|
|
|
} |
|
|
|
|
cli_dbgmsg("kriz: loop out of bounds, corrupted sample?\n"); |
|
|
|
|
kzstate++; |
|
|
|
@ -1146,7 +1146,7 @@ int cli_scanpe(int desc, cli_ctx *ctx) |
|
|
|
|
if(cli_memstr(buff, 4091, "\xe8\x2c\x61\x00\x00", 5)) { |
|
|
|
|
*ctx->virname = dam ? "W32.Magistr.A.dam" : "W32.Magistr.A"; |
|
|
|
|
free(exe_sections); |
|
|
|
|
return cli_checkfp(desc, ctx) ? CL_CLEAN : CL_VIRUS; |
|
|
|
|
return CL_VIRUS; |
|
|
|
|
}
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1158,7 +1158,7 @@ int cli_scanpe(int desc, cli_ctx *ctx) |
|
|
|
|
if(cli_memstr(buff, 4091, "\xe8\x04\x72\x00\x00", 5)) { |
|
|
|
|
*ctx->virname = dam ? "W32.Magistr.B.dam" : "W32.Magistr.B"; |
|
|
|
|
free(exe_sections); |
|
|
|
|
return cli_checkfp(desc, ctx) ? CL_CLEAN : CL_VIRUS; |
|
|
|
|
return CL_VIRUS; |
|
|
|
|
}
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1216,7 +1216,7 @@ int cli_scanpe(int desc, cli_ctx *ctx) |
|
|
|
|
*ctx->virname = "W32.Polipos.A"; |
|
|
|
|
free(jumps); |
|
|
|
|
free(exe_sections); |
|
|
|
|
return cli_checkfp(desc, ctx) ? CL_CLEAN : CL_VIRUS; |
|
|
|
|
return CL_VIRUS; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
free(jumps); |
|
|
|
@ -1242,7 +1242,7 @@ int cli_scanpe(int desc, cli_ctx *ctx) |
|
|
|
|
if (ret != CL_CLEAN) { |
|
|
|
|
free(exe_sections); |
|
|
|
|
if(ret == CL_VIRUS) |
|
|
|
|
return cli_checkfp(desc, ctx) ? CL_CLEAN : CL_VIRUS; |
|
|
|
|
return CL_VIRUS; |
|
|
|
|
return ret; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|