Spring AI PDF Reader StackOverflowError — CVE-2026-47851
A PDF with a deeply nested or cyclic table of contents can trigger a StackOverflowError in Spring AI ingestion. Check your version and the path to a fix.
If you read PDFs with Spring AI, start with CVE-2026-47851 (2026-08-20, High), an availability flaw: analyzing a PDF with a deeply nested or cyclic table of contents can cause a StackOverflowError in the ingestion thread. It concerns services that read uploaded PDFs into RAG documents. The affected versions are 2.0.0, 1.1.0 through 1.1.8, and 1.0.0 through 1.0.9.
[1] Read the Spring AI version you use. The PDF reader artifact is spring-ai-pdf-document-reader. With a build tool, print the dependency tree.
$ ./mvnw dependency:tree -Dincludes=org.springframework.ai$ ./gradlew dependencies --configuration runtimeClasspath | grep spring-aiFor a built executable jar, look at the file names inside. The result below is from a test app.jar that holds spring-ai-pdf-document-reader-1.1.8.jar under BOOT-INF/lib.
$ unzip -l app.jar | grep -E 'spring-(security|data|ai)' | awk '{print $4}'BOOT-INF/lib/spring-ai-pdf-document-reader-1.1.8.jarA single jar also records its version in the manifest.
$ unzip -p spring-ai-pdf-document-reader-1.1.8.jar META-INF/MANIFEST.MF | grep -E 'Implementation-(Title|Version)'Implementation-Title: spring-ai-pdf-document-readerImplementation-Version: 1.1.8[2] Match against the advisory's affected and fixed versions.
| Line | Affected | Fixed | Open source? |
|---|---|---|---|
| 2.0 | 2.0.0 | 2.0.1 | Open source |
| 1.1 | 1.1.0 to 1.1.8 | 1.1.9 | Enterprise Support Only |
| 1.0 | 1.0.0 to 1.0.9 | 1.0.10 | Enterprise Support Only |
For 2.0.0 the Enterprise side also has a separate fix, 2.0.0.1. The 1.1.8 from step 1 is an affected version.
[3] Check that a fixed version can be downloaded from the public repository. Maven Central answers 200 when the jar exists and 404 when it does not.
$ for v in 1.0.9 1.0.10 1.1.8 1.1.9 2.0.1; do echo "$v $(curl -s -o /dev/null -w '%{http_code}' -I https://repo.maven.apache.org/maven2/org/springframework/ai/spring-ai-pdf-document-reader/$v/spring-ai-pdf-document-reader-$v.jar)"; done1.0.9 2001.0.10 4041.1.8 2001.1.9 4042.0.1 200The last public releases of 1.0 and 1.1 are the affected ones (1.0.9 and 1.1.8), and the fixes 1.0.10 and 1.1.9 are not published. 2.0.1 is. A project that stays on 1.x either gets 1.1.9 or 1.0.10 through Enterprise Support, or moves to 2.0.1 or later. Read Spring AI's migration documentation separately before moving from 1.x to 2.0.
[4] Find out whether the version comes from a BOM or is written directly. The Spring Boot dependency versions table (Boot 4.1.2 docs) has no org.springframework.ai entry, so the Spring AI version is set by your project's BOM or properties, not by Boot.
$ grep -rnE "spring-ai" pom.xml build.gradle build.gradle.kts[5] Find where PDFs come from and which code reads them with this reader. The advisory describes the problem as the table-of-contents structure of the PDF. A path that reads PDFs uploaded by outside users is the first to upgrade. The search above finds code that uses classes with PdfDocumentReader in the name, such as PagePdfDocumentReader, and the artifact name in build files. The advisory names no class, so on an affected version upgrade whichever reader of this artifact you use.
$ grep -rnE "PdfDocumentReader|spring-ai-pdf-document-reader" src/ pom.xml build.gradle build.gradle.kts[6] After changing versions, run step 1 again and confirm the version is at or above the fixed one in the step 2 table. The advisory says no further mitigation steps exist, so the upgrade is the only action.
Where the check goes wrong
- A fixed version number in the advisory does not mean you can download it. 1.0.10 and 1.1.9 return 404 on Maven Central.
- In this lookup, the Maven Central list for
spring-ai-pdf-document-readeralso had 2.0.2 after 2.0.1. The advisory names 2.0.1 as the fix, so 2.0.1 or later is enough. - The advisory states affected versions as Spring AI version numbers. This check used the PDF reader artifact, and other artifacts with the same numbers were not checked.