From 4a259444dca0deb86b8a0845041a9dfd5e94b0c8 Mon Sep 17 00:00:00 2001 From: garvinhicking Date: Wed, 13 Jul 2005 13:33:07 +0000 Subject: [PATCH] Fix possible XSS --- docs/NEWS | 3 +++ include/functions_comments.inc.php | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/NEWS b/docs/NEWS index 4de155f..b5330ca 100644 --- a/docs/NEWS +++ b/docs/NEWS @@ -150,6 +150,9 @@ Version 0.9 () Version 0.8.3 () ------------------------------------------------------------------------ + * Fixed possible XSS in comment input validation, thanks to + Ilia Alshanetsky + * XML_RPC: Eliminate path disclosure vulnerabilities by suppressing error messages when eval()'ing. Eliminate path disclosure vulnerability by catching bogus parameters submitted diff --git a/include/functions_comments.inc.php b/include/functions_comments.inc.php index e978cdb..336c477 100644 --- a/include/functions_comments.inc.php +++ b/include/functions_comments.inc.php @@ -176,7 +176,14 @@ function serendipity_printComments($comments, $parentid = 0, $depth = 0, $trace if (!empty($comment['url']) && substr($comment['url'], 0, 7) != 'http://' && substr($comment['url'], 0, 8) != 'https://') { $comment['url'] = 'http://' . $comment['url']; } - + + if (!empty($comment['url'])) { + if (!@parse_url($comment['url'])) { + $comment['url'] = ''; + } + $comment['url'] = htmlspecialchars($comment['url'], ENT_QUOTES); + } + serendipity_plugin_api::hook_event('frontend_display', $comment); if (isset($comment['no_email']) && $comment['no_email']) { -- 2.39.5