new module: mssql > enable_cmdshell
Description
during my engagements, i'm really tired of connecting mssql via impacket-mssqlclient, enable xp_cmdshell, do something, disable xp_cmdshell. so here is a high privilege module that enables or disables xp_cmdshell in mssql.
Type of change
- [x] New feature (non-breaking change which adds functionality)
How Has This Been Tested?
tested against a local fresh mssql server.
Screenshots (if appropriate):
enable:
disable:
Checklist:
- [x] I have ran Ruff against my changes (via poetry:
poetry run python -m ruff check . --preview, use--fixto automatically fix what it can) - [ ] 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)
- [ ] 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
- [ ] I have made corresponding changes to the documentation (PR here: https://github.com/Pennyw0rth/NetExec-Wiki)
Thanks for the PR!
However i am not sure if this would improve NetExec. We already has an automatic check for show advanced options/xp_cmdshell which enables/disables them depending on the state of the DB.
EDIT: However, thanks to your screenshots i found a bug :D gonna fix the checks quick
Fixed the bug in #560
Thanks for the PR! However i am not sure if this would improve NetExec. We already has an automatic check for
show advanced options/xp_cmdshellwhich enables/disables them depending on the state of the DB.EDIT: However, thanks to your screenshots i found a bug :D gonna fix the checks quick
darn, i knew it! if i remember correctly, the -x command option worked without manually enabling xp_cmdshell. then some time after it broke. i thought there would be some bug but i couldn't figured it out, so created this module. :))
you're right about improvement but i think this module can be merged to main. think like a penetration tester found open xp_cmdshells that forgotten to be closed. so a system admin could use this module to bulk disable all xp_cmdshells with ease. or i'm a penetration tester and not sure about all tested xp_cmdshells closed. i can use this module to be sure.
Sounds good :)
Fyi, changed the name of link_enable_xp module to link_enable_cmdshell so that it has the same naming scheme as this module. See https://github.com/Pennyw0rth/NetExec/pull/415#issuecomment-2884655220