CoreHTTP CGI支持远程命令执行漏洞

- AV AC AU C I A
发布: 2025-04-13
修订: 2025-04-13

BUGTRAQ ID: 37454 CoreHTTP是一款小型的Web服务器。 CoreHTTP服务器的http.c文件没有正确的过滤用户输入便调用了popen(),这允许攻击者使用标准的Web浏览器执行任意命令: /* escape the url for " and \ since we use it in popen */ for (i = 0; i < PATHSIZE; i++) { if (url[i] == '\0') break; else if (url[i] == '\\' || url[i] == '\"' || url[i] == '\'') { find = url + i; strcpy(temp, find); *find = '\\'; *(find+1) = '\0'; strcat(url, temp); i++; } } 上面的代码仅转义了“"”和“\”,用户可以指定“|”、“`”、“&”等特殊格式字符。之后URL拆分为了两部分: - url - args 这里有些限制: if (c == 0) { /* TODO our dirlist perl script takes the path of the dir as the arg. the way we do cgi right now is scipt.pl?arg turns into commandprompt> ./script.pl arg. obviously when urlencode is implemented correctly this must be changed. */ strcpy(args, url); strcpy(url, DIRLIST); break; } 可见DIRLIST覆盖了url的值,url覆盖了args的值,因此简单的目录列表操作就会导致很难利用这个漏洞。 最终是对popen的调用: } else if (cmd[0] != '\0') { /* if its dynamic content */ pipe(pipefd); /* make pipe then fork */ c = fork(); if (c > 0) { /* original, keep...

0%
暂无可用Exp或PoC
当前有0条受影响产品信息