You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mr...@apache.org on 2026/08/07 17:50:54 UTC
(ofbiz-framework) branch release24.09 updated: Fixed: isExecutable() missed Tika's ELF sub-types, letting real Linux binaries through the check (OFBIZ-13486)
This is an automated email from the ASF dual-hosted git repository.
mridulpathak pushed a commit to branch release24.09
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/release24.09 by this push:
new 2acee62d39 Fixed: isExecutable() missed Tika's ELF sub-types, letting real Linux binaries through the check (OFBIZ-13486)
2acee62d39 is described below
commit 2acee62d3995e04b705810c06f24ec5cf6f7cd6c
Author: Mridul Pathak <mr...@gmail.com>
AuthorDate: Fri Aug 7 23:20:48 2026 +0530
Fixed: isExecutable() missed Tika's ELF sub-types, letting real Linux binaries through the check (OFBIZ-13486)
SecuredUpload.isExecutable() only matched the generic mimeType application/x-elf, but Tika (verified against tika-core:3.3.1) classifies real ELF binaries into more specific sub-types instead — application/x-executable, application/x -sharedlib, application/x-object, application/x-coredump — so actual executables and shared libraries passed the check undetected. Confirmed with two real ELF files (a JNA native .so and a JDK's bin/java PIE executable), both detected as application/x-sha [...]
---
.../src/main/java/org/apache/ofbiz/security/SecuredUpload.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/framework/security/src/main/java/org/apache/ofbiz/security/SecuredUpload.java b/framework/security/src/main/java/org/apache/ofbiz/security/SecuredUpload.java
index 41cf8e2d1f..ae4f33920f 100644
--- a/framework/security/src/main/java/org/apache/ofbiz/security/SecuredUpload.java
+++ b/framework/security/src/main/java/org/apache/ofbiz/security/SecuredUpload.java
@@ -1109,8 +1109,14 @@ public class SecuredUpload {
Debug.logError("The file " + fileName + " is a Windows executable, for security reason it's not accepted", MODULE);
return true;
}
- // Check for ELF (Linux) and scripts
+ // Check for ELF (Linux) and scripts. Tika reports the generic application/x-elf only for
+ // ELF files it can't further classify; real-world binaries are detected as one of its
+ // more specific sub-types below (e.g. every PIE-compiled executable or shared library).
if ("application/x-elf".equals(mimeType)
+ || "application/x-executable".equals(mimeType)
+ || "application/x-sharedlib".equals(mimeType)
+ || "application/x-object".equals(mimeType)
+ || "application/x-coredump".equals(mimeType)
|| "application/x-sh".equals(mimeType)
|| "text/x-perl".equals(mimeType)
|| "text/x-ruby".equals(mimeType)