安全研究
安全漏洞
Novell Access Manager管理控制台getEntry()方式任意文件上传漏洞
发布日期:2010-06-17
更新日期:2010-06-18
受影响系统:
Novell Access Manager 3.1 SP1不受影响系统:
Novell Access Manager 3.1
Novell Access Manager 3.1 SP2描述:
BUGTRAQ ID: 40931
CVE ID: CVE-2010-0284
Novell Access Manager是新一代的访问管理解决方案。
Novell Access Manager管理控制台的PortalModuleInstallManager组件中存在任意文件上传漏洞。在nps.jar的servlet中,由于没有正确地对参数过滤“../”目录遍历串,攻击者可以指定任意文件名对其上传任意内容。成功攻击可以导致以服务的权限执行任意代码。
在对指定的servlet进行张贴的时候,会调用com.novell.nps.serviceProviders.PortalModuleInstallManager中的doPost方式:
public void doPost(HttpServletRequest request, HttpServletResponse
response) throws IOException
{
processRequest(request, response); // XXX
}
这会将请求转发给processRequest方式,该方式会检查请求是否为多部表单,如果是就会从表单中获取参数:
private void processRequest(HttpServletRequest request,
HttpServletResponse response) throws IOException
{
int iError = 417;
try
{
String sAdminDN;
String sAdminPassword;
String sModule;
if (isMultiPart(request))
{
HashMap mapParameters = getMultiPartParameters(request); //
XXX
这个函数仅会检索表单的每个项:
private HashMap getMultiPartParameters(HttpServletRequest request)
throws IOException
{
HashMap mapParameters = new HashMap();
String sBoundary = getMultiPartParameterBoundary(request);
int iMajorVersion = this.m_context.getMajorVersion();
int iMinorVersion = this.m_context.getMinorVersion();
String sEnc;
if ((2 < iMajorVersion) || ((2 == iMajorVersion) && (3 <=
iMinorVersion)))
sEnc = "UTF-8";
else {
sEnc = null;
}
ServletInputStream inputStream = request.getInputStream();
byte[] baBuff = new byte[4096];
inputStream.readLine(baBuff, 0, baBuff.length);
while (getEntry(inputStream, sEnc, sBoundary, mapParameters));
// XXX
return mapParameters;
}
getEntry方式会读取2个对来判断servlet是否应向其代码库上传文件。由于没有对文件名检查目录遍历序列,这允许用户将文件POST到指定的目录:
private boolean getEntry(ServletInputStream inputStream, String sEnc,
String sBoundary, HashMap mapParameters)
{
boolean bRet = true;
try
{
byte[] baBuff = new byte[4096];
inputStream.readLine(baBuff, 0, baBuff.length);
String sDescription = null;
if (sEnc != null)
sDescription = new String(baBuff, sEnc);
else
sDescription = new String(baBuff);
int iIndexEntryName = sDescription.indexOf("name=\"");
String sKey = sDescription.substring(iIndexEntryName +
"name=\"".length(), sDescription.indexOf(34,
sDescription.indexOf("name=\"") + "name=\"".length()));
try
{
StringBuffer sbData = new StringBuffer();
int iIndex = sDescription.indexOf("filename=\"");
if (-1 != iIndex)
{
String sFile =
sDescription.substring(sDescription.indexOf("filename=\"") +
"filename=\"".length(), sDescription.indexOf(34,
sDescription.indexOf("filename=\"") + "filename=\"".length()));
if (0 < sFile.length()) {
sbData.append(uploadFile(sFile, inputStream, sBoundary,
sEnc).getAbsolutePath()); // XXX
<*来源:Stephen Fewer
链接:http://secunia.com/advisories/40198/
http://www.novell.com/support/viewContent.do?externalId=7006255&sliceId=1
http://marc.info/?l=bugtraq&m=127715151512922&w=2
*>
建议:
厂商补丁:
Novell
------
目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载:
http://support.novell.com/security-alerts
浏览次数:2726
严重程度:0(网友投票)
绿盟科技给您安全的保障
