WebLogic Console 后台登录绕过漏洞(CVE-2020-14882)安装补丁后出现的中文乱码问题解决
具体漏洞详情:WebLogic Console 后台登录绕过漏洞(CVE-2020-14882)详情
问题描述
应用中涉及到HTTPS POST类型的请求,请求时,接收到的数据出现中文乱码
解决思路
weblogic默认编码为GBK,需要改为UTF-8
解决步骤
-
startWeblogic文件设置
(1)windows在startWeblogic.cmd 中
set CLASSPATH=%SAVE_CLASSPATH%
下增加一行
JAVA_OPTIONS="${JAVA_OPTIONS} -Dfile.encoding=utf-8"
(2)linux在startWeblogic.sh 中
CLASSPATH="${SAVE_CLASSPATH}"
下增加一行
JAVA_OPTIONS="${JAVA_OPTIONS} -Dfile.encoding=utf-8"
-
setDomainEnv文件设置
(1)windows在setDomainEnv.cmd 中搜索
CLUSTER_PROPERTIES关键字,并后续加入-Dfile.encoding=utf-8
改造后的结果为:
if "%ADMIN_URL%"=="" (
@REM The then part of this block is telling us we are either starting an admin server OR we are non-clustered
set CLUSTER_PROPERTIES=-Dweblogic.management.discover=true -Dfile.encoding=utf-8
) else (
set CLUSTER_PROPERTIES=-Dweblogic.management.discover=false -Dweblogic.management.server=%ADMIN_URL%
)
(2)linux在setDomainEnv.sh中搜索
CLUSTER_PROPERTIES关键字,并后续加入-Dfile.encoding=utf-8
改造后的结果为
if [ "${ADMIN_URL}" = "" ] ; then
# The then part of this block is telling us we are either starting an admin server OR we are non-clustered
CLUSTER_PROPERTIES="-Dweblogic.management.discover=true -Dfile.encoding=utf-8"
export CLUSTER_PROPERTIES
else
CLUSTER_PROPERTIES="-Dweblogic.management.discover=false -Dweblogic.management.server=${ADMIN_URL}"
export CLUSTER_PROPERTIES
fi
- 在JSP文件头加入
<!--page contentType="text/html; charset=utf-8"-->
------------------2021.03.04更新------------------
微信小程序的请求头为:
header: {
'content-type':'application/x-www-form-urlencoded;charset=utf-8'
}
支付宝小程序的请求头为:(请求头为headers,这点很容易忽略。。。)
headers: {
'content-type':'application/x-www-form-urlencoded;charset=utf-8'
}