From: Brian Wolff Date: Wed, 18 Oct 2017 05:28:43 +0000 (+0000) Subject: SECURITY: Escape internal error message X-Git-Tag: 1.31.0-rc.0~1518 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=fea3bbcdae4f052f769ab466df6e1f5d47d1383c;hp=52e76843e268180a6f7add00f1105c42bf6a4ee8 SECURITY: Escape internal error message This message contains the request url, which is semi-user controlled. Most browsers percent escape < and > so its probably not exploitable (curl is an exception here), but nonetheless its not good. Bug: T178451 Change-Id: I19358471ddf1b28377aad8e0fb54797c817bb6f6 --- diff --git a/includes/exception/MWException.php b/includes/exception/MWException.php index c63343189f..6d95919a87 100644 --- a/includes/exception/MWException.php +++ b/includes/exception/MWException.php @@ -103,13 +103,15 @@ class MWException extends Exception { $logId = WebRequest::getRequestId(); $type = static::class; return Html::errorBox( - '[' . $logId . '] ' . - gmdate( 'Y-m-d H:i:s' ) . ": " . - $this->msg( "internalerror-fatal-exception", - "Fatal exception of type $1", - $type, - $logId, - MWExceptionHandler::getURL( $this ) + htmlspecialchars( + '[' . $logId . '] ' . + gmdate( 'Y-m-d H:i:s' ) . ": " . + $this->msg( "internalerror-fatal-exception", + "Fatal exception of type $1", + $type, + $logId, + MWExceptionHandler::getURL( $this ) + ) ) ) . ""; }