Plugin Directory

Changeset 3341484


Ignore:
Timestamp:
08/08/2025 09:16:25 AM (8 months ago)
Author:
cloudsecure
Message:

2段階認証機能に関する不具合を修正

Location:
cloudsecure-wp-security/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cloudsecure-wp-security/trunk/cloudsecure-wp.php

    r3332733 r3341484  
    1414 * Plugin URI:    https://wpplugin.cloudsecure.ne.jp/cloudsecure_wp_security
    1515 * Description:   管理画面とログインURLをサイバー攻撃から守る、安心の国産・日本語対応プラグインです。かんたんな設定を行うだけで、不正アクセスや不正ログインからあなたのWordPressを保護し、セキュリティが向上します。また、各機能の有効・無効(ON・OFF)や設定などをお好みにカスタマイズし、いつでも保護状態を管理できます。
    16  * Version:       1.3.16
     16 * Version:       1.3.17
    1717 * Requires PHP:  7.1
    1818 * Author:        CloudSecure,Inc.
  • cloudsecure-wp-security/trunk/modules/cloudsecure-wp.php

    r3317930 r3341484  
    258258
    259259            if ( $this->two_factor_authentication->is_enabled() && 'xmlrpc.php' !== basename( $_SERVER['SCRIPT_NAME'] ) && ! is_admin() ) {
     260                add_filter( 'authenticate', array( $this->two_factor_authentication, 'decode_base64_credentials' ), 0, 3 );
    260261                add_action( 'wp_login', array( $this->two_factor_authentication, 'wp_login' ), 0, 2 );
    261262                add_action( 'wp_login', array( $this->two_factor_authentication, 'redirect_if_not_two_factor_authentication_registered' ), 10, 2 );
  • cloudsecure-wp-security/trunk/modules/two-factor-authentication.php

    r3304559 r3341484  
    1414     */
    1515    private $disable_login;
     16   
     17    /**
     18     * 元の認証情報を保存(Base64デコード済み)
     19     */
     20    private $original_credentials = array();
    1621
    1722    function __construct( array $info, CloudSecureWP_Config $config, CloudSecureWP_Disable_Login $disable_login ) {
     
    150155        if ( ! $secret ) {
    151156            return;
     157        }
     158
     159        // 初回ログイン時に元の認証情報を保存
     160        if ( empty( $this->original_credentials ) ) {
     161            $this->original_credentials['log'] = $user_login;
     162            $this->original_credentials['pwd'] = $_POST['pwd'] ?? '';
    152163        }
    153164
     
    196207        <form name="loginform" id="loginform"
    197208                action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post">
    198             <input type="hidden" name="log" value="<?php echo esc_attr( sanitize_text_field( $_REQUEST['log'] ) ); ?>"/>
    199             <input type="hidden" name="pwd" value="<?php echo esc_attr( sanitize_text_field( $_REQUEST['pwd'] ) ); ?>"/>
     209            <input type="hidden" name="log" value="<?php echo base64_encode( $this->original_credentials['log'] ?? $_REQUEST['log'] ?? '' ); ?>"/>
     210            <input type="hidden" name="pwd" value="<?php echo base64_encode( $this->original_credentials['pwd'] ?? $_REQUEST['pwd'] ?? '' ); ?>"/>
    200211            <?php if ( array_key_exists( 'cloudsecurewp_captcha', $_REQUEST ) ) : ?>
    201212                <input type="hidden" name="cloudsecurewp_captcha"
     
    276287        return $value;
    277288    }
     289
     290    /**
     291     * 2段階認証フォームからのBase64エンコードされた認証情報をデコード
     292     *
     293     * @param mixed $user
     294     * @param string $username
     295     * @param string $password
     296     * @return mixed
     297     */
     298    public function decode_base64_credentials( $user, $username, $password ) {
     299        // 2段階認証フォームからの送信かチェック
     300        if ( ! empty( $_POST['google_authenticator_code'] ) && check_admin_referer( $this->get_feature_key() . '_csrf' ) ) {
     301            // Base64エンコードされた認証情報をデコード
     302            if ( isset( $_POST['log'] ) ) {
     303                $decoded_username = base64_decode( $_POST['log'] );
     304                $this->original_credentials['log'] = $decoded_username;
     305                $_POST['log'] = $decoded_username;
     306            }
     307           
     308            if ( isset( $_POST['pwd'] ) ) {
     309                $decoded_password = base64_decode( $_POST['pwd'] );
     310                $this->original_credentials['pwd'] = $decoded_password;
     311                $_POST['pwd'] = $decoded_password;
     312               
     313                // デコードされたパスワードで認証を実行
     314                return wp_authenticate_username_password( null, $decoded_username, $decoded_password );
     315            }
     316        }
     317       
     318        return $user;
     319    }
    278320}
  • cloudsecure-wp-security/trunk/readme.txt

    r3332733 r3341484  
    44Requires at least: 5.3.15
    55Tested up to: 6.8
    6 Stable tag: 1.3.16
     6Stable tag: 1.3.17
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    107107== Changelog ==
    108108
     109= 1.3.17 =
     110* 2段階認証機能に関する不具合を修正
     111
    109112= 1.3.16 =
    110113* 軽微な修正
Note: See TracChangeset for help on using the changeset viewer.