Skip to content

Commit 4ccb8b3

Browse files
michieldmarianaballa
authored andcommitted
avoid stored XSS on the message field
1 parent 5d87d35 commit 4ccb8b3

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

public_html/lists/admin/lib.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ function setMessageData($msgid, $name, $value)
105105
//# disallow html in the subject and title
106106
$value = strip_tags($value);
107107
}
108+
if ($name == 'message') { ## there's no need for js actions in the body. @@TODO expand on other fields
109+
$value = disableJavascript($value);
110+
}
108111

109112
if ($name == 'targetlist' && is_array($value)) {
110113
Sql_query(sprintf('delete from %s where messageid = %d', $GLOBALS['tables']['listmessage'], $msgid));
@@ -1041,7 +1044,7 @@ function clearPageCache()
10411044
function removeJavascript($content)
10421045
{
10431046
$content = preg_replace('/<script[^>]*>(.*?)<\/script\s*>/mis', '', $content);
1044-
1047+
$content = disableJavascript($content);
10451048
return $content;
10461049
}
10471050

public_html/lists/admin/message.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
$content .= sprintf($format, s('Subject'), htmlentities($msgdata['subject']));
106106
$content .= sprintf($format, s('entered'), formatDateTime( stripslashes($msgdata['entered'] )));
107107
$content .= sprintf($format, s('fromfield'), htmlentities(stripslashes($msgdata['fromfield'])));
108-
$content .= sprintf($format, s('HTML content'), stripslashes($msgdata['message']));
108+
$content .= sprintf($format, s('HTML content'), disableJavascript(stripslashes($msgdata['message'])));
109109
$content .= sprintf($format, s('Text content'), htmlentities(stripslashes($msgdata['textmessage'])));
110110
$content .= sprintf($format, s('footer'), stripslashes($msgdata['footer']));
111111

0 commit comments

Comments
 (0)