Jetzt kostenlos Anmelden!

Headless Männlich

... nur noch zur deko

Beiträge: 2 374

Geschlecht: Männlich

Wohnort: Nürnberg

PHPKIT Version: keine

1

Mittwoch, 14. November 2007, 10:29

kleiner SQL Schutz

Original Post von Musel am 18.09.2006 - 03:12
Diskussion:
http://archiv.kit-security.de/include.ph…p&threadid=3417


Wie sich ja die Tage mal wieder herausgestellt hat kann es ja kleinen Dummen kiddys, die eigentlich kein Plan habe gelingen die mysql zugangs Daten zu erhaschen.

Daher kam mir volgende Idee:
Man ändert einfach die Variabeln um, dann ist es nicht mehr möglich über standart Variablen die daten raus zu bekommen.
Wie das geht erkläre ich hier natürlich nicht, also das mit dem herausbekommen.

Hier die Lösungen:

1.6.03:
Natürlich abc in ein eigenden namen ändern, hauptsache man kommt nicht drauf.
z.b blubblub oder moep oder sonst was. Aber nicht euren Nick, Name der Freundin oder sonstigen
einfach Kram der mir hier täglich zu Gesicht kommt.

/admin/config/inc.sql.php
Von:

PHP-Quelltext

1
    $sqlpass="DEINPW";

In:

PHP-Quelltext

1
    $abc="DEINPW";



/admin/lib/lib_mysql.php:

Von:

PHP-Quelltext

1
    var $sqlpass='';

In:

PHP-Quelltext

1
   var $abc='';


Von:

PHP-Quelltext

1
    global $database,$sqlhost,$sqluser,$sqlpass,$db_tab;

In:

PHP-Quelltext

1
    global $database,$sqlhost,$sqluser,$abc,$db_tab;


Von:

PHP-Quelltext

1
    $this->sqlpass=$sqlpass;

In:

PHP-Quelltext

1
    $this->new_sqlpass=$abc;


Von:

PHP-Quelltext

1
    $this->servercon=@mysql_connect($this->sqlhost,$this->sqluser,$this->sqlpass);

In:

PHP-Quelltext

1
    $this->servercon=@mysql_connect($this->sqlhost,$this->sqluser,$this->new_sqlpass);



1.6.1 (Erstell und getestet von Headless)

Also die admin/config/inc.sql.php von:

PHP-Quelltext

1
$sqlpass="...";

in

PHP-Quelltext

1
$abc="...";

ändern.

Die /inc/class/sql.php folgendermaßen ändern:
Ersetze:

PHP-Quelltext

1
2
3
4
5
    var $db_tab=array();
    var $database='';
    var $sqlhost='';
    var $sqluser='';
    var $sqlpass='';

mit:

PHP-Quelltext

1
2
3
4
5
    var $db_tab=array();
    var $database='';
    var $sqlhost='';
    var $sqluser='';
    var $abc='';

[hr]
Ersetze:

PHP-Quelltext

1
2
3
4
5
6
7
8
9
10
    function pkSql() 
        {
        global $database,$sqlhost,$sqluser,$sqlpass,$db_tab;
        
        $this->db_tab=$db_tab;
        $this->database=$database;
        $this->sqlhost=$sqlhost;
        $this->sqluser=$sqluser;
        $this->sqlpass=$sqlpass;
        }


mit:

PHP-Quelltext

1
2
3
4
5
6
7
8
9
10
    function pkSql() 
        {
        global $database,$sqlhost,$sqluser,$abc,$db_tab;
        
        $this->db_tab=$db_tab;
        $this->database=$database;
        $this->sqlhost=$sqlhost;
        $this->sqluser=$sqluser;
        $this->new_sqlpass=$abc;
        }



Und ersetze:

PHP-Quelltext

1
2
        if(!$this->servercon=@mysql_connect($this->sqlhost,$this->sqluser,$this->sqlpass)) 
            $this->servercon=@mysql_connect($this->sqlhost,$this->sqluser,$this->sqlpass);

mit:

PHP-Quelltext

1
2
        if(!$this->servercon=@mysql_connect($this->sqlhost,$this->sqluser,$this->new_sqlpass)) 
            $this->servercon=@mysql_connect($this->sqlhost,$this->sqluser,$this->new_sqlpass);



Für alle Versionen, die auch die Antispam Lösung von OnkelHotte haben:

nospam/makegfx.php

ersetze:

PHP-Quelltext

1
2
3
//DB Connect
$connect = @mysql_connect($sqlhost$sqluser$sqlpass);
$db = @mysql_select_db($database);


mit:

PHP-Quelltext

1
2
3
//DB Connect
$connect = @mysql_connect($sqlhost$sqluser$abc);
$db = @mysql_select_db($database);
  • Zum Seitenanfang
  • Zum Seitenende