From: garvinhicking Date: Wed, 13 Jul 2005 13:33:07 +0000 (+0000) Subject: Fix possible XSS X-Git-Tag: 0.9~315 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=4a259444dca0deb86b8a0845041a9dfd5e94b0c8;p=s9y.git Fix possible XSS --- 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']) {