Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude INIT section from packed executable warning #352

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

omry99
Copy link

@omry99 omry99 commented Aug 31, 2022

Many (non-packed) drivers have a INIT section with the IMAGE_SCN_MEM_WRITE + IMAGE_SCN_MEM_EXECUTE flags.
Therefore, it is not an indication of a packed executable and should be excluded from the warnings.

This can be demonstrated with this code:

import pefile
from pathlib import Path

x=0
for path in Path(r"C:\Windows\System32").rglob('*.sys'):
    pe = pefile.PE(path, fast_load=True)
    for section in pe.sections:
        if section.IMAGE_SCN_MEM_WRITE and section.IMAGE_SCN_MEM_EXECUTE:
            if section.Name.rstrip(b"\x00") == b"INIT" and pe.is_driver():
                x+=1
                print(path.name)

print(f"Number of drivers (falsly) suspected as packed: {x}")

Side note: I have not found any evidence supporting the current exclusion (for the PAGE section).

Many (non-packed) drivers have a INIT section with the IMAGE_SCN_MEM_WRITE + IMAGE_SCN_MEM_EXECUTE flags.
Therefore, it is not an indication of a packed executable and should be excluded from the warnings.

This can be demonstrated with this code:
```python
import pefile
from pathlib import Path

x=0
for path in Path(r"C:\Windows\System32").rglob('*.sys'):
    pe = pefile.PE(path, fast_load=True)
    for section in pe.sections:
        if section.IMAGE_SCN_MEM_WRITE and section.IMAGE_SCN_MEM_EXECUTE:
            if section.Name.rstrip(b"\x00") == b"INIT" and pe.is_driver():
                x+=1
                print(path.name)

print(f"Number of drivers (falsly) suspected as packed: {x}")
```

Side note: I have not found any evidence supporting the current exclusion (for the PAGE section).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant