Reflected Cross-Site Scripting (XSS) Vulnerability in Time Sheets
We recently found that the Time Sheets plugin contains a reflected cross-site scripting (XSS) vulnerability on one the plugin’s admin pages, Old Timesheets.
As of version 1.3.1, in the file /entry.php the GET inputs “start_date”, “end_date”, and “include_completed” were echo’d out with being sanitized or escaped to prevent malicious code from being placed on the page:
$start_date = $_GET['start_date']; $end_date = $_GET['end_date']; if ($start_date=='') { $start_date = date('Y-m-d', strtotime("-1 Year")); } if ($end_date=='') { $end_date = date('Y-m-d', strtotime("+1 Day")); } echo '<form method="get">'; echo "Enter Range To Search: "; echo "<input type='text' name='start_date' size='10' value='{$start_date}'>"; echo " to "; echo "<input type='text' name='end_date' size='10' value='{$end_date}'>"; echo "<br><input type='checkbox' name='include_completed' value='checked' {$_GET['include_completed']}> Include Completed Timesheets";
We notified the developer of the issue, but we haven’t heard back from them. Subsequent to that version 1.4.0 was released, which sanitizes two of those GET inputs, “start_date” and “end_date”, by running them through a couple of the plugin’s functions:
772 773 | $start_date = $common->f_date($common->clean_from_db($_GET['start_date'])); $end_date = $common->f_date($common->clean_from_db($_GET['end_date'])); |
No change was made related to third GET input “include_completed”, so the change with the others could be unrelated to our notifying the developer of the issue.
Proof of Concept
The following proof of concept will cause any available cookies to be shown in alert box. Major web browsers other than Firefox provide XSS filtering, so this proof of concept will not work in those web browsers.
Make sure to replace “[path to WordPress]” with the location of WordPress.
http://[path to WordPress]/wp-admin/admin.php?start_date=2017-02-02&end_date=2017-02-03&submit=Search&page=search_timesheet&include_completed='><script>alert(document.cookie);</script>
Timeline
- February 2, 2017: Developer notified.
- February 17, 2017 – WordPress.org Plugin Directory notified.
- February 17, 2017 – Plugin removed from WordPress.org Plugin Directory.
- February 18, 2017 – Version 1.5.0 submitted to the Plugin Directory’s subversion repository, which resolves the vulnerability.