The vulnerability lies in the Jenkins Pipeline: Groovy Libraries Plugin's failure to prohibit symbolic links within shared libraries. An attacker with control over the source code of a shared library could introduce a symbolic link pointing to an arbitrary file on the Jenkins controller's filesystem. When a Jenkins Pipeline job uses this malicious library, it could read the contents of the linked file, leading to information disclosure.
The patch addresses this by introducing a new static method, org.jenkinsci.plugins.workflow.libs.SCMBasedRetriever.rejectSpecialFiles. This method recursively scans a given directory path and throws an AbortException if it encounters a symbolic link or any other non-regular file or directory.
This new security check is integrated into the library retrieval process. Specifically, the org.jenkinsci.plugins.workflow.libs.LibraryAdder.retrieve and org.jenkinsci.plugins.workflow.libs.SCMBasedRetriever.doRetrieve methods, which are central to fetching and loading shared libraries, were modified to call rejectSpecialFiles. These functions are the key points in the execution flow where the vulnerability could be exploited, as they are responsible for making the library's contents available to the Pipeline job. Before the patch, these functions would process libraries without this crucial validation step.