CVE-2020-15164 (published 2020-08-28T17:15Z)

in Scratch Login (MediaWiki extension) before version 1.1, any account can be logged into by using the same username with leading, trailing, or repeated underscore(s), since those are treated as whitespace and trimmed by MediaWiki. This affects all users on any wiki using this extension. Since version 1.1, comments by users whose usernames would be trimmed on MediaWiki are ignored when searching for the verification code.

Severity: MEDIUM
CVSS v2 base score: 6.4 (AV:N/AC:L/Au:N/C:P/I:P/A:N)
CVSS v3 base score: 10.0, CRITICAL (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N)

Weakness information:
cwe_id: CWE-74
cwe_name: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
description: The product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.
extended_description: Software or other automated logic has certain assumptions about what constitutes data and control respectively. It is the lack of verification of these assumptions for user-controlled input that leads to injection problems. Injection problems encompass a wide variety of issues -- all mitigated in very different ways and usually attempted in order to alter the control flow of the process. For this reason, the most effective way to discuss these weaknesses is to note the distinct features that classify them as injection weaknesses. The most important issue to note is that all injection problems share one thing in common -- i.e., they allow for the injection of control plane data into the user-controlled data plane. This means that the execution of the process may be altered by sending code in through legitimate data channels, using no other mechanism. While buffer overflows, and many other flaws, involve the use of some further issue to gain execution, injection problems need only for the data to be parsed.
         

Fix information:
repo_url: https://github.com/InternationalScratchWiki/mediawiki-scratch-login
commit_details: repo_url: https://github.com/InternationalScratchWiki/mediawiki-scratch-login
author: Ken
author_date: 2020-08-29 00:04:19+08:00
msg: Disallow MW-invalid usernames from being picked
repository: repo_url: https://github.com/InternationalScratchWiki/mediawiki-scratch-login
repo_name: InternationalScratchWiki/mediawiki-scratch-login
description: MediaWiki extension to allow logging in with one's Scratch account
repo_language: PHP
owner: InternationalScratchWiki
file_changes: filename: ScratchLogin.common.php
change_type: ModificationType.MODIFY
diff: @@ -37,6 +37,7 @@ function topVerifCommenter($req_comment) {
 	$comments = verifComments();
 
 	$matching_comments = array_filter($comments, function(&$comment) use($req_comment) {
+		if (preg_match('/^_+|_+$|__+/', $comment['author']['username'])) return false;
 		return stristr($comment['content'], $req_comment);
 	});
 	if (empty($matching_comments)) {
@@ -144,4 +145,4 @@ class ScratchSpecialPage extends SpecialPage {
 		generateNewCodeForSession($request->getSession());
 		$out->addWikiMsg('scratchlogin-code-reset', $returnto);
 	}
-}
\ No newline at end of file
+}

programming_language: PHP