Skip to content

Commit

Permalink
chore: Fix vulns (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
kunalnagar committed Apr 25, 2023
1 parent e66f0f0 commit 1590fd6
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion admin/AdminClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ private function custom_404_pro_log( $is_email ) {
$referer = $_SERVER['HTTP_REFERER'];
}
$user_agent = $_SERVER['HTTP_USER_AGENT'];
$sql_save = 'INSERT INTO ' . $wpdb->prefix . $this->helpers->table_logs . " (ip, path, referer, user_agent) VALUES ('$ip', '$path', '$referer', '$user_agent')";
$sql_save = $wpdb->prepare("INSERT INTO `$wpdb->prefix . $this->helpers->table_logs` ('ip', 'path', 'referer', 'user_agent') VALUES (%s, %s, %s, %s)", $ip, $path, $referer, $user_agent);
$wpdb->query( $sql_save );
if ( ! empty( $is_email ) ) {
self::custom_404_pro_send_mail( $ip, $path, $referer, $user_agent );
Expand Down
4 changes: 2 additions & 2 deletions admin/LogsClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ public function manage_sorting( $order_by, $order, $sql ) {
} elseif ( $order_by === 'r' ) {
$sql .= ' ORDER BY referer';
}
$sql .= ' ' . $order;
$sql .= ' ' . sanitize_sql_orderby( $order );
return $sql;
}

public function manage_search( $search, $sql ) {
$sql .= " WHERE (ip LIKE '%" . $search . "%' OR path LIKE '%" . $search . "%' OR referer LIKE '%" . $search . "%' OR user_agent LIKE '%" . $search . "%' OR created LIKE '%" . $search . "%')";
$sql .= " WHERE (ip LIKE '%" . sanitize_text_field( $search ) . "%' OR path LIKE '%" . $search . "%' OR referer LIKE '%" . $search . "%' OR user_agent LIKE '%" . $search . "%' OR created LIKE '%" . $search . "%')";
return $sql;
}

Expand Down
2 changes: 1 addition & 1 deletion admin/views/logs.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<!-- Now we can render the completed list table -->
<p class="search-box">
<label class="screen-reader-text" for="search_id-search-input">Search</label>
<input id="search_id-search-input" type="text" name="s" value="<?php if ( array_key_exists( 's', $_GET ) ) { echo sanitize_text_field($_GET['s']); } ?>" autocomplete="off" />
<input id="search_id-search-input" type="text" name="s" value="<?php if ( array_key_exists( 's', $_GET ) ) { echo esc_attr($_GET['s']); } ?>" autocomplete="off" />
<input id="search-submit" class="button" type="submit" name="" value="Search" />
</p>
<?php $logs_table->display(); ?>
Expand Down
2 changes: 1 addition & 1 deletion admin/views/settings-general.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
global $wpdb;
$helpers = Helpers::singleton();
$sql = 'SELECT * FROM ' . $helpers->table_options;
$sql = 'SELECT * FROM ' . $wpdb->prefix . $helpers->table_options;
$result = $wpdb->get_results( $sql );
$row_send_email = $result[3];
$row_logging_enabled = $result[4];
Expand Down
2 changes: 1 addition & 1 deletion custom-404-pro.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Plugin Name: Custom 404 Pro
Plugin URI: https://wordpress.org/plugins/custom-404-pro/
Description: Override the default 404 page with any page or a custom URL from the Admin Panel.
Version: 3.7.2
Version: 3.7.3
Author: Kunal Nagar
Author URI: https://www.kunalnagar.in
License: GPL-2.0+
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://www.paypal.me/kunalnagar88/10
Tags: wordpress, 404, 404 error page, 404 link, 404 page, broken link, custom 404, custom 404 error, custom 404 error page, custom 404 page, customize 404, customize 404 error page, customize 404 page, error, error page, missing, page, page not found, page not found error
Requires at least: 3.0.1
Tested up to: 6.1
Stable tag: 3.7.2
Stable tag: 3.7.3
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -55,6 +55,9 @@ Uninstall the plugin from the Plugins page (important!) and reinstall it. Never

== Changelog ==

= 3.7.3 =
* Fix vulnerabilities

= 3.7.2 =
* Fix CSRF vulnerability in Logs table

Expand Down

0 comments on commit 1590fd6

Please sign in to comment.