CVE-2026-59339
Patch Available.
This Vulnerability has been fixed in the Never-Ending Support (NES) version offered by HeroDevs.
Overview
Spring AI is a Spring project that provides a Spring-friendly API and abstractions for developing AI applications, including portable vector store support with a common metadata filter expression language.
A denial of service (DoS) vulnerability (CVE-2026-59339) has been identified in the FilterExpressionTextParser of Spring AI's vector store module, which allows attackers to crash request-handling threads with a StackOverflowError by supplying a deeply nested filter expression. Repeated submissions against a bounded worker pool can degrade or deny service to all users.
Per OWASP: The Denial of Service (DoS) attack is focused on making a resource (site, application, server) unavailable for the purpose it was designed.
This issue affects multiple versions of Spring AI.
Details
Module Info
- Product: Spring AI
- Affected packages:
org.springframework.ai:spring-ai-vector-store - Affected versions: >=1.0.0 <=1.0.10, >=1.1.0 <=1.1.9, >=2.0.0 <=2.0.2
- GitHub repository: https://github.com/spring-projects/spring-ai
- Published packages: https://central.sonatype.com/artifact/org.springframework.ai/spring-ai-vector-store
- Package manager: Maven
- Fixed in:
- OSS Spring AI 2.0.3
Vulnerability Info
This High-severity vulnerability is found in the org.springframework.ai:spring-ai-vector-store package in multiple versions of Spring AI.
FilterExpressionTextParser turns a text filter expression, such as genre == 'drama' && year >= 2020, into a Filter.Expression tree that vector stores use to filter similarity searches. It is backed by an ANTLR4 recursive-descent parser generated from the Filters.g4 grammar, in which two alternatives of the booleanExpression rule recurse directly into the same rule:
booleanExpression
...
| LEFT_PARENTHESIS booleanExpression RIGHT_PARENTHESIS # GroupExpression
| NOT booleanExpression # NotExpression
;
Every opening parenthesis or prefix NOT adds another level of Java call frames, both in the generated parser and in the visitor that builds the expression tree. The parser places no limit on this nesting depth, and parse() only handles the exception ANTLR raises for syntax errors:
var filterExpressionVisitor = new FilterExpressionVisitor();
try {
Filter.Operand operand = filterExpressionVisitor.visit(parser.where());
var filterExpression = filterExpressionVisitor.castToExpression(operand);
this.cache.putIfAbsent(textFilterExpression, filterExpression);
return filterExpression;
}
catch (ParseCancellationException e) {
var msg = String.join("", this.errorListener.errorMessages);
var rootCause = NestedExceptionUtils.getRootCause(e);
throw new FilterExpressionParseException(msg, rootCause);
}
A filter expression wrapped in tens of thousands of nested parentheses therefore drives the parser into unbounded recursion, exhausts the calling thread's stack and terminates it with an uncaught StackOverflowError instead of a FilterExpressionParseException. Applications are exposed when filter expressions come from untrusted input, for example runtime filter expressions passed through QuestionAnswerAdvisor.FILTER_EXPRESSION or SearchRequest.Builder.filterExpression(String) in retrieval-augmented generation pipelines. Each crash is limited to the thread that parsed the expression, but an attacker who repeatedly submits such expressions can keep a bounded worker pool busy failing and deny service to legitimate users.
Steps to Reproduce
- Add
org.springframework.ai:spring-ai-vector-storefrom an affected version (for example 1.1.8) to a Java project. - Run the following code, which parses a filter expression wrapped in 50,000 levels of parentheses:
import org.springframework.ai.vectorstore.filter.FilterExpressionTextParser; public class Repro { public static void main(String[] args) { int depth = 50_000; String expression = "(".repeat(depth) + "genre == 'drama'" + ")".repeat(depth); new FilterExpressionTextParser().parse(expression); } } - The call fails with
java.lang.StackOverflowErrorrather than aFilterExpressionParseException.
Mitigation
Only recent versions of Spring AI receive community support. Older lines are End-of-Life and will not receive public updates to address this issue.
Users of the affected components should apply one of the following mitigations:
- Upgrade to a currently supported version of Spring AI.
- Leverage a commercial support partner like HeroDevs for post-EOL security support.
Credits
- Tim Zheng (finder)
- Sai Sreewathsa Kovalluri from Innspark Solutions (finder)
- Kannan K from Innspark Solutions (finder)
- Shon Babu from Innspark Solutions (finder)