dunhamsteve / ios

Utility to extract files and keychain information from iOS backups
Other
123 stars 28 forks source link

`dumpkeys` command fails with "cipher: the nonce can't have zero length" error #13

Closed dnicolson closed 2 years ago

dnicolson commented 2 years ago

The following error occurs when running dumpkeys on an encrypted iOS 14.6 or iOS 15.1 backup: irestore xxx dumpkeys out.json

key derivation took 4.300620047s use the password xxx to skip
load
Got manifest key [xxx]
{{xxx} KeychainDomain keychain-backup.plist  [] [xxx] map[]}
read xxx
2021/10/30 12:07:16 cipher: the nonce can't have zero length, or the security of the key will be immediately compromised
panic: cipher: the nonce can't have zero length, or the security of the key will be immediately compromised

goroutine 1 [running]:
log.Panic(0xc0001d1a90, 0x1, 0x1)
    /usr/local/Cellar/go/1.16.3/libexec/src/log/log.go:354 +0xae
main.dumpKeyGroup(0xc00045e000, 0xc000eec000, 0xbab, 0xbab, 0x0, 0x0, 0x0)
    /Users/dave/.go/pkg/mod/github.com/dunhamsteve/ios@v0.0.0-20190228043556-c6555142d763/cmd/irestore/irestore.go:154 +0x3d0
main.dumpkeys(0xc00045e000, 0x7ffeefbff58c, 0x11)
    /Users/dave/.go/pkg/mod/github.com/dunhamsteve/ios@v0.0.0-20190228043556-c6555142d763/cmd/irestore/irestore.go:182 +0x4ae
main.main()
    /Users/dave/.go/pkg/mod/github.com/dunhamsteve/ios@v0.0.0-20190228043556-c6555142d763/cmd/irestore/irestore.go:321 +0x8c6

A ~/kcb.plist file is created, which is expected and is the same file that is extracted to KeychainDomain/keychain-backup.plist with the restore '*' command.

dunhamsteve commented 2 years ago

The standard Go library dropped support for empty nonces in GCM. Someone gave me a heads up on this, but I neglected to revert back to a patched version. I've done this now, which should resolve the issue (works for me).

dnicolson commented 2 years ago

Thanks for the quick fix!