NetExec icon indicating copy to clipboard operation
NetExec copied to clipboard

New change-password module.

Open KriyosArcane opened this issue 1 year ago • 6 comments

Description

This new module is for changing the password of current user or a target user that is given as option. This is netexec implementation of impacket script changepasswd. No libraries are required except sys for exit.

Type of change

Please delete options that are not relevant.

  • [x] New feature (non-breaking change which adds functionality)

How Has This Been Tested?

I have tested this again a homelab and hackthebox DACL1 Attacks module for ForceChangePassword privilege. Had no issues with any of them.

If you are using poetry, you can easily run tests via: poetry run python tests/e2e_tests.py -t $TARGET -u $USER -p $PASSWORD There are additional options like --errors to display ALL errors (some may not be failures), --poetry (output will include the poetry run prepended), --line-num $START-$END $SINGLE for only running a subset

Screenshots (if appropriate):

Leveraging ForceChangePassword.

Checklist:

  • [x] I have ran Ruff against my changes (via poetry: poetry run python -m ruff check . --preview, use --fix to automatically fix what it can)
  • [x] I have added or updated the tests/e2e_commands.txt file if necessary
  • [x] New and existing e2e tests pass locally with my changes
  • [x] My code follows the style guidelines of this project (should be covered by Ruff above)
  • [x] If reliant on third party dependencies, such as Impacket, dploot, lsassy, etc, I have linked the relevant PRs in those projects
  • [x] I have performed a self-review of my own code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] I have made corresponding changes to the documentation (PR here: https://github.com/Pennyw0rth/NetExec-Wiki)

Only thing left is to edit the wiki.

KriyosArcane avatar Dec 20 '24 04:12 KriyosArcane

Thanks for the PR and editting! I had such a module in mind too. But I think we can develop it in a more effective and versatile way. I think it would be much better if we add impacket's passwd tool, especially in cases of STATUS_PASSWORD_MUST_CHANGE and STATUS_PASSWORD_EXPIRED in SMB. I can help with this if you want.

termanix avatar Dec 20 '24 07:12 termanix

Does FaganAfandiyev your other account?

termanix avatar Dec 20 '24 07:12 termanix

I'm not sure for smb.py for now but we'll see 😁

termanix avatar Jan 06 '25 22:01 termanix

Module is ready to be reviewed :)

KriyosArcane avatar Jan 06 '25 23:01 KriyosArcane

Thanks for the work! We'll review the PR when someone has the time to do so :)

NeffIsBack avatar Jan 07 '25 14:01 NeffIsBack

@KriyosArcane can you add this module to the e2e tests?

Marshall-Hallenbeck avatar Apr 19 '25 21:04 Marshall-Hallenbeck