BUGTRAQ ID: 26270
Perdition是一款POP3和IMAP4代理服务器。
Perdition IMAPD的一个IMAP输出字符串格式化函数中存在格式串漏洞,远程攻击者可能利用此漏洞控制服务器。
在某些情况下,未经验证便将IMAP标签(IMAP命令的最初部分)拷贝到了字符缓冲区,然后做为格式串将这个缓冲区传送给了vsnprintf()。在调用vsnprintf之前,执行了以下格式串验证以防范注入:
str.c:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
168: static const char *__str_vwrite(io_t * io, const flag_t flag,
169: const size_t nargs, const char *fmt, va_list ap,
170: int *bytes)
171: {
(...)
186: fmt_args = 0;
187: for (place = 0; fmt[place] != '\0'; place++) {
188: if (fmt[place] == '%')
189: fmt[place + 1] == '%' ? place++ : fmt_args++;
190: }
191: if (fmt_args != nargs) {
(...)
195: VANESSA_LOGGER_DEBUG_UNSAFE("nargs and fmt mismatch: "
196: "%d args requested, %d args in format",
197: nargs, fmt_args);
198: return (NULL);
199: }
200:
201: *bytes = vsnprintf(__str_write_buf, STR_WRITE_BUF_LEN - 2, fmt,
ap);
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
在187-191行,将格式标识符的实际数目与nargs参数中所给出的预期数目做了比较,但可以在IMAP标签的末尾注入空字节来绕过这个检查,空字节会截断字符串的剩余部分,因此可以在IMAP标签中注入nargs任意格式标识符。实际上攻击者仅可以控制单个格式标识符,但仍可以通过写入全局函数指针上的多个连续单字节控制指令指针,导致执行任意代码。
Simon Horman Perdition <=1.17
厂商补丁:
Simon Horman
------------
目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载:
<a href="http://www.vergenet.net/linux/perdition/download/1.17.1/" target="_blank">http://www.vergenet.net/linux/perdition/download/1.17.1/</a>
<a href="http://www.vergenet.net/linux/perdition/download/latest/" target="_blank">http://www.vergenet.net/linux/perdition/download/latest/</a>
暂无评论