From 24a0e80dc25b143824b20616dd2cb61e00d3f1ea Mon Sep 17 00:00:00 2001 From: Mikolaj Izdebski Date: Fri, 13 Jun 2025 12:23:33 +0200 Subject: [PATCH] Fix improper access control vulnerability Resolves: CVE-2025-48734 Resolves: RHEL-94079 --- 0001-Fix-CVE-2025-48734.patch | 66 +++++++++++++++++++++++++++++++++++ apache-commons-beanutils.spec | 11 +++++- 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 0001-Fix-CVE-2025-48734.patch diff --git a/0001-Fix-CVE-2025-48734.patch b/0001-Fix-CVE-2025-48734.patch new file mode 100644 index 0000000..f4f5816 --- /dev/null +++ b/0001-Fix-CVE-2025-48734.patch @@ -0,0 +1,66 @@ +From 50e55ddeda5b26730a74f1a00871a8e0bf5a2131 Mon Sep 17 00:00:00 2001 +From: Gary Gregory +Date: Sun, 25 May 2025 09:07:32 -0400 +Subject: [PATCH] Fix CVE-2025-48734 + +Backported from upstream commit 28ad955a1613ed5885870cc7da52093c1ce739dc +--- + .../apache/commons/beanutils/PropertyUtilsBean.java | 1 + + .../beanutils/SuppressPropertiesBeanIntrospector.java | 11 +++++++++++ + .../org/apache/commons/beanutils/package-info.java | 6 ++++++ + 3 files changed, 18 insertions(+) + +diff --git a/src/main/java/org/apache/commons/beanutils/PropertyUtilsBean.java b/src/main/java/org/apache/commons/beanutils/PropertyUtilsBean.java +index 36eb7f57..04d99576 100644 +--- a/src/main/java/org/apache/commons/beanutils/PropertyUtilsBean.java ++++ b/src/main/java/org/apache/commons/beanutils/PropertyUtilsBean.java +@@ -189,6 +189,7 @@ public class PropertyUtilsBean { + introspectors.clear(); + introspectors.add(DefaultBeanIntrospector.INSTANCE); + introspectors.add(SuppressPropertiesBeanIntrospector.SUPPRESS_CLASS); ++ introspectors.add(SuppressPropertiesBeanIntrospector.SUPPRESS_DECLARING_CLASS); + } + + /** +diff --git a/src/main/java/org/apache/commons/beanutils/SuppressPropertiesBeanIntrospector.java b/src/main/java/org/apache/commons/beanutils/SuppressPropertiesBeanIntrospector.java +index bd6b2cdc..cff34969 100644 +--- a/src/main/java/org/apache/commons/beanutils/SuppressPropertiesBeanIntrospector.java ++++ b/src/main/java/org/apache/commons/beanutils/SuppressPropertiesBeanIntrospector.java +@@ -48,6 +48,17 @@ public class SuppressPropertiesBeanIntrospector implements BeanIntrospector { + public static final SuppressPropertiesBeanIntrospector SUPPRESS_CLASS = + new SuppressPropertiesBeanIntrospector(Collections.singleton("class")); + ++ /** ++ * A specialized instance which is configured to suppress the special {@code class} properties of Java beans. Unintended access to the call for ++ * {@code declaringClass} (which is common to all Java {@code enum}) can be a security risk because it also allows access to the class loader. Adding this ++ * instance as {@code BeanIntrospector} to an instance of {@code PropertyUtilsBean} suppresses the {@code class} property; it can then no longer be ++ * accessed. ++ * ++ * @since 1.11.0 ++ */ ++ public static final SuppressPropertiesBeanIntrospector SUPPRESS_DECLARING_CLASS = new SuppressPropertiesBeanIntrospector( ++ Collections.singleton("declaringClass")); ++ + /** A set with the names of the properties to be suppressed. */ + private final Set propertyNames; + +diff --git a/src/main/java/org/apache/commons/beanutils/package-info.java b/src/main/java/org/apache/commons/beanutils/package-info.java +index 3cb9d34c..ac8d2a1f 100644 +--- a/src/main/java/org/apache/commons/beanutils/package-info.java ++++ b/src/main/java/org/apache/commons/beanutils/package-info.java +@@ -444,6 +444,12 @@ + * SUPPRESS_CLASS constant of + * SuppressPropertiesBeanIntrospector.

+ * ++ *

Another problematic property is the {@code enum} "declaredClass" property, ++ * through which you can also access that class' class loader. The {@code SuppressPropertiesBeanIntrospector} ++ * provides {@code SUPPRESS_DECLARING_CLASS} to workaround this issue.

++ * ++ *

Both {@code SUPPRESS_CLASS} and {@code SUPPRESS_DECLARING_CLASS} are enabled by default.

++ * + * + *

3. Dynamic Beans (DynaBeans)

+ * +-- +2.49.0 + diff --git a/apache-commons-beanutils.spec b/apache-commons-beanutils.spec index 2a906f1..100fd10 100644 --- a/apache-commons-beanutils.spec +++ b/apache-commons-beanutils.spec @@ -2,13 +2,17 @@ Name: apache-commons-beanutils Version: 1.9.4 -Release: 9%{?dist} +Release: 10%{?dist} Summary: Java utility methods for accessing and modifying the properties of arbitrary JavaBeans License: ASL 2.0 URL: http://commons.apache.org/beanutils BuildArch: noarch +ExclusiveArch: %{java_arches} noarch + Source0: http://archive.apache.org/dist/commons/beanutils/source/commons-beanutils-%{version}-src.tar.gz +Patch0: 0001-Fix-CVE-2025-48734.patch + BuildRequires: maven-local %if %{with bootstrap} BuildRequires: javapackages-bootstrap @@ -32,6 +36,7 @@ Summary: Javadoc for %{name} %prep %setup -q -n commons-beanutils-%{version}-src +%patch 0 -p1 sed -i 's/\r//' *.txt %pom_remove_plugin :maven-assembly-plugin @@ -56,6 +61,10 @@ sed -i 's/\r//' *.txt %doc LICENSE.txt NOTICE.txt %changelog +* Fri Jun 13 2025 Mikolaj Izdebski +- Fix improper access control vulnerability +- Resolves: CVE-2025-48734 + * Mon Aug 09 2021 Mohan Boddu - 1.9.4-9 - Rebuilt for IMA sigs, glibc 2.34, aarch64 flags Related: rhbz#1991688