You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2022/02/23 11:02:01 UTC
[ofbiz-framework] branch release18.12 updated (1ed929c -> f65410b)
This is an automated email from the ASF dual-hosted git repository.
jleroux pushed a change to branch release18.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git.
from 1ed929c Fixed: Induction from DB does not represent relations properly. (OFBIZ-12178)
new d54abff Fixed: Trivial change in ProgramExport.groovy, uses the SecuredUpload import
new 0de23fa Fixed: Secure the uploads (OFBIZ-12080)
new f65410b Fixed: Prevent post-Auth vulnerability: FreeMarker Bypass (OFBIZ-12582)
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../apache/ofbiz/content/ContentManagementServices.java | 16 ++++++++++++++++
framework/security/config/security.properties | 6 +++---
.../webtools/groovyScripts/entity/ProgramExport.groovy | 5 ++++-
3 files changed, 23 insertions(+), 4 deletions(-)
[ofbiz-framework] 02/03: Fixed: Secure the uploads (OFBIZ-12080)
Posted by jl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jleroux pushed a commit to branch release18.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
commit 0de23fa780b4eeee0c3c20eb13993881f7f014d5
Author: Jacques Le Roux <ja...@les7arts.com>
AuthorDate: Wed Feb 23 09:33:17 2022 +0100
Fixed: Secure the uploads (OFBIZ-12080)
Adds some tokens in security.properties::deniedWebShellTokens
Updates SecurityUtilTest::webShellTokensTesting accordingly
# Conflicts handled by hand
framework/security/config/security.properties
framework/security/src/test/java/org/apache/ofbiz/security/SecurityUtilTest.java
---
framework/security/config/security.properties | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/framework/security/config/security.properties b/framework/security/config/security.properties
index 70fb232..9614d7f 100644
--- a/framework/security/config/security.properties
+++ b/framework/security/config/security.properties
@@ -221,11 +221,11 @@ allowAllUploads=
#-- "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...
#-- If you are sure you are safe for a token you can remove it, etc.
-deniedWebShellTokens=freemarker,<script,javascript,<body,<form,<jsp:,<c:out,taglib,<prefix,<%@ page,<?php,exec(\
+deniedWebShellTokens=java.,beans,freemarker,<script,javascript,<body,<form,<jsp:,<c:out,taglib,<prefix,<%@ page,<?php,exec(,\
%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,\
- python,perl ,/perl,ruby ,/ruby,process,function,class,InputStream,to_server,wget,\
- ifconfig,route,crontab,netstat,uname,hostname,iptables,whoami,"cmd",*cmd|,+cmd|,=cmd|,localhost
+ python,perl ,/perl,ruby ,/ruby,process,function,class,InputStream,to_server,wget ,static,\
+ ifconfig,route,crontab,netstat,uname ,hostname,iptables,whoami,"cmd",*cmd|,+cmd|,=cmd|,localhost
#-- Max line length for uploaded files, by default 10000
[ofbiz-framework] 03/03: Fixed: Prevent post-Auth vulnerability: FreeMarker Bypass (OFBIZ-12582)
Posted by jl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jleroux pushed a commit to branch release18.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
commit f65410ba1d6b13ea5edfb07aa43b65a8f296cb89
Author: Jacques Le Roux <ja...@les7arts.com>
AuthorDate: Wed Feb 23 11:46:18 2022 +0100
Fixed: Prevent post-Auth vulnerability: FreeMarker Bypass (OFBIZ-12582)
By inserting malicious content in the “Text” field from
“/content/control/updateLayoutSubContent” -> “Templates”, an attacker may
perform SSTI (Server-Side Template Injection) attacks, which can leverage
FreeMarker exposed objects to bypass restrictions and obtain RCE (Remote Code
Execution).
This fixes it by calling SecuredUpload::isValidText on the “Text” field content.
I'll check that there are no other attack opportunities...
Thanks: Mal Aware <aw...@gmail.com> for reporting this post-auth vulnerabily
Conflicts handled by hand in ContentManagementServices.java
---
.../apache/ofbiz/content/ContentManagementServices.java | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java b/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java
index c185266..368cc63 100644
--- a/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java
+++ b/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java
@@ -23,6 +23,7 @@ import java.io.IOException;
import java.math.BigDecimal;
import java.nio.ByteBuffer;
import java.sql.Timestamp;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
@@ -49,6 +50,7 @@ import org.apache.ofbiz.entity.condition.EntityOperator;
import org.apache.ofbiz.entity.model.ModelUtil;
import org.apache.ofbiz.entity.util.EntityQuery;
import org.apache.ofbiz.entity.util.EntityUtil;
+import org.apache.ofbiz.security.SecuredUpload;
import org.apache.ofbiz.security.Security;
import org.apache.ofbiz.service.DispatchContext;
import org.apache.ofbiz.service.GenericServiceException;
@@ -143,6 +145,20 @@ public class ContentManagementServices {
Map<String, Object> context = UtilMisc.makeMapWritable(rcontext);
Locale locale = (Locale) context.get("locale");
+ // Check if a webshell is not uploaded
+ String textData = (String) context.get("textData");
+ if (UtilValidate.isNotEmpty(textData)) {
+ try {
+ if (!SecuredUpload.isValidText(textData, Collections.emptyList())) {
+ Debug.logError("================== Not saved for security reason ==================", module);
+ return ServiceUtil.returnError("================== Not saved for security reason ==================");
+ }
+ } catch (IOException e) {
+ Debug.logError("================== Not saved for security reason ==================", module);
+ return ServiceUtil.returnError("================== Not saved for security reason ==================");
+ }
+ }
+
// Knowing why a request fails permission check is one of the more difficult
// aspects of content management. Setting "displayFailCond" to true will
// put an html table in result.errorMessage that will show what tests were performed
[ofbiz-framework] 01/03: Fixed: Trivial change in ProgramExport.groovy, uses the SecuredUpload import
Posted by jl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jleroux pushed a commit to branch release18.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
commit d54abff8c2252bd807d5e69b2499081ab5ee2585
Author: Jacques Le Roux <ja...@les7arts.com>
AuthorDate: Wed Feb 23 09:31:25 2022 +0100
Fixed: Trivial change in ProgramExport.groovy, uses the SecuredUpload import
No Functional change
Conflicts handled by hand in ProgramExport.groovy
---
framework/webtools/groovyScripts/entity/ProgramExport.groovy | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/framework/webtools/groovyScripts/entity/ProgramExport.groovy b/framework/webtools/groovyScripts/entity/ProgramExport.groovy
index 12b8293..bb37f42 100644
--- a/framework/webtools/groovyScripts/entity/ProgramExport.groovy
+++ b/framework/webtools/groovyScripts/entity/ProgramExport.groovy
@@ -20,6 +20,7 @@ import org.apache.ofbiz.entity.Delegator
import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.entity.model.ModelEntity
import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.security.SecuredUpload
import org.w3c.dom.Document
@@ -73,7 +74,9 @@ def shell = new GroovyShell(loader, binding, configuration)
if (UtilValidate.isNotEmpty(groovyProgram)) {
try {
- if (!org.apache.ofbiz.security.SecuredUpload.isValidText(groovyProgram,["import"])) {
+ // Check if a webshell is not uploaded but allow "import"
+ if (!SecuredUpload.isValidText(groovyProgram, ["import"])) {
+ logError("================== Not executed for security reason ==================")
request.setAttribute("_ERROR_MESSAGE_", "Not executed for security reason")
return
}