sanitize() does not escape backslash
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Pluck CMS |
Fix Committed
|
Critical
|
Uranium235 |
Bug Description
The function sanitize() in functions.all.php does not escape properly. Backslashes need to be escaped before escaping the single quotes.
Right now it is possible to inject and run php code. I do not know exactly if it is possible for an attacker to exploit the vulnerability without having admin (write) access first in the standard installation. But I imagine that plugins may exist - at least in the future - that use this function and allow non admin users to store information (like a guestbook) and potentially exploit the vulnerability.
Besides that it is possible to break the pluck installation for an admin when using the combination of single quote with an preceding backslash as field value.
Example
save the following to a page in tinymce html mode:
<a href="#" title="
fix:
function sanitize($var, $html = true) {
$var = str_replace('\\', '\\\\', $var);
$var = str_replace('\'', '\\\'', $var);
if ($html == true)
$var = htmlspecialchar
return $var;
}
Related branches
- Anders G. Jørgensen: Approve
-
Diff: 72 lines (+14/-10)3 files modifieddata/inc/editpage.php (+8/-7)
data/inc/functions.admin.php (+4/-1)
data/inc/functions.all.php (+2/-2)
description: | updated |
Changed in pluck-cms: | |
importance: | Undecided → Critical |
information type: | Private Security → Public Security |
Changed in pluck-cms: | |
assignee: | nobody → Uranium235 (uranium235) |
After having had a brief look at the blog module, I think the reactions functionality qualifies for an attack scenario for visitors.
So I think this bug is in fact critical and of utmost importance!