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

Add coerce_plus Module #300

Merged
merged 13 commits into from
Oct 10, 2024
Merged

Add coerce_plus Module #300

merged 13 commits into from
Oct 10, 2024

Conversation

lodos2005
Copy link
Contributor

I've published the coerce_plus module. I wanted to add the "ms-even" vulnerability as a separate module like the previously submitted "printerbug" vulnerability. However, having a total of 5 modules (petitpotam, dsfcoerce, shadowcoerce, printerbug, and ms-even) felt a bit excessive, especially since some exploits required separate files(project).

Now, we have a single module, coerce_plus, for all 5 coercion methods (petitpotam, dsfcoerce, ms-even, shadowcoerce, and printerbug). This eliminates the need for separate exploit files. The LISTENER parameter should work for all vulnerabilities. I've also added a few extra binding parameters, some of which might be unpatched (😈).

Screenshot 2024-05-14 at 01 18 04 Screenshot 2024-05-14 at 01 17 24

asciicast

@NeffIsBack
Copy link
Contributor

This is really cool! Thanks for the contribution

@mpgn
Copy link
Collaborator

mpgn commented May 14, 2024

Hello, thanks for the PR.

For the always to true I think it's better if by default the module will not try to coerce with every possible methods, during a pentest you usually wants one, having 10 coerce from the same machine doesn't bring any value.

For the other modules (the deleted ones) I think they shouldn't be deleted since it will break previous tutorial, demo, course on nxc. It can be also useful if you only want to coerce using petitpotam for example (which is not possible in this module).

Regards

@lodos2005
Copy link
Contributor Author

I have updated the PR to include a method parameter. Now, users can specify -o METHOD=petitpotam to test only the PetitPotam vulnerability. As a security researcher, I want to see all vulnerabilities on a machine, so setting the default method to all seemed more appropriate. This is especially relevant for clients with a broad scope. By default, the method parameter is set to all, which means all available methods will be tested.

Screenshot 2024-05-14 at 16 41 27

@mpgn
Copy link
Collaborator

mpgn commented May 15, 2024

Nice addition, but it would be better to have the right name for the option imo :)

-METHOD=petitpotam
-METHOD=dfscoerce
-METHOD=printerbug

@lodos2005
Copy link
Contributor Author

Nice addition, but it would be better to have the right name for the option imo :)

-METHOD=petitpotam -METHOD=dfscoerce -METHOD=printerbug

actually i want supports shorthand method names. (is not case-sensitive of course)

For example:
-METHOD=petit
-METHOD=pri
Both work as long as the names match uniquely. Full names are also acceptable. The method is identified by the first matching character.

Additionally, you can use the shorthand -M instead of -METHOD.

-M=p  // Invalid, as both petitpotam and printerbug start with 'p' so modules gives error
-M=pr // Matches printerbug
-M=pe // Matches petitpotam
-M=dfs // Matches dfscoerce

full names are also acceptable and work just as well:

-METHOD=petitpotam
-METHOD=printerbug
-METHOD=shadowcoerce
-METHOD=mseven
-METHOD=shadowcoerce

@mpgn
Copy link
Collaborator

mpgn commented May 15, 2024

aha ok ok ^^

@Marshall-Hallenbeck Marshall-Hallenbeck added this to the v1.3.0 milestone May 17, 2024
@Marshall-Hallenbeck
Copy link
Collaborator

@lodos2005 can you fix the conflicts here? Then I can test and we can get this merged.

@lodos2005 lodos2005 reopened this Jun 18, 2024
@lodos2005
Copy link
Contributor Author

@Marshall-Hallenbeck i guess its fixed.

@NeffIsBack
Copy link
Contributor

I have limited knowledge about RPC, but on my side Coercion with PetitPotam (currently the only one i tested it with) only works against my normal Win 2019 server when setting the auth level to RPC_C_AUTHN_LEVEL_PKT_PRIVACY. Otherwise i am getting STATUS_PIPE_DISCONNECTED.
Does this make sense? Is this a restriction on the server side?
From this article it looks to me like windows server require a higher authentication level. My proposed change would be to set this level for all rpc communication. Thoughts?

Against the DC it works without the auth level though.

@NeffIsBack
Copy link
Contributor

Printerbug&PetitPotam are now working in my Lab. Will test the others soon

@NeffIsBack
Copy link
Contributor

Somehow DFSCoerce does work only without the RPC_C_AUTHN_LEVEL_PKT_PRIVACY flag.
Also added ERROR_BAD_NETPATH to the "success" error message, because this what i get for successful coercion. Working consistent now:
image
image

@NeffIsBack
Copy link
Contributor

Only ShadowCoerce & MSEven missing now :) then we are good to go

@NeffIsBack
Copy link
Contributor

Looks like ShadowCoerce has been patched: https://www.bleepingcomputer.com/news/microsoft/microsoft-quietly-fixes-shadowcoerce-windows-ntlm-relay-bug/
At least even with the original tool i don't get any authentications, although everything looks like it should be working. I will leave it at that

@NeffIsBack
Copy link
Contributor

NeffIsBack commented Aug 25, 2024

For the other modules (the deleted ones) I think they shouldn't be deleted since it will break previous tutorial, demo, course on nxc. It can be also useful if you only want to coerce using petitpotam for example (which is not possible in this module).

@mpgn aggreed, i think we should add the files back, just containing a message "This module moved to the new coerce_plus module" on execution. What do you think?

image

EDIT: Changed the word "DEPRECATED" to "REMOVED" (as this fits better imo)

NeffIsBack
NeffIsBack previously approved these changes Aug 25, 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.

LGTM

Everything works as expected now (couldn't test shadow coerce as it seems to be patched and mseven didn't trigger, but behaved like the method from coercer).

@lodos2005 please retest the module on your side, so we are sure nothing broke during the review. After that we should be good to go

@mpgn
Copy link
Collaborator

mpgn commented Aug 25, 2024

All good for me well done @lodos2005

mpgn
mpgn previously approved these changes Aug 25, 2024
@NeffIsBack NeffIsBack added tested reviewed code Label for when a static code review was done labels Sep 1, 2024
Mercury0 added a commit to Mercury0/NetExec that referenced this pull request Sep 12, 2024
NetExec PR Pennyw0rth#300

Signed-off-by: Mercury0 <mfox05@gmail.com>
@NeffIsBack
Copy link
Contributor

Actually, MSEven worked totally fine, not sure what the problem was the last time i tried:
image

Added 2 more error codes to the code that triggered the coercion

@NeffIsBack NeffIsBack dismissed stale reviews from mpgn and themself via c158995 October 5, 2024 16:22
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.

LGTM now, everything worked as expected (except shadowcoerce but that might by patched by MS)

@NeffIsBack NeffIsBack merged commit 0da4cf8 into Pennyw0rth:main Oct 10, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request new module reviewed code Label for when a static code review was done tested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants