Headline
CVE-2013-10023: We are now validating the start and end dates before adding them to t… · wp-plugins/editorial-calendar@a9277f1
A vulnerability was found in Editorial Calendar Plugin up to 2.6. It has been declared as critical. Affected by this vulnerability is the function edcal_filter_where of the file edcal.php. The manipulation of the argument edcal_startDate/edcal_endDate leads to sql injection. The attack can be launched remotely. Upgrading to version 2.7 is able to address this issue. The name of the patch is a9277f13781187daee760b4dfd052b1b68e101cc. It is recommended to upgrade the affected component. The associated identifier of this vulnerability is VDB-225151.
@@ -495,6 +495,18 @@ function edcal_filter_where($where = ‘’) {
if ($edcal_startDate == ‘00000000’) {
$where .= " AND post_date_gmt LIKE '0000%’";
} else {
/*
* The start date and end date come from the client and we want to make
* sure there’s no SQL injection attack here. We know these values must
* be dates in a format like 2013-02-03. Date parsing is complex and PHP
* dates allow a lot of different formats. The simplest way to make sure
* this isn’t a SQL injection attack is to remove the dashes and check if
* the result is numeric. If it is then this can’t be a SQL injection attack.
*/
if (!is_numeric(str_replace("-", "", $edcal_startDate)) || !is_numeric(str_replace("-", "", $edcal_endDate))) {
die(“The specified start date and end date for the posts query must be numeric.”);
}
$where .= " AND post_date >= ‘" . $edcal_startDate . "’ AND post_date < ‘" . $edcal_endDate . "’ AND post_date_gmt NOT LIKE '0000%’";
}
return $where;