Plugin Directory

Changeset 3347711


Ignore:
Timestamp:
08/20/2025 06:47:04 PM (6 months ago)
Author:
benbeecroft
Message:

PowerPress 11.13.8

Location:
powerpress/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • powerpress/trunk/powerpress.php

    r3339176 r3347711  
    44Plugin URI: https://blubrry.com/services/powerpress-plugin/
    55Description: <a href="https://blubrry.com/services/powerpress-plugin/" target="_blank">Blubrry PowerPress</a> is the No. 1 Podcasting plugin for WordPress. Developed by podcasters for podcasters; features include Simple and Advanced modes, multiple audio/video player options, subscribe to podcast tools, podcast SEO features, and more! Fully supports Apple Podcasts (previously iTunes), Google Podcasts, Spotify, and Blubrry Podcasting directories, as well as all podcast applications and clients.
    6 Version: 11.13.7
     6Version: 11.13.8
    77Author: Blubrry
    88Author URI: https://blubrry.com/
     
    133133
    134134// WP_PLUGIN_DIR (REMEMBER TO USE THIS DEFINE IF NEEDED)
    135 define('POWERPRESS_VERSION', '11.13.7' );
     135define('POWERPRESS_VERSION', '11.13.8' );
    136136
    137137// Translation support:
     
    14931493                echo "\t<podcast:location";
    14941494
    1495                 if( !is_array($Feed['pci_geo']) && !empty($Feed['pci_geo']) ) {
     1495                if( !empty($Feed['pci_geo']) && !is_array($Feed['pci_geo']) ) {
    14961496                    echo " geo=\"" . htmlspecialchars($Feed['pci_geo']) . "\"";
    14971497                }
    1498                 if( !is_array($Feed['pci_osm']) && !empty($Feed['pci_osm']) ) {
     1498                if( !empty($Feed['pci_osm']) && !is_array($Feed['pci_osm']) ) {
    14991499                    echo " osm=\"" . htmlspecialchars($Feed['pci_osm']) . "\"";
    15001500                }
  • powerpress/trunk/powerpressadmin-metabox.php

    r3333112 r3347711  
    10551055
    10561056                    <div class="table table-heading"  id="<?php echo $FeedSlug; ?>-chapter-builder">
    1057                         <div style="padding-left: 25px; padding-right: 15px; width: 80%;" class="row">
     1057                        <div style="padding-left: 25px; padding-right: 15px;" class="row">
    10581058                            <div class="col" style="font-weight: bold; font-size: 115%; width: 100px;"><?php echo esc_html(__('Start Time', 'powerpress')); ?></div>
    10591059                            <div class="col-sm-3" style="font-weight: bold; font-size: 115%;"><?php echo esc_html(__('Title', 'powerpress')); ?></div>
  • powerpress/trunk/powerpressadmin.php

    r3339176 r3347711  
    24842484                    {
    24852485                        if (!empty($Powerpress['url']) ) {
    2486                             $media_hostname = $UrlParts['host'];
    2487                             $ip = gethostbyname($media_hostname);
    2488                             if (in_array($media_hostname, array('0.0.0.0', '127.0.0.1', 'localhost', '[::]', '0x7f000001/', '0xc0a80014/')) ||
    2489                                 filter_var($media_hostname, FILTER_VALIDATE_IP) ||
    2490                                 !preg_match('/^[a-zA-Z.\-\d]+$/i', $media_hostname) ||
    2491                                 ( empty($GeneralSettings['powerpress_self_hosted_media']) && in_array(strtolower($ip), array('0.0.0.0', '127.0.0.1', 'localhost', '[::]', '0x7f000001/', '0xc0a80014/')) ) ||
    2492                                 ( empty($GeneralSettings['powerpress_self_hosted_media']) && !IPAddressIsPublic($ip) )
    2493                             ) {
    2494                                 // they have already seen the invalid url message on verify--no media check!
    2495                             } else {
     2486                            if (SSRFCheck($Powerpress['url'], $feed_slug)) {
    24962487                                if (empty($Powerpress['set_duration']))
    24972488                                    $MediaInfo = powerpress_get_media_info_local($MediaURL, $ContentType, 0, '');
     
    25572548                        if (!empty($MediaURL)) {
    25582549                            if ($alt_enclosure_data['hosting'] == 0) { // entered a full URL, ssrf check
    2559                                 $UrlParts = parse_url($MediaURL);
    2560                                 $media_hostname = $UrlParts['host'];
    2561                                 $ssrf_valid = true;
    2562                                 if (in_array($media_hostname, array('0.0.0.0', '127.0.0.1', 'localhost', '[::]', '0x7f000001/', '0xc0a80014/')) || filter_var($media_hostname, FILTER_VALIDATE_IP) || !preg_match('/^[a-zA-Z.\-\d]+$/i', $media_hostname)) {
    2563                                     $error = __('Invalid alternate enclosure url. Please ensure that your url is formatted correctly, e.g https://example.com/file.mp3.', 'powerpress');
    2564                                     powerpress_add_error($error);
    2565                                     $ssrf_valid = false;
    2566                                 }
    2567                                 // check IP for hostname is not localhost
    2568                                 $ip = gethostbyname($media_hostname);
    2569                                 if (empty($GeneralSettings['powerpress_self_hosted_media']) && in_array(strtolower($ip), array('0.0.0.0', '127.0.0.1', 'localhost', '[::]', '0x7f000001/', '0xc0a80014/'))) {
    2570                                     $error = __('Invalid alternate enclosure url. Please ensure that your url is formatted correctly, e.g https://example.com/file.mp3.', 'powerpress');
    2571                                     powerpress_add_error($error);
    2572                                     $ssrf_valid = false;
    2573                                 }
    2574                                 // check IP for hostname is not in LAN
    2575                                 if (empty($GeneralSettings['powerpress_self_hosted_media']) && !IPAddressIsPublic($ip)) {
    2576                                     $error = __('Invalid alternate enclosure url. Please ensure that your url is formatted correctly, e.g https://example.com/file.mp3.', 'powerpress');
    2577                                     powerpress_add_error($error);
    2578                                     $ssrf_valid = false;
    2579                                 }
    2580                                 if (!$ssrf_valid) {
     2550                                if (!SSRFCheck($MediaURL, $feed_slug, false, "alternate enclosure url")) {
    25812551                                    continue;
    25822552                                }
     
    30282998                            $acceptable_extensions = ['jpg', 'jpeg', 'png'];
    30292999                            if (!in_array(strtolower($ext), $acceptable_extensions)) {
    3030                                 $error = __('Error: invalid chapter image filetype', 'powerpress');
     3000                                $error = __('Error: invalid chapter image filetype ' . $ext . ' ' . $fileName . ' ' . print_r($existingIms, true), 'powerpress');
    30313001                                powerpress_add_error($error);
    30323002                            }
     
    30783048                                } else {
    30793049                                    $image_req_url = $img['new_file'];
    3080                                     // we should never land in here as our UI requires them to use the WP uploader, but SSRF check in case they enter something malicious into the hidden input...
    3081                                     $UrlParts = parse_url($image_req_url);
    3082                                     $img_hostname = $UrlParts['host'];
    3083                                     $ssrf_valid = true;
    3084                                     if (in_array($img_hostname, array('0.0.0.0', '127.0.0.1', 'localhost', '[::]', '0x7f000001/', '0xc0a80014/')) || filter_var($img_hostname, FILTER_VALIDATE_IP) || !preg_match('/^[a-zA-Z.\-\d]+$/i', $img_hostname)) {
    3085                                         $error = __('Invalid chapter image url. Please ensure that your url is formatted correctly, e.g https://example.com/image.jpg.', 'powerpress');
    3086                                         powerpress_add_error($error);
    3087                                         $ssrf_valid = false;
    3088                                     }
    3089                                     // check IP for hostname is not localhost
    3090                                     $ip = gethostbyname($img_hostname);
    3091                                     if (empty($GeneralSettings['powerpress_self_hosted_media']) && in_array(strtolower($ip), array('0.0.0.0', '127.0.0.1', 'localhost', '[::]', '0x7f000001/', '0xc0a80014/'))) {
    3092                                         $error = __('Invalid chapter image url. Please ensure that your url is formatted correctly, e.g https://example.com/image.jpg.', 'powerpress');
    3093                                         powerpress_add_error($error);
    3094                                         $ssrf_valid = false;
    3095                                     }
    3096                                     // check IP for hostname is not in LAN
    3097                                     if (empty($GeneralSettings['powerpress_self_hosted_media']) && !IPAddressIsPublic($ip)) {
    3098                                         $error = __('Invalid chapter image url. Please ensure that your url is formatted correctly, e.g https://example.com/image.jpg.', 'powerpress');
    3099                                         powerpress_add_error($error);
    3100                                         $ssrf_valid = false;
    3101                                     }
    3102                                     if (!$ssrf_valid) {
     3050                                    if (!SSRFCheck($image_req_url, $feed_slug, false, "chapter image url")) {
    31033051                                        continue;
    31043052                                    }
     
    40934041}
    40944042
     4043function SSRFCheck($url, $feed_slug, $echo_error = false, $media_label = "media url") {
     4044    $GeneralSettings = powerpress_get_settings('powerpress_general');
     4045    $ch = curl_init();
     4046    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     4047    curl_setopt($ch, CURLOPT_HEADER, true); // look for location header
     4048    curl_setopt($ch, CURLOPT_NOBODY, true);
     4049    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
     4050    $redirect_count = 0;
     4051    do {
     4052        $UrlParts = parse_url($url);
     4053        $ssrf_valid = true;
     4054        $media_hostname = $UrlParts['host'];
     4055        if (in_array($media_hostname, array('0.0.0.0', '127.0.0.1', 'localhost', '[::]', '0x7f000001/', '0xc0a80014/')) || filter_var($media_hostname, FILTER_VALIDATE_IP) || !preg_match('/^[a-zA-Z.\-\d]+$/i', $media_hostname)) {
     4056            $ssrf_valid = false;
     4057        }
     4058        // check IP for hostname is not localhost
     4059        $ip = gethostbyname($media_hostname);
     4060        if (empty($GeneralSettings['powerpress_self_hosted_media']) && in_array(strtolower($ip), array('0.0.0.0', '127.0.0.1', 'localhost', '[::]', '0x7f000001/', '0xc0a80014/'))) {
     4061            $ssrf_valid = false;
     4062        }
     4063        // check IP for hostname is not in LAN
     4064        if (empty($GeneralSettings['powerpress_self_hosted_media']) && !IPAddressIsPublic($ip)) {
     4065            $ssrf_valid = false;
     4066        }
     4067        // check location header
     4068        curl_setopt($ch, CURLOPT_URL, $url);
     4069        $response = curl_exec($ch);
     4070        $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
     4071        $headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
     4072
     4073        // Split the full response into headers and body
     4074        $headers = substr($response, 0, $headerSize);
     4075        $body = substr($response, $headerSize);
     4076        $url = false;
     4077        if ($httpCode >= 300 && $httpCode < 400) {
     4078            $headerLines = explode("\n", $headers);
     4079            foreach ($headerLines as $line) {
     4080                $line = trim($line);
     4081                if (str_starts_with(strtolower($line), 'location:')) {
     4082                    $url = trim(substr($line, strlen('location:')));
     4083                }
     4084            }
     4085        }
     4086        $redirect_count++;
     4087    } while ($url != false && $redirect_count <= 12);
     4088
     4089    if (!$ssrf_valid) {
     4090        $error = __("Invalid {$media_label}. Please ensure that your url is formatted correctly, e.g https://example.com/filename.mp3.", "powerpress");
     4091        if ($media_label == "media url") {
     4092            $error .= " " . __("You can still publish this episode, but will need to enter filesize and duration manually.", 'powerpress');
     4093        }
     4094        if ($echo_error) {
     4095            echo "$feed_slug\n";
     4096            echo $error;
     4097        } else {
     4098            powerpress_add_error($error);
     4099        }
     4100        return false;
     4101    }
     4102    return true;
     4103}
     4104
    40954105function powerpress_media_info_ajax()
    40964106{
     
    41494159
    41504160    if (!$hosting) {
    4151         $ssrf_valid = true;
    4152         $media_hostname = $UrlParts['host'];
    4153         if (in_array($media_hostname, array('0.0.0.0', '127.0.0.1', 'localhost', '[::]', '0x7f000001/', '0xc0a80014/')) || filter_var($media_hostname, FILTER_VALIDATE_IP) || !preg_match('/^[a-zA-Z.\-\d]+$/i', $media_hostname)) {
    4154             $ssrf_valid = false;
    4155         }
    4156         // check IP for hostname is not localhost
    4157         $ip = gethostbyname($media_hostname);
    4158         if (empty($GeneralSettings['powerpress_self_hosted_media']) && in_array(strtolower($ip), array('0.0.0.0', '127.0.0.1', 'localhost', '[::]', '0x7f000001/', '0xc0a80014/'))) {
    4159             $ssrf_valid = false;
    4160         }
    4161         // check IP for hostname is not in LAN
    4162         if (empty($GeneralSettings['powerpress_self_hosted_media']) && !IPAddressIsPublic($ip)) {
    4163             $ssrf_valid = false;
    4164         }
    4165 
    4166         if (!$ssrf_valid) {
    4167             $error = __('Invalid url. Please ensure that your url is formatted correctly, e.g https://example.com/filename.mp3. You can still publish this episode, but will need to enter filesize and duration manually.', 'powerpress');
    4168             echo "$feed_slug\n";
    4169             echo $error;
     4161        if (!SSRFCheck($media_url, $feed_slug, true)) {
    41704162            return false;
    41714163        }
  • powerpress/trunk/readme.txt

    r3339176 r3347711  
    55Requires PHP: 5.2
    66Tested up to: 6.8
    7 Stable tag: 11.13.7
     7Stable tag: 11.13.8
    88Donate link: https://blubrry.com/services/podcast-hosting/
    99License: GPLv2 or later
     
    163163
    164164== Changelog ==
     165= 11.13.8 =
     166* Released on 08/20/2025
     167* Security update
     168* Small PHP bugfix
     169
    165170= 11.13.7 =
    166171* Released on 08/04/2025
  • powerpress/trunk/version.txt

    r3339176 r3347711  
    1 11.13.7
     111.13.8
Note: See TracChangeset for help on using the changeset viewer.