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:
Jacques Le Roux
2022-03-17 18:09:35 +01:00
parent 86703f0063
commit f49bb67662
5 changed files with 15 additions and 11 deletions
@@ -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<>();