Likes Likes:  0
Resultaten 1 tot 2 van de 2
Geen
  1. #1
    ghc@ghc.ru
    PHPNews SQL injection vulnerability
    Gast
    n/a Berichten
    Berichten zijn liked



    Thread Starter

    PHPNews SQL injection vulnerability

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Product: PHPNews
    Version: 1.2.5 Release, bugfix 1.2.6 (and previous)
    URL: http://newsphp.sourceforge.net/
    VULNERABILITY CLASS: SQL injection
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    [PRODUCT DESCRIPTION]
    PHPNews is a popular script for news posting written in PHP (MySQL based).

    [VULNERABILITY]

    Vulnerable script: auth.php

    Code:
    else if(isset($_POST['user']) && isset($_POST['password']))
    {
    $in_user = $_POST['user'];         // <-- not filtered
    $in_password = $_POST['password'];
    }
    
    $result = mysql_query('SELECT * FROM ' . $db_prefix . 'posters WHERE username = \'' . $in_user . '\' AND password = password(\'' . $in_password . '\')');
    $dbQueries++;
    
    if(mysql_numrows($result) != 0)
    {
    $auth = true;
    $_SESSION['user'] = $in_user;
    $_SESSION['password'] = $in_password;
    }
    In case magic_quotes_gpc=0, an attacker can inject SQL statements through $_POST['user'] parameter.

    Example of exploitation:
    In the login form type "whatever' or '1'='1'/*" in the "Username" field and
    "whatever" in the "Password" field (without double quotes).
    Or just use "admin'/*" as username (where "admin" - is real login name of administrator).

    Possible scenario of attack. Attacker can:
    [1] log in admin panel, using SQL injection
    [2] upload PHP file through "Upload Images" function (index.php?action=images) and have fun with php shell
    or edit template (index.php?action=modtemp) and put backdoor code into it.


    [Bugfix]:

    Code:
    $in_user = $_POST['user'];
    replace with:

    Code:
    if (!get_magic_quotes_gpc())  {$in_user=addslashes($_POST['user']);}
    else {$in_user = $_POST['user']; }
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    [CREDITS]
    RST/GHC
    http://www.ghc.ru
    http://rst.void.ru
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  2. #2
    foster@ghc.ru
    PHPNews SQL injection vulnerability
    Gast
    n/a Berichten
    Berichten zijn liked



    Thread Starter

    Re: PHPNews SQL injection vulnerability

    by the way, to fix vulbnerability, you need to
    addslashes() $_POST['password'] variable to.

Webhostingtalk.nl

Contact

  • Rokin 113-115
  • 1012 KP, Amsterdam
  • Nederland
  • Contact
© Copyright 2001-2026 Webhostingtalk.nl.
Web Statistics