Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/link-library/link-library-admin.php
+++ b/link-library/link-library-admin.php
@@ -2509,7 +2509,7 @@
foreach (
array(
'hide_if_empty', 'catanchor', 'showdescription', 'shownotes', 'showrating', 'showupdated', 'show_images',
- 'use_html_tags', 'show_rss', 'nofollow', 'showcolumnheaders', 'show_rss_icon', 'showcategorydescheaders',
+ 'show_rss', 'nofollow', 'showcolumnheaders', 'show_rss_icon', 'showcategorydescheaders',
'showcategorydesclinks', 'showadmineditlinks', 'showonecatonly', 'rsspreview', 'rssfeedinline', 'rssfeedinlinecontent',
'pagination', 'hidecategorynames', 'showinvisible', 'showdate', 'showuserlinks', 'emailnewlink', 'usethumbshotsforimages', 'uselocalimagesoverthumbshots',
'addlinkreqlogin', 'showcatlinkcount', 'publishrssfeed', 'showname', 'enablerewrite', 'storelinksubmitter', 'showlinkhits', 'showcaptcha',
@@ -5837,14 +5837,6 @@
<table>
<tr>
<td>
- <?php _e( 'Convert [] to <> in Link Description and Notes', 'link-library' ); ?>
- </td>
- <td style='width:75px;padding:0px 20px 0px 20px'>
- <input type="checkbox" id="use_html_tags" name="use_html_tags" <?php checked( $options['use_html_tags'] ); ?>/>
- </td>
- </tr>
- <tr>
- <td>
<?php _e( 'Add nofollow tag to outgoing links', 'link-library' ); ?>
</td>
<td style='width:75px;padding:0px 20px 0px 20px'>
--- a/link-library/link-library-defaults.php
+++ b/link-library/link-library-defaults.php
@@ -80,7 +80,6 @@
$options['showrating'] = false;
$options['showupdated'] = false;
$options['show_images'] = false;
- $options['use_html_tags'] = false;
$options['show_rss'] = false;
$options['nofollow'] = false;
$options['catlistwrappers'] = 1;
--- a/link-library/link-library.php
+++ b/link-library/link-library.php
@@ -3,7 +3,7 @@
Plugin Name: Link Library
Plugin URI: https://ylefebvre.github.io/wordpress-plugins/link-library/
Description: Display links on pages with a variety of options
-Version: 7.10.0
+Version: 7.10.1
Author: Yannick Lefebvre
Author URI: http://ylefebvre.github.io/
Text Domain: link-library
--- a/link-library/render-link-library-cats-sc.php
+++ b/link-library/render-link-library-cats-sc.php
@@ -402,7 +402,7 @@
$cattext .= $settings;
}
- $cattext .= "('" . $catname->term_id. "', '";
+ $cattext .= "('" . esc_js( $catname->term_id ) . "', '";
if ( !empty( $targetlibrary ) ) {
$cattext .= $targetlibrary;
@@ -421,10 +421,10 @@
$cattargetaddress = add_query_arg( 'cat_id', $catname->term_id, '');
if ( $searchfiltercats && isset( $_GET['searchll'] ) && !empty( $_GET['searchll'] ) ) {
- $cattargetaddress = add_query_arg( 'searchll', sanitize_text_field( $_GET['searchll'] ), $cattargetaddress );
+ $cattargetaddress = add_query_arg( 'searchll', rawurlencode( sanitize_text_field( wp_unslash( $_GET['searchll'] ) ) ), $cattargetaddress );
}
- $cattext .= $cattargetaddress;
+ $cattext .= esc_url( $cattargetaddress );
if ( 'dropdown' != $flatlist && 'dropdowndirect' != $flatlist ) {
$cattext .= "'>";
@@ -436,10 +436,10 @@
$cattargetaddress = add_query_arg( 'catslug', $catname->slug, '');
if ( $searchfiltercats && isset( $_GET['searchll'] ) && !empty( $_GET['searchll'] ) ) {
- $cattargetaddress = add_query_arg( 'searchll', sanitize_text_field( $_GET['searchll'] ), $cattargetaddress );
+ $cattargetaddress = add_query_arg( 'searchll', rawurlencode( sanitize_text_field( wp_unslash( $_GET['searchll'] ) ) ), $cattargetaddress );
}
- $cattext .= $cattargetaddress;
+ $cattext .= esc_url( $cattargetaddress );
if ( 'dropdown' != $flatlist && 'dropdowndirect' != $flatlist ) {
$cattext .= "'>";
@@ -458,7 +458,7 @@
$get_array['catname'] = urlencode( $catname->name );
$get_query = add_query_arg( $get_array, $cattargetaddress );
- $cattext .= $get_query;
+ $cattext .= esc_url( $get_query );
if ( 'dropdown' != $flatlist && 'dropdowndirect' != $flatlist ) {
$cattext .= "'>";
@@ -468,12 +468,12 @@
$cattext = "<a href='";
}
- $cattargetaddress = esc_url( site_url() . '/' . $rewritepage . '/' . $catname->slug . '/' );
+ $cattargetaddress = site_url() . '/' . $rewritepage . '/' . $catname->slug . '/';
if ( $searchfiltercats && isset( $_GET['searchll'] ) && !empty( $_GET['searchll'] ) ) {
- $cattargetaddress = add_query_arg( 'searchll', sanitize_text_field( $_GET['searchll'] ), $cattargetaddress );
+ $cattargetaddress = add_query_arg( 'searchll', rawurlencode( sanitize_text_field( wp_unslash( $_GET['searchll'] ) ) ), $cattargetaddress );
}
- $cattext .= $cattargetaddress;
+ $cattext .= esc_url( $cattargetaddress );
if ( 'dropdown' != $flatlist && 'dropdowndirect' != $flatlist ) {
$cattext .= "'>";
@@ -486,7 +486,7 @@
}
if ( $searchfiltercats && isset( $_GET['searchll'] ) && !empty( $_GET['searchll'] ) ) {
- $cattext .= '?searchll=' . sanitize_text_field( $_GET['searchll'] ) . '&cat_id=' . $catname->term_id;
+ $cattext .= '?searchll=' . rawurlencode( sanitize_text_field( wp_unslash( $_GET['searchll'] ) ) ) . '&cat_id=' . $catname->term_id;
} elseif ( 'toggles' != $flatlist && 'togglesshowhideall' != $flatlist ) {
$cattext .= '#' . $catname->slug;
}
@@ -683,7 +683,7 @@
$output .= $settings;
}
- $output .= "(catidvar, linklistID, 1, '" . $searchstring . "');return false; }";
+ $output .= "(catidvar, linklistID, 1, '" . esc_js( $searchstring ) . "');return false; }";
} else {
$output .= "ttlocation=n";
$output .= "document.catselect.catdropdown" . $settings . ".options[document.catselect.catdropdown" . $settings . ".selectedIndex].value }n";
--- a/link-library/render-link-library-sc.php
+++ b/link-library/render-link-library-sc.php
@@ -1817,21 +1817,9 @@
$linkitem['link_textfield'] = do_shortcode( $linkitem['link_textfield'] );
- if ( $use_html_tags ) {
- $descnotes = $linkitem['link_notes'];
- $descnotes = str_replace( '[', '<', $descnotes );
- $descnotes = str_replace( ']', '>', $descnotes );
- $desc = $linkitem['link_description'];
- $desc = str_replace("[", "<", $desc);
- $desc = str_replace("]", ">", $desc);
- $textfield = stripslashes( $linkitem['link_textfield'] );
- $textfield = str_replace( '[', '<', $textfield );
- $textfield = str_replace( ']', '>', $textfield );
- } else {
- $descnotes = esc_html( $linkitem['link_notes'], ENT_QUOTES );
- $desc = esc_html($linkitem['link_description'], ENT_QUOTES);
- $textfield = stripslashes( $linkitem['link_textfield'] );
- }
+ $descnotes = esc_html( $linkitem['link_notes'], ENT_QUOTES );
+ $desc = esc_html($linkitem['link_description'], ENT_QUOTES);
+ $textfield = stripslashes( $linkitem['link_textfield'] );
$cleandesc = $desc;
$cleanname = esc_html( $linkitem['link_name'], ENT_QUOTES );
--- a/link-library/rsspreview.php
+++ b/link-library/rsspreview.php
@@ -8,64 +8,66 @@
$link_url = get_post_meta( $linkid, 'link_url', true );
$link = get_post( $linkid );
-$genoptions = get_option('LinkLibraryGeneral');
+if ( !empty( $link ) && 'link_library_links' == $link->post_type && 'publish' == $link->post_status ) {
+ $genoptions = get_option('LinkLibraryGeneral');
-include_once(ABSPATH . WPINC . '/feed.php');
+ include_once(ABSPATH . WPINC . '/feed.php');
-if ( !empty( $link_rss ) && !empty( $link ) ) {
- // Get a SimplePie feed object from the specified feed source.
- $rss = fetch_feed( $link_rss );
- if ( !is_wp_error( $rss ) ) { // Checks that the object is created correctly
- // Figure out how many total items there are, but limit it to 5.
- $maxitems = $rss->get_item_quantity( $itemcount );
-
- // Build an array of all the items, starting with element 0 (first element).
- $rss_items = $rss->get_items( 0, $maxitems );
-
- }
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title><?php echo ( empty( $_GET['feed'] ) ) ? 'RSS_PHP' : 'RSS_PHP: ' . $link->post_title; ?></title>
-
- <!-- META HTTP-EQUIV -->
- <meta http-equiv="content-type" content="text/html; charset=UTF-8; ?>" />
- <meta http-equiv="imagetoolbar" content="false" />
-
- <?php if ( isset( $genoptions['stylesheet'] ) && !empty( $genoptions['stylesheet'] ) ) { ?>
- <style id='LinkLibraryStyle' type='text/css'>
- <?php echo stripslashes( $genoptions['fullstylesheet'] ); ?>
- </style>
- <?php } ?>
-
- </head>
-
- <body>
- <div id="ll_rss_preview_results">
- <?php if ( $rss_items ) { ?>
- <?php foreach($rss_items as $item): ?>
- <div class="ll_rss_preview_title" style="padding:0 5px 5px;">
- <h1><a target="feedwindow" href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a><div class='ll_rss_preview_date'><?php echo $item->get_date('j F Y | g:i a'); ?></div></h1>
- <div class='ll_rss_preview_content'><?php echo $item->get_description(); ?></div>
+ if ( !empty( $link_rss ) && !empty( $link ) ) {
+ // Get a SimplePie feed object from the specified feed source.
+ $rss = fetch_feed( $link_rss );
+ if ( !is_wp_error( $rss ) ) { // Checks that the object is created correctly
+ // Figure out how many total items there are, but limit it to 5.
+ $maxitems = $rss->get_item_quantity( $itemcount );
+
+ // Build an array of all the items, starting with element 0 (first element).
+ $rss_items = $rss->get_items( 0, $maxitems );
+
+ }
+ ?>
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+ <html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title><?php echo ( empty( $_GET['feed'] ) ) ? 'RSS_PHP' : 'RSS_PHP: ' . $link->post_title; ?></title>
+
+ <!-- META HTTP-EQUIV -->
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8; ?>" />
+ <meta http-equiv="imagetoolbar" content="false" />
+
+ <?php if ( isset( $genoptions['stylesheet'] ) && !empty( $genoptions['stylesheet'] ) ) { ?>
+ <style id='LinkLibraryStyle' type='text/css'>
+ <?php echo stripslashes( $genoptions['fullstylesheet'] ); ?>
+ </style>
+ <?php } ?>
+
+ </head>
+
+ <body>
+ <div id="ll_rss_preview_results">
+ <?php if ( $rss_items ) { ?>
+ <?php foreach($rss_items as $item): ?>
+ <div class="ll_rss_preview_title" style="padding:0 5px 5px;">
+ <h1><a target="feedwindow" href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a><div class='ll_rss_preview_date'><?php echo $item->get_date('j F Y | g:i a'); ?></div></h1>
+ <div class='ll_rss_preview_content'><?php echo $item->get_description(); ?></div>
+ </div>
+ <br />
+ <?php
+ endforeach;
+ ?>
+ <br />
+ <div>
+ <a class="ll_rss_preview_button" target="feedwindow" href="<?php echo esc_url( $link_rss ); ?>"><span>More News from this Feed</span></a> <a class="ll_rss_preview_button" target="sitewindow" href="<?php echo esc_url( $link_url ); ?>"><span>See Full Web Site</span></a>
</div>
<br />
- <?php
- endforeach;
- ?>
- <br />
- <div>
- <a class="ll_rss_preview_button" target="feedwindow" href="<?php echo $link_rss; ?>"><span>More News from this Feed</span></a> <a class="ll_rss_preview_button" target="sitewindow" href="<?php echo $link_url; ?>"><span>See Full Web Site</span></a>
- </div>
- <br />
- <br />
- <?php } ?>
- </div>
- </body>
- </html>
-
- <?php
- exit;
+ <br />
+ <?php } ?>
+ </div>
+ </body>
+ </html>
+
+ <?php
+ exit;
+ }
}
}
--- a/link-library/usersubmission.php
+++ b/link-library/usersubmission.php
@@ -140,7 +140,7 @@
} else if ( isset( $_FILES['linkfile'] ) && file_exists( $_FILES['linkfile']['tmp_name'] ) && !in_array( $link_file_ext, $allowed_link_file_extensions ) ) {
$requiredcheck = false;
$message = 28;
- } elseif ( isset( $_FILES['linkfile'] ) && file_exists( $_FILES['linkfile']['tmp_name'] ) && file_exists( $uploads['basedir'] . '/link-library-files/' . $_FILES['linkfile']['name'] ) ) {
+ } elseif ( isset( $_FILES['linkfile'] ) && file_exists( $_FILES['linkfile']['tmp_name'] ) && file_exists( $uploads['basedir'] . '/link-library-files/' . sanitize_file_name( $_FILES['linkfile']['name'] ) ) ) {
$requiredcheck = false;
$message = 29;
}
@@ -472,9 +472,9 @@
mkdir( $uploads['basedir'] . '/link-library-files' );
}
- $target_link_file_name = $uploads['basedir'] . '/link-library-files/' . $_FILES['linkfile']['name'];
- $target_link_file_url = $uploads['baseurl'] . '/link-library-files/' . $_FILES['linkfile']['name'];
- move_uploaded_file( $_FILES['linkfile']['tmp_name'], $target_link_file_name );
+ $target_link_file_name = $uploads['basedir'] . '/link-library-files/' . sanitize_file_name( $_FILES['linkfile']['name'] );
+ $target_link_file_url = $uploads['baseurl'] . '/link-library-files/' . sanitize_file_name( $_FILES['linkfile']['name'] );
+ move_uploaded_file( sanitize_file_name( $_FILES['linkfile']['tmp_name'] ), $target_link_file_name );
update_post_meta( $new_link_ID, 'link_url', $target_link_file_url );
}
}