Plugin Directory

Changeset 3286539


Ignore:
Timestamp:
05/02/2025 09:00:32 PM (10 months ago)
Author:
ctltwp
Message:

Fix path traverse issue by replacing '..', '/' in the theme variable

File:
1 edited

Legend:

Unmodified
Added
Removed
  • section-widget/trunk/themes/theme-loader.php

    r3286504 r3286539  
    11<?php
    22
    3 $theme = isset($_GET['theme'])? strtolower(trim($_GET['theme'])) : 'base';
    4 $scope = isset($_GET['scope'])? trim($_GET['scope']) : '';
     3$theme = isset( $_GET['theme'] ) ? strtolower( trim( wp_unslash( $_GET['theme'] ) ) ) : 'base';
     4$scope = isset( $_GET['scope'] ) ? trim( wp_unslash( $_GET['scope'] ) ) : '';
    55
    6 $content = @file_get_contents(SECTION_WIDGET_DIR_PATH . "themes/{$theme}/sw-theme.css");
     6// Remove any path traversal characters.
     7$theme = str_replace( array( '..', '/' ), '', $theme );
     8
     9$content = @file_get_contents(SECTION_WIDGET_DIR_PATH . "/themes/{$theme}/sw-theme.css");
    710
    811if(!$content) {
Note: See TracChangeset for help on using the changeset viewer.