Fixed: Secure the uploads (OFBIZ-12080)
Changes name="upload_file_type_bogus" in EditCategory.ftl and EditProductContent.ftl to name="up_load_file_type_bogus" The last line of deniedWebShellTokens in SecuredUpload and similarly in SecurityUtilTest classes should no have a comma and anti-slash as previous lines. Also logs when an image contains one of the token in deniedWebShellTokens
This commit is contained in:
@@ -677,7 +677,11 @@ public class SecuredUpload {
|
||||
}
|
||||
|
||||
private static boolean isValid(String content, String string, List<String> allowed) {
|
||||
return !content.toLowerCase().contains(string) || allowed.contains(string);
|
||||
boolean isOK = !content.toLowerCase().contains(string) || allowed.contains(string);
|
||||
if (!isOK) {
|
||||
Debug.logInfo("############### BEWARE, Image contains " + string, MODULE);
|
||||
}
|
||||
return isOK;
|
||||
}
|
||||
|
||||
private static void deleteBadFile(String fileToCheck) {
|
||||
|
||||
@@ -63,7 +63,7 @@ public class SecurityUtilTest {
|
||||
// %eval,@eval,eval(,runtime,import,passthru,shell_exec,assert,str_rot13,system,decode,include,page ,\
|
||||
// chmod,mkdir,fopen,fclose,new file,upload,getfilename,download,getoutputstring,readfile,iframe,object,embed,onload,build\
|
||||
// python,perl ,/perl,ruby ,/ruby,process,function,class,InputStream,to_server,wget ,static,assign,webappPath,\
|
||||
// ifconfig,route,crontab,netstat,uname ,hostname,iptables,whoami,"cmd",*cmd|,+cmd|,=cmd|,localhost,\
|
||||
// ifconfig,route,crontab,netstat,uname ,hostname,iptables,whoami,"cmd",*cmd|,+cmd|,=cmd|,localhost
|
||||
|
||||
try {
|
||||
List<String> allowed = new ArrayList<>();
|
||||
|
||||
Reference in New Issue
Block a user