1

これが引き起こす可能性のある影響:顧客のセッションと Cookie を盗んだり操作したりする可能性があります。これは正当なユーザーになりすますために使用される可能性があり、ハッカーがユーザー レコードを表示または変更し、そのユーザーとしてトランザクションを実行できるようになります。

セッション固定攻撃を防ぐために推奨される解決策は、ユーザーのログイン時にセッション ID を更新することです。この修正は、セッション管理機能が実装されている場所に応じて、コード レベルまたはフレームワーク レベルで行うことができます。

私はこれに対する修正を見つけようとしていますが、まだ成功していません。Joomla 2.5 でこれを修正する方法を教えてください。

この修正をフレームワーク レベルで実装したいと考えています。どんな助けでも大歓迎です。

4

2 に答える 2

0

Joomla 3.x バージョンでこれを行いました。2.5でも同様のはずです。これを機能させるには、2 つのファイルを変更する必要があります。

  1. ライブラリ/cms/アプリケーション/cms.php

  2. ライブラリ/joomla/session/session.php

cms.php で関数 login を変更します

 // Import the user plugin group.
            JPluginHelper::importPlugin('user');

            if ($response->status === JAuthentication::STATUS_SUCCESS)
            {
                    $session = &JFactory::getSession();
                    // we fork the session to prevent session fixation issues
                    $session->fork();

                    /*
                     * Validate that the user should be able to login (different to being authenticated).
                     * This permits authentication plugins blocking the user.
                     */
                    $authorisations = $authenticate->authorise($response, $options);

session.php で関数 fork() を変更して含める

function fork()
    {
            if( $this->_state !== 'active' ) {
                    // @TODO :: generated error here
                    return false;
            }

            // save values
            $values = $_SESSION;

            // keep session config
            /*$trans        =       ini_get( 'session.use_trans_sid' );
            if( $trans ) {
                    ini_set( 'session.use_trans_sid', 0 );
            } */
            $cookie =       session_get_cookie_params();
            // create new session id
            //$id   =       $this->_createId( strlen( $this->getId() ) );
            session_regenerate_id(true);
            $id = session_id();

            // first we grab the session data
            $data = $this->_store->read($this->getId());

            // kill session
            session_destroy();

            // re-register the session store after a session has been destroyed, to avoid PHP bug
            $this->_store->register();

            // restore config
            ini_set( 'session.use_trans_sid', $trans );
            session_set_cookie_params($cookie['lifetime'], $cookie['path'], $cookie['domain'], $cookie['secure'], true);

            // restart session with new id
            session_id( $id );
            //session_regenerate_id(true);
            session_start();
            $_SESSION = $values;

            //now we put the session data back
            $this->_store->write($id, $data);
            return true;
    }
于 2014-10-02T04:57:17.800 に答える
0

どうもありがとう@ryadavalli!とても助かります。提案されたソリューションを使用して、Joomla 2.5 で解決しました。

わずかな変更のみ。Joomla 2.5 の場合、コードを配置する必要があります

  1. ライブラリ/joomla/application/application.php
  2. ライブラリ/joomla/session/session.php

application.php wrtであなたのソリューション

public function login($credentials, $options = array())
    {
        // Get the global JAuthentication object.
        jimport('joomla.user.authentication');

        $authenticate = JAuthentication::getInstance();
        $response = $authenticate->authenticate($credentials, $options);

        // Import the user plugin group.
        JPluginHelper::importPlugin('user');

        if ($response->status === JAuthentication::STATUS_SUCCESS)
        {
             $session = &JFactory::getSession();
                    // we fork the session to prevent session fixation issues
             $session->fork();
            // validate that the user should be able to login (different to being authenticated)
            // this permits authentication plugins blocking the user
            $authorisations = $authenticate->authorise($response, $options);

session.phpで、コードを次のように更新しました

public function fork()
    {
        if ($this->_state !== 'active')
        {
            // @TODO :: generated error here
            return false;
        }

        // Save values
        $values = $_SESSION;

        // Keep session config
        /*$trans = ini_get('session.use_trans_sid');
        if ($trans)
        {
            ini_set('session.use_trans_sid', 0);
        } */
        $cookie = session_get_cookie_params();

        // Create new session id
        //$id = $this->_createId();

            session_regenerate_id(true);
            $id = session_id();

            // first we grab the session data
            $data = $this->_store->read();

        // Kill session
        session_destroy();

        // Re-register the session store after a session has been destroyed, to avoid PHP bug
        $this->_store->register();

        // Restore config
        ini_set('session.use_trans_sid', $trans);
        session_set_cookie_params($cookie['lifetime'], $cookie['path'], $cookie['domain'], $cookie['secure']);

        // Restart session with new id
        session_id($id);
        session_start();

        $_SESSION = $values;

            //now we put the session data back
            $this->_store->write($id, $data);

        return true;
    }
于 2014-10-06T09:53:43.700 に答える