SecItemCopyMatching returns errSecAuthFailed (-25293) after macOS 26.4 upgrade — persists until SecKeychainLock/Unlock

We've filed FB22448572 for this, but posting here in case others are hitting the same issue.

After upgrading macOS from 26.3.2 to 26.4, SecItemCopyMatching returns errSecAuthFailed (-25293) when reading kSecClassGenericPassword items from the default login keychain. The keychain reports as unlocked, but all authenticated operations fail. The error doesn't self-resolve — we've observed it persisting for 7+ minutes across repeated calls and process restarts.

The only workaround we've found is SecKeychainLock(nil) followed by SecKeychainUnlock(nil, 0, nil, false), which prompts the user for their password and clears the stale state.

Apple's own security CLI tool also fails while the keychain is in this state:

$ security show-keychain-info ~/Library/Keychains/login.keychain-db security: SecKeychainCopySettings .../login.keychain-db: The user name or passphrase you entered is not correct.

The trigger seems to be process lifecycle — a new process accessing the keychain early in startup (e.g., from the app delegate) can hit this state after the OS upgrade. It's probabilistic: not every machine and not every restart, but once it happens, it sticks until manual intervention.

We're an enterprise app using legacy keychain APIs (SecKeychainCopyDefault, kSecUseKeychain) deployed to thousands of managed devices. We've reproduced this on multiple machines (M1, M2) and have reports from customers in the field after the 26.4 upgrade.

I noticed a possibly related thread — Calling SecKeychainUnlock with a locked keychain and an invalid password returns errSecSuccess on macOS 26.4 — where SecKeychainUnlock stopped properly validating passwords after 26.4. Our symptom is different (reads fail on an unlocked keychain rather than unlock succeeding with wrong password), but both appeared after 26.4 and both point to something changing in securityd's authentication handling. Wondering if these could be related.

A couple of questions:

Is there a known issue with securityd's keychain authentication after 26.4? Could this be related to the CVE-2026-28864 fix ("improved permissions checking" in the Security component)? Would migrating to the data protection keychain (kSecAttrAccessible instead of kSecUseKeychain) avoid this class of issue entirely? Is there a way to detect and clear this stale state programmatically without the user entering their password? Any guidance appreciated.

Answered by DTS Engineer in 883955022
We've filed FB22448572 for this

Thanks. That’s the best path forward for this.

Is there a known issue with securityd’s keychain authentication after 26.4?

Well there is now that you’ve filed a bug about it (-:

Seriously though, as I mentioned on that other thread you found, macOS 26.4 has significant changes to how we unlock the login keychain. In that thread, the developer is doing something unusual, and it’s not clear what the right path forward is. But in your case my understanding is that you’re doing something pedestrian — accessing a keychain item from early in your app’s lifecycle — and that makes the path forward clear: File a bug so that the keychain team can investigate. Which is what you’ve done (-:

Would migrating to the data protection keychain … avoid this class of issue entirely?

It’s hard to be 100% sure without knowing exactly what’s causing the problem, but I think it’s very likely that the answer to your question is is “Yes.”

Additionally, moving to the data protection keychain is a good idea regardless. So, unless there’s something blocking you from doing that [1], it’s something to consider.

Of course, writing, testing, and deploying that code isn’t trivial. And you’ll likely want a mechanism to migrate your keychain items from the login keychain to the data protection keychain, and that code might hit exactly this issue )-:

kSecAttrAccessible instead of kSecUseKeychain

Just to be clear, the best way to enable the data protection keychain is kSecUseDataProtectionKeychain. Once you do that, you can then use attributes, like kSecAttrAccessible, that are specific to that keychain.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] TN3137 describes one case where that’s not possible, namely, where you need to use the keychain from a daemon. That doesn’t apply here, but I can imagine there are other cases that I’ve not thought about.

We've filed FB22448572 for this

Thanks. That’s the best path forward for this.

Is there a known issue with securityd’s keychain authentication after 26.4?

Well there is now that you’ve filed a bug about it (-:

Seriously though, as I mentioned on that other thread you found, macOS 26.4 has significant changes to how we unlock the login keychain. In that thread, the developer is doing something unusual, and it’s not clear what the right path forward is. But in your case my understanding is that you’re doing something pedestrian — accessing a keychain item from early in your app’s lifecycle — and that makes the path forward clear: File a bug so that the keychain team can investigate. Which is what you’ve done (-:

Would migrating to the data protection keychain … avoid this class of issue entirely?

It’s hard to be 100% sure without knowing exactly what’s causing the problem, but I think it’s very likely that the answer to your question is is “Yes.”

Additionally, moving to the data protection keychain is a good idea regardless. So, unless there’s something blocking you from doing that [1], it’s something to consider.

Of course, writing, testing, and deploying that code isn’t trivial. And you’ll likely want a mechanism to migrate your keychain items from the login keychain to the data protection keychain, and that code might hit exactly this issue )-:

kSecAttrAccessible instead of kSecUseKeychain

Just to be clear, the best way to enable the data protection keychain is kSecUseDataProtectionKeychain. Once you do that, you can then use attributes, like kSecAttrAccessible, that are specific to that keychain.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] TN3137 describes one case where that’s not possible, namely, where you need to use the keychain from a daemon. That doesn’t apply here, but I can imagine there are other cases that I’ve not thought about.

We hit what looks like a more destructive variant of the same issue on a Mac running macOS 26.4.1 (25E253).

After the machine became unresponsive at login and was force-restarted, loginwindow failed to unlock the existing login keychain with errSecAuthFailed (-25293). The relevant unified log entries were:

Keychain did not unlock. Error: -25293 Keychain unlock failed and attempts to recover unsuccessful Keychain could not be unlocked, local account, moving login keychain to the side and creating a replacement _keychainMovedAside: 1

The user's password had not recently changed. This was a local account with Secure Token and FileVault enabled, with no MDM enrollment or configuration profiles. The original keychain's last recorded modification was about 2 minutes 40 seconds before the restart, so we don't have evidence that the restart interrupted an active keychain write.

The practical impact was that macOS renamed the original login keychain and created a new blank one. Chrome, Teams, and other applications immediately lost their authentication state because the old keychain's secrets, including Chrome Safe Storage, were no longer accessible. The current and known previous local login passwords do not unlock the moved-aside keychain.

After updating to macOS 26.5.2, the replacement login keychain has unlocked successfully across subsequent restarts. We can't confirm that 26.5.2 fixes the underlying issue, only that it hasn't recurred with the new keychain.

This seems related to the 26.4 login-keychain authentication changes discussed here, but in our case loginwindow's automatic recovery path moved the original keychain aside and created a replacement rather than a manual lock/unlock clearing the stale state. I can provide the exact sanitized unified-log excerpt or file a separate Feedback Assistant report if that would be useful.We hit what looks like a more destructive variant of the same issue on a Mac running macOS 26.4.1 (25E253).

After the machine became unresponsive at login and was force-restarted, loginwindow failed to unlock the existing login keychain with errSecAuthFailed (-25293). The relevant unified log entries were:

Keychain did not unlock. Error: -25293 Keychain unlock failed and attempts to recover unsuccessful Keychain could not be unlocked, local account, moving login keychain to the side and creating a replacement _keychainMovedAside: 1

The user's password had not recently changed. This was a local account with Secure Token and FileVault enabled, with no MDM enrollment or configuration profiles. The original keychain's last recorded modification was about 2 minutes 40 seconds before the restart, so we don't have evidence that the restart interrupted an active keychain write.

The practical impact was that macOS renamed the original login keychain and created a new blank one. Chrome, Teams, and other applications immediately lost their authentication state because the old keychain's secrets, including Chrome Safe Storage, were no longer accessible. The current and known previous local login passwords do not unlock the moved-aside keychain.

After updating to macOS 26.5.2, the replacement login keychain has unlocked successfully across subsequent restarts. We can't confirm that 26.5.2 fixes the underlying issue, only that it hasn't recurred with the new keychain.

This seems related to the 26.4 login-keychain authentication changes discussed here, but in our case loginwindow's automatic recovery path moved the original keychain aside and created a replacement rather than a manual lock/unlock clearing the stale state. I can provide the exact sanitized unified-log excerpt or file a separate Feedback Assistant report if that would be useful.

file a separate Feedback Assistant report if that would be useful.

I recommend that you do that.

DevForums is primarily about APIs, and that was the focus of AntonPastrevich’s bug report (FB22448572). Your issue is about the behaviour of the system as a whole, and hence it makes sense to file your own bug report about it.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

SecItemCopyMatching returns errSecAuthFailed (-25293) after macOS 26.4 upgrade — persists until SecKeychainLock/Unlock
 
 
Q