Skip to content

Fix injection_thread.py #493

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion modules/signatures/windows/injection_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ def __init__(self, *args, **kwargs):
self.targetpid = []

def on_call(self, call, process):
procid = self.get_argument(call, "ProcessId")
procid = int(self.get_argument(call, "ProcessId"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Converting the ProcessId to an integer ensures that the comparison is done numerically rather than lexicographically. This is crucial for the correct logic of the signature. Consider adding a try-except block to handle potential ValueError if the argument is not a valid integer, to prevent the signature from crashing.

        try:
            procid = int(self.get_argument(call, "ProcessId"))
        except ValueError:
            procid = -1  # Or some other default value, and log the error

processid = process["process_id"]

if procid != processid:
if processid not in self.sourcepid and procid not in self.targetpid:
pname = process["process_name"].lower()
Expand Down