Change logic and add blocklist
This commit is contained in:
parent
b69ef84f98
commit
e037cce4ca
2 changed files with 19 additions and 2 deletions
|
|
@ -21,6 +21,10 @@ bool detect_overlaps(zip zip);
|
||||||
bool scan_decoded_files(zip zip);
|
bool scan_decoded_files(zip zip);
|
||||||
bool scan_zip(char* zip_data, int zip_size);
|
bool scan_zip(char* zip_data, int zip_size);
|
||||||
|
|
||||||
|
// todo complete this list
|
||||||
|
static const char* blocklist[] = {"Mimikatz.exe", "linpeas.sh", "winPEAS.bat"};
|
||||||
|
static const int blocklist_size = sizeof(blocklist) / sizeof(char*);
|
||||||
|
|
||||||
static const char* sigs[] = {
|
static const char* sigs[] = {
|
||||||
"\x7f"
|
"\x7f"
|
||||||
"ELF",
|
"ELF",
|
||||||
|
|
|
||||||
|
|
@ -56,9 +56,22 @@ bool scan_decoded_files(zip zip)
|
||||||
// Verify CDH/LFH parsed sizes to avoid undefined behavior
|
// Verify CDH/LFH parsed sizes to avoid undefined behavior
|
||||||
if (lfh->filename_length != zip.cdh_filename_length[i])
|
if (lfh->filename_length != zip.cdh_filename_length[i])
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[ERROR] Mismatch in CDH/LFH filename lengths.\n");
|
fprintf(
|
||||||
|
stderr,
|
||||||
|
"[ERROR] Mismatch in CDH/LFH filename lengths. Local file might be "
|
||||||
|
"malformed.\nSkipping file...\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int k = 0; k < blocklist_size; k++)
|
||||||
|
{
|
||||||
|
char* filename = zip.start + zip.lfh_off[i] + sizeof(LFH);
|
||||||
|
if (strcmp(blocklist[k], filename) == 0)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "[ERROR] Forbidden filename found in zip archive.\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
data* decoded = malloc(sizeof(data));
|
data* decoded = malloc(sizeof(data));
|
||||||
decoded->buffer = decoded->clean = decoded->size = 0;
|
decoded->buffer = decoded->clean = decoded->size = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue