Plugin Directory

Changeset 3275878


Ignore:
Timestamp:
04/17/2025 01:41:36 PM (10 months ago)
Author:
momen2009
Message:

脆弱性の指摘を受けたの修正をした。(クロスサイトスクリプティングの脆弱性)

Location:
theme-changer
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • theme-changer/trunk/readme.txt

    r1688120 r3275878  
    33Tags: theme,change,get,parameter,demo
    44Requires at least: 3.0
    5 Tested up to: 4.8
    6 Stable tag: 1.3
     5Tested up to: 6.8
     6Stable tag: 1.4
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3939= 1.3 =
    4040* Fixed a problem where the theme returns to the original when transitioning to the lower page. Once the password matched, the modified theme was applied even to the lower page.
     41
     42= 1.4 =
     43* Cross-site scripting vulnerability response.
  • theme-changer/trunk/theme-changer.php

    r1688120 r3275878  
    44Plugin URI: http://www.elegants.biz/theme-changer.php
    55Description: Easy theme change in the get parameter. this to be a per-session only change, and one that everyone (all visitors) can use. I just enter the following URL. It's easy. e.g. http://wordpress_install_domain/?theme_changer=theme_folder_name
    6 Version: 1.3
     6Version: 1.4
    77Author: momen2009
    8 Author URI: http://www.elegants.biz/
    98License: GPLv2 or later
    109*/
    1110
    12 /*  Copyright 2017 木綿の優雅な一日 (email : [email protected])
     11/*  Copyright 2025 momen2009 (email : [email protected])
    1312
    1413This program is free software; you can redistribute it and/or modify
     
    4342    global $theme_changer_theme;
    4443    $theme_changer_password = get_option("theme_changer_password");
     44
     45    $theme_changer = "";
    4546    if($theme_changer_password != false){
    4647        $now_theme = wp_get_theme();
     
    5051            if($_SESSION["theme_changer_password"] != $theme_changer_password) return;
    5152        }else{
    52             if($theme_changer_password != $wpdb->escape($_GET["theme_changer_password"])){
     53            if(!isset($_GET["theme_changer_password"])) return;
     54            if($theme_changer_password != sanitize_text_field(wp_unslash($_GET["theme_changer_password"]))){
    5355                return;
    5456            }else{
     
    5860    }
    5961
    60     $theme_changer = $wpdb->escape($_GET["theme_changer"]);
     62    if(isset($_GET["theme_changer"])){
     63        $theme_changer = sanitize_text_field(wp_unslash($wpdb->escape($_GET["theme_changer"])));
     64    }
    6165    if(isset($theme_changer) && $theme_changer != ""){
    62         $theme_changer = $wpdb->escape($_GET["theme_changer"]);
     66
    6367    }elseif(isset($_SESSION["theme_changer"])){
    64         $theme_changer = $_SESSION["theme_changer"];
     68        $theme_changer = sanitize_text_field($_SESSION["theme_changer"]);
    6569    }
    6670    if($value = exist_search_theme($theme_changer)){
     
    7175
    7276function exist_search_theme($stylesheet){
    73     foreach(get_themes() as $value){
     77    foreach(wp_get_themes() as $value){
    7478        if($value->get_stylesheet() == $stylesheet) return $value;
    7579    }
     
    108112function theme_changer_footer() {
    109113    global $theme_changer_theme;
    110     $output .= "<style>\r\n#theme_changer{z-index:1000 !important;position:fixed;padding:10px;bottom:10px;left:10px;opacity:0.2;}#theme_changer label {color: #333 !important;display: block !important;font-weight: 800 !important;margin-bottom: 0.5em !important;font-family: 'Hiragino Kaku Gothic Pro', Meiryo, sans-serif !important;font-size: 16px !important;}#theme_changer select {font-weight:normal !important;font-size: 16px !important;color: #333 !important;border: 1px solid #bbb !important;-webkit-border-radius: 3px !important;border-radius: 3px !important;height: 3em !important;max-width: 100% !important;}#theme_changer p {font-size: 9px;}</style><script>jQuery(document).ready(function(){jQuery('#theme_changer select').change(function() {if (jQuery(this).val() != '') {";
     114
     115    $output = "<style>\r\n#theme_changer{z-index:1000 !important;position:fixed;padding:10px;bottom:10px;left:10px;opacity:0.2;}#theme_changer label {color: #333 !important;display: block !important;font-weight: 800 !important;margin-bottom: 0.5em !important;font-family: 'Hiragino Kaku Gothic Pro', Meiryo, sans-serif !important;font-size: 16px !important;}#theme_changer select {font-weight:normal !important;font-size: 16px !important;color: #333 !important;border: 1px solid #bbb !important;-webkit-border-radius: 3px !important;border-radius: 3px !important;height: 3em !important;max-width: 100% !important;}#theme_changer p {font-size: 9px;}</style><script>jQuery(document).ready(function(){jQuery('#theme_changer select').change(function() {if (jQuery(this).val() != '') {";
    111116    $output .= "var kvp2; kvp2 = insertParameter(document.location.search.substr(1).split('&'),'theme_changer',jQuery(this).val());";
    112     $theme_changer_password = get_option("theme_changer_password");
     117    $theme_changer_password = sanitize_text_field(wp_unslash(get_option("theme_changer_password")));
    113118    if($theme_changer_password != false){
    114119        $output .= "kvp2 = insertParameter(kvp2.split('&'),'theme_changer_password','" . $theme_changer_password . "');";
     
    121126    foreach(wp_get_themes() as $value){
    122127        $output .= "<option value=\"";
    123         $output .= $value -> get_stylesheet();
     128        $output .= sanitize_text_field(wp_unslash($value -> get_stylesheet()));
    124129        $output .= "\"";
    125130        if($value -> get_stylesheet() == $theme_changer_theme){
     
    127132        }
    128133        $output .= ">";
    129         $output .= $value -> Name;
     134        $output .= sanitize_text_field(wp_unslash($value -> Name));
    130135        $output .= "</option>";
    131136    }
    132137    $output .= "<select><p>This will only be displayed if you are logged in.</p></div>');</script>";
    133     echo $output;
     138    _e($output);
    134139}
    135140
     
    142147function theme_changer_options() {
    143148    if ( !current_user_can( 'manage_options' ) )  {
    144         wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
     149        wp_die( esc_html(__( 'You do not have sufficient permissions to access this page.' )) );
    145150    }
    146151
    147152    if (isset($_POST['theme_changer_password'])) {
    148         update_option('theme_changer_password', wp_unslash($_POST['theme_changer_password']));
     153        update_option('theme_changer_password', sanitize_text_field(wp_unslash($_POST['theme_changer_password'])));
    149154    }
    150155?>
     
    168173<?php
    169174}
     175
     176function theme_changer_files() {
     177    wp_enqueue_script('jquery');
     178}
     179add_action( 'wp_enqueue_scripts', 'theme_changer_files' );
    170180?>
Note: See TracChangeset for help on using the changeset viewer.