Search
Find a vulnerability
Search criteria
1 vulnerability found for Struts2 Spring by Apache
GCVE-1988-2026-0530
Vulnerability from gna-1988 – Published: 2026-11-02 09:47 – Updated: 2026-11-02 09:47
VLAI
EPSS
VEX
Title
Apache Struts2 Spring Plugin Uses a Previously Closed Resource
Summary
Description
The Apache Struts2 Spring Plugin opens a Spring `ApplicationContex` via a try-with-resources block and, outside of said
block, then continues to use the closed resource, resulting in an uncaught `IllegalStateException`. This particular
issue prevents proper functionality and indicates poor code quality and code review standards and processes, while not
being, itself, otherwise excessively meaningful for a production environment (as developer mode should not be enabled
in such an environment), although it would hamper staging, test, and developer environments that are configured in
accordance with Apache-recommended hot-reload configurations for such environments
(https://struts.apache.org/plugins/spring/#class-reloading).
Impact
Anyone who follows Struts' documented configuration for this plugin -- enabling `struts.devMode`, setting a non-blank
`struts.objectFactory.spring.class.reloading.watchList`, and declaring `ClassReloadingXMLWebApplicationContext` as the
root context class in web.xml -- will trigger this pathway on every application startup. Since close() call `null`s
the context's internal bean factory immediately after `refresh()` succeeds,
`SpringObjectFactory.setApplicationContext()`call to `getBeanFactory()` throws an uncaught `IllegalStateException`,
aborting the Struts-Spring integration startup process before it can ever finish. Even if the exception were caught,
`close()` has already stopped the `FilesystemAlterationMonitor` watchdog thread, so the live class-reloading capability
would never fire a single reload. As such, the hot-reload feature cannot and does not work with this
Apache-recommended configuration.
Examples
Sample Code
The code below clearly shows the issue when in developer, a watch list, and hot-reloading are enabled. The
try-with-resources calls `.close()` when exiting, against `reloadingContext`, which is merely a pointer to
`appContext`, thereby closing `appContext`. Immediately after exiting the try-with-resources and wrapping conditional,
`this. setApplicationContext` is called, passing in the now closed `appContext`. Importantly, `
ClassReloadingXMLWebApplicationContext`, to which `appContext` was cast during the initialisation of the
try-with-resources and against which the `finally` that this construct generates (try-with-resources effectively being
syntactic sugar for a `try{...} finally{reloadingContext.close()}`), has a `close()` defined that calls to
`super.close()` before removing and stopping the listener.
```java
String watchList = container.getInstance(String.class,
SpringConstants.STRUTS_OBJECTFACTORY_SPRING_CLASS_RELOADING_WATCH_LIST);
String acceptClasses = container.getInstance(String.class,
SpringConstants.STRUTS_OBJECTFACTORY_SPRING_CLASS_RELOADING_ACCEPT_CLASSES);
String reloadConfig = container.getInstance(String.class,
SpringConstants.STRUTS_OBJECTFACTORY_SPRING_CLASS_RELOADING_RELOAD_CONFIG);
if ("true".equals(devMode)
&& StringUtils.isNotBlank(watchList)
&& appContext instanceof ClassReloadingXMLWebApplicationContext) {
//prevent class caching
useClassCache = false;
try (ClassReloadingXMLWebApplicationContext reloadingContext = (ClassReloadingXMLWebApplicationContext)
appContext) {
reloadingContext.setupReloading(watchList.split(","), acceptClasses, servletContext,
"true".equals(reloadConfig));
LOG.info("Class reloading is enabled. Make sure this is not used on a production environment!\n{}",
watchList);
setClassLoader(reloadingContext.getReloadingClassLoader());
// we need to reload the context, so our isntance of the factory is picked up
reloadingContext.refresh();
}
}
this.setApplicationContext(appContext);
```
Code snippet from `struts2-spring-plugin`'s
plugins/spring/src/main/java/org/apache/struts2/spring/StrutsSpringObjectFactory.java, lines 97-120
```java
public void close() {
super.close();
if (filesystemAlterationMonitor != null) {
filesystemAlterationMonitor.removeListener(this);
filesystemAlterationMonitor.stop();
}
}
```
Snippet from `struts2-spring-plugin`'s
plugins/spring/src/main/java/org/apache/struts2/spring/ClassReloadingXMLWebApplicationContext.java, lines 157-164,
showing the close() override invoked by the implicit try-with-resources call
_______________________________________________
Sent through the Full Disclosure mailing list
https://nmap.org/mailman/listinfo/fulldisclosure
Web Archives & RSS: https://seclists.org/fulldisclosure/
Severity
No CVSS data available.
Assigner
References
5 references
Impacted products
1 product
| Vendor | Product | Version | |
|---|---|---|---|
| Apache | Struts2 Spring |
Affected:
unknown
|
{
"containers": {
"cna": {
"affected": [
{
"product": "Struts2 Spring",
"vendor": "Apache",
"versions": [
{
"status": "affected",
"version": "unknown"
}
]
}
],
"credits": [
{
"lang": "en",
"type": "finder",
"value": "Daniel Owens via Fulldisclosure"
}
],
"descriptions": [
{
"lang": "en",
"value": "Description\nThe Apache Struts2 Spring Plugin opens a Spring `ApplicationContex` via a try-with-resources block and, outside of said \nblock, then continues to use the closed resource, resulting in an uncaught `IllegalStateException`. This particular \nissue prevents proper functionality and indicates poor code quality and code review standards and processes, while not \nbeing, itself, otherwise excessively meaningful for a production environment (as developer mode should not be enabled \nin such an environment), although it would hamper staging, test, and developer environments that are configured in \naccordance with Apache-recommended hot-reload configurations for such environments \n(https://struts.apache.org/plugins/spring/#class-reloading).\n\nImpact\nAnyone who follows Struts\u0027 documented configuration for this plugin -- enabling `struts.devMode`, setting a non-blank \n`struts.objectFactory.spring.class.reloading.watchList`, and declaring `ClassReloadingXMLWebApplicationContext` as the \nroot context class in web.xml -- will trigger this pathway on every application startup. Since close() call `null`s \nthe context\u0027s internal bean factory immediately after `refresh()` succeeds, \n`SpringObjectFactory.setApplicationContext()`call to `getBeanFactory()` throws an uncaught `IllegalStateException`, \naborting the Struts-Spring integration startup process before it can ever finish. Even if the exception were caught, \n`close()` has already stopped the `FilesystemAlterationMonitor` watchdog thread, so the live class-reloading capability \nwould never fire a single reload. As such, the hot-reload feature cannot and does not work with this \nApache-recommended configuration.\n\nExamples\nSample Code\nThe code below clearly shows the issue when in developer, a watch list, and hot-reloading are enabled. The \ntry-with-resources calls `.close()` when exiting, against `reloadingContext`, which is merely a pointer to \n`appContext`, thereby closing `appContext`. Immediately after exiting the try-with-resources and wrapping conditional, \n`this. setApplicationContext` is called, passing in the now closed `appContext`. Importantly, ` \nClassReloadingXMLWebApplicationContext`, to which `appContext` was cast during the initialisation of the \ntry-with-resources and against which the `finally` that this construct generates (try-with-resources effectively being \nsyntactic sugar for a `try{...} finally{reloadingContext.close()}`), has a `close()` defined that calls to \n`super.close()` before removing and stopping the listener.\n\n```java\n String watchList = container.getInstance(String.class, \nSpringConstants.STRUTS_OBJECTFACTORY_SPRING_CLASS_RELOADING_WATCH_LIST);\n String acceptClasses = container.getInstance(String.class, \nSpringConstants.STRUTS_OBJECTFACTORY_SPRING_CLASS_RELOADING_ACCEPT_CLASSES);\n String reloadConfig = container.getInstance(String.class, \nSpringConstants.STRUTS_OBJECTFACTORY_SPRING_CLASS_RELOADING_RELOAD_CONFIG);\n\n if (\"true\".equals(devMode)\n \u0026\u0026 StringUtils.isNotBlank(watchList)\n \u0026\u0026 appContext instanceof ClassReloadingXMLWebApplicationContext) {\n //prevent class caching\n useClassCache = false;\n\n try (ClassReloadingXMLWebApplicationContext reloadingContext = (ClassReloadingXMLWebApplicationContext) \nappContext) {\n reloadingContext.setupReloading(watchList.split(\",\"), acceptClasses, servletContext,\n \"true\".equals(reloadConfig));\n LOG.info(\"Class reloading is enabled. Make sure this is not used on a production environment!\\n{}\",\n watchList);\n\n setClassLoader(reloadingContext.getReloadingClassLoader());\n\n // we need to reload the context, so our isntance of the factory is picked up\n reloadingContext.refresh();\n }\n }\n\n this.setApplicationContext(appContext);\n```\nCode snippet from `struts2-spring-plugin`\u0027s \nplugins/spring/src/main/java/org/apache/struts2/spring/StrutsSpringObjectFactory.java, lines 97-120\n\n```java\n public void close() {\n super.close();\n\n if (filesystemAlterationMonitor != null) {\n filesystemAlterationMonitor.removeListener(this);\n filesystemAlterationMonitor.stop();\n }\n }\n```\nSnippet from `struts2-spring-plugin`\u0027s \nplugins/spring/src/main/java/org/apache/struts2/spring/ClassReloadingXMLWebApplicationContext.java, lines 157-164, \nshowing the close() override invoked by the implicit try-with-resources call\n_______________________________________________\nSent through the Full Disclosure mailing list\nhttps://nmap.org/mailman/listinfo/fulldisclosure\nWeb Archives \u0026 RSS: https://seclists.org/fulldisclosure/"
}
],
"providerMetadata": {
"dateUpdated": "2026-11-02T09:47:23Z",
"orgId": "4e2abfbf-4a2a-4b76-a4e0-d77c18ba156c",
"shortName": "VULNARCHIVE"
},
"references": [
{
"tags": [
"technical-description"
],
"url": "https://vuln.freearchive.org/archive/full-disclosure/2026/Nov/5"
},
{
"tags": [
"technical-description"
],
"url": "https://seclists.org/fulldisclosure/2026/Nov/5"
},
{
"url": "https://nmap.org/mailman/listinfo/fulldisclosure"
},
{
"url": "https://seclists.org/fulldisclosure/"
},
{
"url": "https://struts.apache.org/plugins/spring/#class-reloading"
}
],
"source": {
"defect": [
"https://seclists.org/fulldisclosure/2026/Nov/5"
],
"discovery": "EXTERNAL"
},
"title": "Apache Struts2 Spring Plugin Uses a Previously Closed Resource",
"x_gcve": [
{
"recordType": "advisory",
"relationships": [],
"vulnId": "GCVE-1988-2026-0530",
"x_vulnarchive": {
"archiveUrl": "https://vuln.freearchive.org/archive/full-disclosure/2026/Nov/5",
"automated": true,
"contentSha256": "1ba77d73727b6f2ebe1ffe04e9e1f5d109fc13c74e93df5e211b3a85887563e5",
"evidenceScore": 6,
"messageId": "",
"originalUrl": "https://seclists.org/fulldisclosure/2026/Nov/5",
"policy": "vulnarchive-1",
"sourceFormat": "text/html",
"sourcePublishedAt": "2026-10-31T19:46:10Z"
}
}
]
}
},
"cveMetadata": {
"assignerOrgId": "4e2abfbf-4a2a-4b76-a4e0-d77c18ba156c",
"assignerShortName": "VULNARCHIVE",
"datePublished": "2026-11-02T09:47:23Z",
"dateUpdated": "2026-11-02T09:47:23Z",
"state": "PUBLISHED",
"vulnId": "GCVE-1988-2026-0530"
},
"dataType": "CVE_RECORD",
"dataVersion": "5.2"
}