用友NC Cloud importhttpscer 任意文件上传漏洞分析
type
status
date
slug
summary
tags
category
icon
password
AI summary
漏洞分析
漏洞原理
漏洞点位于:nccloud.web.pfxx.manualload.action.ImportHttpsCertAction#doAction()

这里从请求中获取参数列表,然后传入writeInputStreamToFile函数处理。在该函数中获取了文件名和文件输入流,写入文件。其中文件名和内容均可控,可路径穿越至webapps目录下解析jsp文件。
路由分析
通过分析ImportHttpsCertAction类引入的
nccloud.framework.*
可以发现,来自于pubplatform_baseLevel-1.jar
包的MobController处理,通过查询/hotwebs/nccloud/WEB-INF/web.xml
可得知这个MobController处理/mob/*
的请求。
这里创建
MobHttpOperator
和MobDispatcher
实例。MobDispatcher
的doAction
方法被调用,开始处理请求。

在doAction方法中,首先调用excute方法,获取请求信息并提取出请求的action路径。
使用这个action路径查找对应的action定义。根据获取的ActionDefine实例,执行相应的处理逻辑。
如果ActionDefine实例对应的类不是IMobileAction或IMobAuthenticateAction实例,会创建一个ActionExcutor来执行这个action。执行完后,将结果存储在value返回。

最终将上传的结果以json的方式返回。

绕过鉴权
在web.xml中
/mob/*
路径配置了鉴权,需要从header中获取accessToken的值与JWT的token匹配

而JWT的密钥是硬编码的,在JwtProperties中可以找到,为defaultSecret

使用如下脚本伪造token绕过鉴权

Loading...