正确使用Touch ID
细节
Touch ID通常用于允许用户在不输入密码的情况下对设备进行身份验证和解锁。一些开发人员还使用Touch ID来允许用户使用存储的设备指纹对其应用进行身份验证。
当开发人员在其应用中使用Touch ID时,通常可以通过以下两种方法进行操作:
1) 仅使用本地认证框架来认证用户。这种认证方法易于绕过,攻击者可以在运行时修改本地检查内容,也可以修补二进制文件。这可以通过覆盖LAContextevaluatePolicy:localizedReason:reply方法来实现。
2) 使用钥匙串访问控制列表(ACL)
修复
当使用Touch ID进行身份验证时,请使用正确的ACL声明来将应用程序的密钥存储在钥匙串中。使用这种方法,iOS在读取和将钥匙串项目返回到应用程序之前,会进行用户存在性检查。
开发人员可以在Apple网站上找到示例代码:https://developer.apple.com/library/ios/samplecode/KeychainTouchID/Listings/KeychainTouchID_AAPLKeychainTestsViewController_m.html。
参考
KeychainTouchID: Using Touch ID with Keychain and LocalAuthentication - https://developer.apple.com/library/content/samplecode/KeychainTouchID/Introduction/Intro.html
OWASP Mobile Top 10: M5 - Poor Authorization and Authentication
CWE: CWE-288 - Authentication Bypass Using an Alternate Path or Channel