The vulnerability is due to an algorithmic flaw in the sha256crypt and sha512crypt implementations, specifically in how the password length affects the number of operations. The provided text file 'SHA-crypt.txt' details this algorithm and includes the C source code. Step 14 of the algorithm, which involves iterating through the password for each byte of the password, is the root cause of the O(n^2) complexity. The functions sha256_crypt_r and sha512_crypt_r directly implement this algorithm, and their respective wrapper functions sha256_crypt and sha512_crypt are therefore also vulnerable. No specific patch was provided, so the analysis relies on the description of the algorithm and the provided source code within the text file.