Fixed: Remote Code Execution (File Upload) Vulnerability (OFBIZ-11948)
I forgot about SecurityUtilTest::webShellTokensTesting. This fixes it. Note that I expect to simplify and remove more tokens for PHP, but I have 1st other things to do...
This commit is contained in:
@@ -238,9 +238,10 @@ allowAllUploads=
|
||||
#-- eg: https://www.acunetix.com/blog/articles/detection-prevention-introduction-web-shells-part-5/
|
||||
#-- "freemarker" should be OK, should not be used in Freemarker templates, not part of the syntax.
|
||||
#-- Else "template.utility.Execute" is a good replacement but not as much catching, who knows...
|
||||
deniedWebShellTokens=<%,<jsp:,<?,#!,freemarker,<script,javascript,%eval,@eval,<body>,<form,\
|
||||
deniedWebShellTokens=<%,<jsp,<?,#!,freemarker,<script,javascript,%eval,@eval,<body>,<form,\
|
||||
import os,passthru,exec,shell_exec,assert,str_rot13,system,base64_decode,chmod,mkdir,\
|
||||
fopen,fclose,new file,import,upload,getfilename,download,getoutputstring,readfile
|
||||
#-- IMPORTANT: when you change things here you need to do accordingly in SecurityUtilTest::webShellTokensTesting--
|
||||
|
||||
#-- Popup last-visited time from database after user has logged in.
|
||||
#-- So users can know of any unauthorised access to their accounts.
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
*/
|
||||
package org.apache.ofbiz.security;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -25,10 +29,6 @@ import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class SecurityUtilTest {
|
||||
@Test
|
||||
public void basicAdminPermissionTesting() {
|
||||
@@ -64,17 +64,18 @@ public class SecurityUtilTest {
|
||||
assertTrue(SecuredUpload.isValidText("hack.getFileName", allowed));
|
||||
allowed = new ArrayList<>();
|
||||
assertFalse(SecuredUpload.isValidText("hack.getFileName", allowed));
|
||||
|
||||
assertFalse(SecuredUpload.isValidText("<%", allowed));
|
||||
assertFalse(SecuredUpload.isValidText("<jsp", allowed));
|
||||
assertFalse(SecuredUpload.isValidText("<?", allowed));
|
||||
assertFalse(SecuredUpload.isValidText("#!", allowed));
|
||||
assertFalse(SecuredUpload.isValidText("freemarker", allowed));
|
||||
assertFalse(SecuredUpload.isValidText("import=\"java", allowed));
|
||||
assertFalse(SecuredUpload.isValidText("runtime.getruntime().exec(", allowed));
|
||||
assertFalse(SecuredUpload.isValidText("<%@ page", allowed));
|
||||
assertFalse(SecuredUpload.isValidText("<script", allowed));
|
||||
assertFalse(SecuredUpload.isValidText("<body>", allowed));
|
||||
assertFalse(SecuredUpload.isValidText("<form", allowed));
|
||||
assertFalse(SecuredUpload.isValidText("php", allowed));
|
||||
assertFalse(SecuredUpload.isValidText("javascript", allowed));
|
||||
assertFalse(SecuredUpload.isValidText("%eval", allowed));
|
||||
assertFalse(SecuredUpload.isValidText("@eval", allowed));
|
||||
assertFalse(SecuredUpload.isValidText("<body>", allowed));
|
||||
assertFalse(SecuredUpload.isValidText("<form", allowed));
|
||||
assertFalse(SecuredUpload.isValidText("import os", allowed));
|
||||
assertFalse(SecuredUpload.isValidText("passthru", allowed));
|
||||
assertFalse(SecuredUpload.isValidText("exec", allowed));
|
||||
@@ -82,7 +83,6 @@ public class SecurityUtilTest {
|
||||
assertFalse(SecuredUpload.isValidText("assert", allowed));
|
||||
assertFalse(SecuredUpload.isValidText("str_rot13", allowed));
|
||||
assertFalse(SecuredUpload.isValidText("system", allowed));
|
||||
assertFalse(SecuredUpload.isValidText("phpinfo", allowed));
|
||||
assertFalse(SecuredUpload.isValidText("base64_decode", allowed));
|
||||
assertFalse(SecuredUpload.isValidText("chmod", allowed));
|
||||
assertFalse(SecuredUpload.isValidText("mkdir", allowed));
|
||||
|
||||
Reference in New Issue
Block a user