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 2021/11/23 09:45:54 UTC
[ofbiz-framework] branch release18.12 updated: Fixed: CVE-2021-37608 vulnerability bypass (OFBIZ-12307) (#352)
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
The following commit(s) were added to refs/heads/release18.12 by this push:
new 2222bd2 Fixed: CVE-2021-37608 vulnerability bypass (OFBIZ-12307) (#352)
2222bd2 is described below
commit 2222bd21b7e57f8b86acf0753528a52f088fc3bb
Author: rohitkou <93...@users.noreply.github.com>
AuthorDate: Tue Nov 23 15:05:41 2021 +0530
Fixed: CVE-2021-37608 vulnerability bypass (OFBIZ-12307) (#352)
Fixed the Additional image uploading issue which got somehow missed in service addAdditionalViewForProduct.
Co-authored-by: Rohit Koushal <ro...@gmail.com>
---
.../main/java/org/apache/ofbiz/product/product/ProductServices.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java
index 5f81e02..3a9aa55 100644
--- a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java
+++ b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java
@@ -1055,10 +1055,13 @@ public class ProductServices {
String fileToCheck = imageServerPath + "/" + fileLocation + "." + extension.getString("fileExtensionId");
File file = new File(fileToCheck);
try {
- if (!org.apache.ofbiz.security.SecuredUpload.isValidFile(fileToCheck, "Image", delegator)) {
+ Path tempFile = Files.createTempFile(null, null);
+ Files.write(tempFile, imageData.array(), StandardOpenOption.APPEND);
+ if (!org.apache.ofbiz.security.SecuredUpload.isValidFile(tempFile.toString(), "Image", delegator)) {
String errorMessage = UtilProperties.getMessage("SecurityUiLabels", "SupportedImageFormats", locale);
return ServiceUtil.returnError(errorMessage);
}
+ Files.delete(tempFile);
RandomAccessFile out = new RandomAccessFile(fileToCheck, "rw");
out.write(imageData.array());
out.close();