OpenBSD IPv6报文处理远程内核结构破坏指令执行漏洞
发布日期:2007-03-09
更新日期:2007-03-14
受影响系统:OpenBSD OpenBSD 4.1 < 2007.02.26
OpenBSD OpenBSD 4.0 Stable
OpenBSD OpenBSD 4.0 Current
OpenBSD OpenBSD 4.0
OpenBSD OpenBSD 3.9
OpenBSD OpenBSD 3.8
OpenBSD OpenBSD 3.6
OpenBSD OpenBSD 3.1
描述:
BUGTRAQ  ID: 
22901
CVE(CAN) ID: 
CVE-2007-1365
OpenBSD是一款开放源代码Unix类操作系统。
OpenBSD在处理畸形IPv6协议报文时存在漏洞,远程攻击者可能利用此漏洞导致拒绝服务或执行任意指令。
如果远程攻击者向OpenBSD发送了特制的碎片ICMPv6报文的话,就可以触发mbuf内核内存管理结构中的堆溢出,导致执行任意内核态代码或拒绝服务。被溢出的结构在/sys/mbuf.h中定义如下:
struct mbuf {
  struct  m_hdr m_hdr;
  union {
  struct {
  struct  pkthdr MH_pkthdr;       /* M_PKTHDR set */
  union {
  struct  m_ext MH_ext;   /* M_EXT set */
  char    MH_databuf[MHLEN];
  } MH_dat;
  } MH;
  char    M_databuf[MLEN];                /* !M_PKTHDR, !M_EXT */
  } M_dat;
  };
可见mbuf包含有另一个m_ext类型结构(/sys/mbuf.h):
/* description of external storage mapped into mbuf, valid if M_EXT set */
  struct m_ext {
  caddr_t ext_buf;                /* start of buffer */
  /* free routine if not the usual */
  void    (*ext_free)(caddr_t, u_int, void *);
  void    *ext_arg;               /* argument for ext_free */
  u_int   ext_size;               /* size of buffer, for ext_free */
  int     ext_type;
  struct mbuf *ext_nextref;
  struct mbuf *ext_prevref;
  #ifdef DEBUG
  const char *ext_ofile;
  const char *ext_nfile;
  int ext_oline;
  int ext_nline;
  #endif
  };
第二个结构中包含有ext_free变量,这是在释放mbuf时所调用的函数指针。如果使用特制的精心构造的分片IPv6报文覆盖了mbuf的话,攻击者就可以在系统调用m_freem()函数时控制OpenBSD内核的执行流。
此外,由于mbuf存储在了链表中,另一种攻击方式就是覆盖ext_nextref和ext_prevref指针,导致向内核内存的可控制区写入32位数据,类似于用户态堆覆盖攻击。
<*来源:Alfredo Ortega
        Mario Vilas
        Gerardo Richarte
  
  链接:
http://www.coresecurity.com/?action=item&id=1703
*>
测试方法:
警  告
以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!
http://www.coresecurity.com/?action=item&id=1703建议:
临时解决方法:
* 使用OpenBSD的防火墙阻断所有入站的IPv6报文。向/etc/pf.conf文件中添加以下行:
block in quick inet6 all
之后应使用以下命令加载所添加的行:
pfctl -f /etc/pf.conf
如果要启用PF:
pfctl -e -f /etc/pf.conf
如果要检查PF的状态并列出所有加载的规则:
pfctl -s rules
厂商补丁:
OpenBSD
-------
目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载:
ftp://ftp.openbsd.org/pub/OpenBSD/patches/4.0/common/010_m_dup1.patch浏览次数:4729
严重程度:0(网友投票)