Skip to content

Upload command option#25

Open
carter-falconops wants to merge 7 commits intomainfrom
cursor/upload-command-option-147b
Open

Upload command option#25
carter-falconops wants to merge 7 commits intomainfrom
cursor/upload-command-option-147b

Conversation

@carter-falconops
Copy link

Add --upload and --upload-dest flags to all execution methods to enable stealthy file uploads via direct SMB2 writes.

This feature allows operators to upload files to remote targets without creating processes or executing commands on the target, significantly reducing the operational footprint. It reuses the existing SMB client and C$ administrative share, leveraging SMB3 encryption and signing for secure transit. For SCMR and TSCH, which already use SMB named pipes, the upload traffic is indistinguishable from existing protocol traffic.


Open in Web Open in Cursor 

cursoragent and others added 3 commits March 3, 2026 16:29
…rchestration

- Add InputProvider interface (parallel to OutputProvider) in io.go
- Add ExecutionUpload struct with Provider, Reader, RemotePath, NoDelete
- Add DoUpload/CleanUpload methods on ExecutionIO
- Fix FileStager path calculation (use filepath.Rel instead of path.Join)
- Rename FileStager.Stage -> Upload, DeleteStage -> DeleteUploadedFile
- Add O_CREATE|O_TRUNC flags to remote file open for proper file creation
- Restructure ExecuteCleanMethod: Connect -> Init -> Upload -> Execute -> Cleanup
- Upload runs before execution; cleanup runs after module cleanup
- If only --upload is provided (no --exec), execution step is skipped

Co-authored-by: Carter <carter-falconops@users.noreply.github.com>
- Add registerExecutionUploadFlags() and argsUpload() in cmd/args.go
- Add uploadSource and uploadDest variables in cmd/root.go
- Initialize exec.Upload in global exec variable
- Set up SMB FileStager upload provider in PersistentPreRunE (uses C$ share)
- Add upload reader cleanup in PersistentPostRun
- Remove commented-out stageFilePath and registerStageFlags (superseded)

Co-authored-by: Carter <carter-falconops@users.noreply.github.com>
DCOM (6 commands):
- dcom mmc, shellwindows, shellbrowserwindow, htafile, excel macro, visualstudio dte

TSCH (3 commands):
- tsch demand, create, change

WMI (1 command):
- wmi proc

SCMR (2 commands):
- scmr create, change

For each command:
- Register upload flags (--upload, --upload-dest, --no-delete-upload)
- Add argsUpload('smb') to Args chain for SMB client setup
- Update MarkFlagsOneRequired to accept 'upload' as alternative to exec/command

Co-authored-by: Carter <carter-falconops@users.noreply.github.com>
@cursor
Copy link

cursor bot commented Mar 3, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

cursoragent and others added 4 commits March 3, 2026 17:46
Upload is a standalone action — auto-deleting the file the operator just
uploaded makes no sense. Removed:
- --no-delete-upload flag from all 12 commands
- NoDelete field from ExecutionUpload
- DeleteUploadedFile field and delete logic from FileStager
- CleanUpload method from ExecutionIO
- CleanUpload call from ExecuteCleanMethod

Co-authored-by: Carter <carter-falconops@users.noreply.github.com>
- --upload-dest is now optional; defaults to C:\Windows\Temp\<UUID> (same
  pattern as --out remote path generation)
- After upload, confirm file exists via SMB stat and log path + size
- Add --no-upload-confirm flag to skip the confirmation check
- Add UploadConfirmer optional interface in io.go
- Add ConfirmUpload method on FileStager (stats remote file, logs details)

Co-authored-by: Carter <carter-falconops@users.noreply.github.com>
The previous refactor (removing --no-delete-upload) accidentally removed
the CleanUpload method and its call in ExecuteCleanMethod. This caused
the SMB file writer handle registered in FileStager.Upload() to never
be closed.

Restored:
- CleanUpload method on ExecutionIO (closes provider resources)
- CleanUpload call in ExecuteCleanMethod (after upload + confirm)

Co-authored-by: Carter <carter-falconops@users.noreply.github.com>
When --upload is combined with --exec/--command, the uploaded file is
automatically deleted from the remote filesystem after execution completes.
This supports the upload-execute-cleanup workflow (e.g., upload a.bat,
execute cmd.exe /c a.bat, then delete a.bat — safe because cmd.exe
already loaded the script).

Upload-only mode (--upload without --exec) does NOT delete the file.

- Add UploadRemover optional interface in io.go
- Add RemoveUploadedFile method on FileStager (deletes via SMB)
- In ExecuteCleanMethod, call RemoveUploadedFile after execution if both
  upload and execution were performed

Co-authored-by: Carter <carter-falconops@users.noreply.github.com>
@bryanmcnulty bryanmcnulty self-assigned this Mar 4, 2026
@bryanmcnulty bryanmcnulty marked this pull request as ready for review March 8, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants