修复10个代码缺陷: panic防护, 死锁, 密钥泄漏, 错误吞没

- eval_random: randomInt参数max<=min时不再panic,返回CEL错误
- scanner: 长驻插件nil/panic时兜底发送ready通道,消除死锁
- poc_executor: Ceye API密钥改为环境变量CEYE_API/CEYE_DOMAIN
- Eval: ParseResponse加入oResp.Request nil检查
- Eval: reverseCheck中http.NewRequest错误不再忽略
- poc_executor: clusterpoc中CEL表达式求值错误记录日志
- winwmi: PowerShell执行失败完整记录错误信息
- sshkey: authorized_keys读取失败处理错误
- minidump: Scan结束后释放系统DLL句柄
- Windows插件: PE文件错误消息改用i18n
This commit is contained in:
ZacharyZcR
2026-05-18 03:47:42 +08:00
parent 2f2b30763c
commit c266912dcb
16 changed files with 88 additions and 31 deletions
+17 -6
View File
@@ -6,6 +6,7 @@ import (
"math/rand" //nolint:gosec // G404: math/rand用于生成测试数据,非加密用途
"net/http"
"net/url"
"os"
"regexp"
"strings"
"sync"
@@ -19,11 +20,18 @@ import (
exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1"
)
// API配置常量
const (
ceyeAPI = "a78a1cb49d91fe09e01876078d1868b2" // Ceye平台的API密钥
ceyeDomain = "7wtusr.ceye.io" // Ceye平台的域名
)
// Ceye平台凭据(通过环境变量配置,避免将密钥硬编码在源码中)
// CEYE_API: Ceye API令牌
// CEYE_DOMAIN: Ceye平台域名(可选,默认使用api.ceye.io
var ceyeAPI, ceyeDomain string
func init() {
ceyeAPI = os.Getenv("CEYE_API")
ceyeDomain = os.Getenv("CEYE_DOMAIN")
if ceyeDomain == "" {
ceyeDomain = "api.ceye.io"
}
}
// Task 定义单个POC检测任务的结构体
type Task struct {
@@ -480,7 +488,10 @@ func clusterpoc(oReq *http.Request, p *Poc, variableMap map[string]interface{},
if key == "payload" {
payloadExpr = expr
}
output, _ := evalset1(env, variableMap, key, expr)
output, err := evalset1(env, variableMap, key, expr)
if err != nil {
common.LogError(i18n.Tr("webscan_set_exec_error", key, err))
}
payloads[key] = output
}