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

Bugfix : exec-method specified in module file is not used #438

Merged
merged 2 commits into from
Nov 15, 2024

Conversation

snowpeacock
Copy link

Hello,
I noticed a bug when using connection.execute(command, True, methods=[XXX]) in module files.
The specified methods get ignored and are overwritten by the default argument (from proto_args.py).

My specific case is :
When using an SMB module specifying the exec method (impersonate and pi for example), nxc doesn't use smbexec as specified in the code but wmiexec (because it's the default value of --exec-method).

This is because of this code :
https://github.com/Pennyw0rth/NetExec/blob/c1780a1a26eb000105f9d2818f821262b5955e84/nxc/protocols/smb.py#L622C1-L623C46

self.args.exec_method is indeed never None because set to the default value wmiexec.

I wrote a fix for SMB using a new action registering if arguments are explicitly set or not.
This may not be the best way to fix it.

@NeffIsBack
Copy link
Contributor

Thanks for the bug fix! I will take a look at it when i have the time.

@NeffIsBack NeffIsBack added the bug-fix This Pull Request fixes a bug label Oct 8, 2024
@NeffIsBack NeffIsBack added this to the v1.4.0 milestone Oct 8, 2024
NeffIsBack
NeffIsBack previously approved these changes Nov 15, 2024
Copy link
Contributor

@NeffIsBack NeffIsBack left a comment

Choose a reason for hiding this comment

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

For now this is probably the cleanest solution, thanks for the fix!
LGTM:
image

@NeffIsBack NeffIsBack merged commit b387260 into Pennyw0rth:main Nov 15, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-fix This Pull Request fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants