首先我们看一下FileManage类
package ecology.classbean.weaver.file;
public class FileManage
关注到增加了一个import类FileType
其中主要修改的函数为copy函数,显然这个函数造成了漏洞
public static void copy(String srcfile, String destfile)
关注到使用上面导入的FileType类对需要copy的文件扩展名进行合法性检查
如果还想继续利用就要绕过下面这个检查函数
public static boolean validateFileExt(String filename) {
ReflectMethodCall reflectMethodCall = new ReflectMethodCall();
return ((Boolean)reflectMethodCall.call("weaver.security.file.FileType",
null,
"validateFileExt",
new Class[] { String.class }, new Object[] {
filename
})).booleanValue();
}
public static boolean validateFileExt(String filename, List<String> allowFileTypes) {
ReflectMethodCall reflectMethodCall = new ReflectMethodCall();
return ((Boolean)reflectMethodCall.call("weaver.security.file.FileType",
null,
"validateFileExt",
new Class[] { String.class, List.class }, new Object[] {
filename, allowFileTypes
})).booleanValue();
}
另外一个函数moveFileTo也做了文件扩展名检查