Sensitive Input Cached by the Keyboard

Sensitive fields allow keyboard learning and suggestions, so typed values can be kept in the keyboard's learned data and offered back as predictive text.

SeverityLow
CVSS 3.12.4 CVSS:3.1/AV:P/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N Open in the calculator
CVSS 4.02.4 CVSS:4.0/AV:P/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N Open in the calculator
CWECWE-524: Use of Cache Containing Sensitive Information
CategoryInformation Disclosure

Description

Mobile keyboards learn words typed into text fields to improve autocorrection and predictive suggestions. The application does not mark its sensitive input fields, such as account numbers, memorable information, security answers, personal details or confidential search terms, to opt out of this learning, so values typed into them can be stored in the keyboard's learned data on the device and offered as suggestions, including in other applications, to anyone who later uses the device or watches its screen. An attacker with access to the device's file system through a forensic extraction may also recover them from the keyboard's stored data.

The risk is greater with third-party keyboards. On Android, the active keyboard, which may be one the user installed from any developer, receives everything typed into the field, and on iOS a custom keyboard that the user has granted full access can send what is typed off the device, so a malicious or compromised third-party keyboard can collect values as they are typed. iOS always uses the system keyboard for secure text entry fields, but not for ordinary fields that hold sensitive data. The data exposed is limited to what was typed into unprotected fields, and exploitation needs physical access to the device or a malicious keyboard the user has installed, so the risk is low.

The weakness is confirmed by typing a distinctive value into each sensitive field, then typing its first characters in another application and checking whether it is suggested. Code review shows the input attributes: on Android, the inputType and imeOptions of each field; on iOS, the autocorrectionType and isSecureTextEntry properties.

Remediation

Mark every field that takes sensitive input so that keyboards do not learn or suggest its contents:

  • On Android, add textNoSuggestions to the inputType of sensitive text fields and set flagNoPersonalizedLearning in imeOptions, which asks the keyboard not to learn from the field. Use a password input type (textPassword or numberPassword) for secrets such as passwords and PINs.
  • On iOS, set autocorrectionType to .no on sensitive fields, and set isSecureTextEntry to true on secrets, which also prevents copying and forces the system keyboard.
  • Where third-party keyboards are a concern, an iOS application can refuse them by returning false for the keyboard extension point in application(_:shouldAllowExtensionPointIdentifier:). For the most sensitive values, such as PINs, an in-app keypad avoids the device keyboard entirely.
<!-- Android layout --> <EditText android:id="@+id/memorableWord" android:inputType="text|textNoSuggestions" android:imeOptions="flagNoPersonalizedLearning" /> // iOS memorableWordField.autocorrectionType = .no pinField.isSecureTextEntry = true

These attributes are requests that some keyboards may ignore, so they reduce rather than remove the risk. Confirm the fix by repeating the suggestion test with the system keyboard and with the third-party keyboards in common use among the application's users.

References


Add This Finding to Your Library

In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.

Free trial  ·  No card required

Only need the reporting? Our reporting tool is free and open source, with the same library.


More Mobile Applications Findings

Every Mobile Applications finding