• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Samsung clipboard vulnerability - Last 20 items stored

electricpete

Android Expert
======PROBLEM======
To my understanding, certain Samsung phones (including my Galaxy S4 running stock rooted 4.3) have an extended-clipboard feature, which stores the last 20 items clipped. But this functionality is not a part of other Android phones, is not well publicized, and is not always obvious to the user. So we may be fooled into thinking that we can erase sensitive clipboard information by writing a single new entry to it (we cannot). If password manager programs attempt to clear the clipboard by writing a single new entry, they will not be successeful

======HOW TO CONFIRM THE PROBLEMATIC BEHAVIOR=======
On a Samsung phone, In ANY (*) text application, type “Text 1” and then copy it to the clipboard. Then type “Text 2” and copy it to the clipboard. Now go to any of the following PARTICULAR (**) applications: Samsung stock SMS, Samsung stock Calendar, or Color Notes (a non-Samsung app!) and long-press in a text input field. You will see options for “paste” and “clipboard”. Select "clipboard". You will see not only "Text 2" (as you'd expect) but also "Text 1" as well as up to 18 other items you recently placed on the clipboard.

=======MY DISCUSSION:=======
* ANY application places info INTO the 20-deep list.
** only PARTICULAR applications (mostly Samsung applications, but also a few others) retrieve info OUT OF the 20-deep list.

If you only interact with applications that are NOT of the 2nd type (example of apps that are NOT of second type are Google Keep, Google Tasks, Gmail, Classic Notes), then you probably don’t see any evidence whatsoever of this 20-deep clipboard list… it seems as if you have only one thing in your clipboard. But those old clipboard items are still hidden there, as you can verify by going into the 2nd type of application. I think all that is required to read this 20-long clipboard history is “read clipboard” permissions.

=======SOLUTIONS THAT DIDN'T WORK=======
1 – Samsung Secure Clipboard Xposed module - did not work for me. It was tested on GS2 but apparently (from my test) doesn’t work for S4
Secure Samsung Clipboard | Xposed Module Repository
2 – Clipboard Cleaner App - FC every time I try to use it. The description says dev is working through problems with Samsung devices
https://play.google.com/store/apps/details?id=com.kodholken.clipboardcleaner&hl=en

=======SOLUTION THAT DID "WORK"=========
What did work to remove old entries from the clipboard is the following Tasker Task
For Variable: %counter Items: 1:20
_____Set Clipboard Text: %counter
End For


Above we simply stuffed something into the clipboard 20 times which fills up the list and makes all the old stuff “fall out” the end of the list. Note that it has to be something different stuffed in each time (if you try to stuff the same thing into the clipboard 20 times, it will ignore 19 of them). The loop variable %counter provides an easy way to create 20 unique entries.

I'm going to manually initiate that task when I am aware there is potentially sensitive info on the clipboard. There might be opportunities to launch the task programmatically as well if your tasker profiles sense a situation that suggests clipboard clearing is needed.

==========GROUP DISCUSSION===========
It took me awhile to sort through this so I’m hoping it might be useful to others. Also I may be missing something along the way. Some possible items for discussion:
1 – Do others experience the same behavior? (“HOW TO CONFIRM THE PROBLEMATIC BEHAVIOR”)
2 – Did you realize that your old clipboard items were still available even after a single new item is written to clipboard?
3 - Do you think I have mis-represented the risks in this vulnerability? (assuming we do occasionally put sensitive info on clipboard... it is inconvenient to avoid this)
4 – Are you aware of other way to cope with the problem? I would really prefer to get rid of that 20-deep clipboard altogether, but I don’t think there is a way.
 
If you want to use my "solution" but don't have Tasker, you are welcome to use the attached apk (ClearClipboard.2.apk) that I created directly from above tasker code (nothing else).

Install the apk
It requires you to allow installation from "unknown sources"
Launch the app and it runs the above code to clear the keyboard. You won't see any feedback that the app does anything, but if you're skeptical you can satisfy yourself the app does what it's supposed to by going into an application like Samsung Calendar, Samsung stock sms or Color Notes and long-press in the text field and selecting clipboard...you will see only the numbers 1-20 (not any of your old clips).

Standard warning - Only install APK's if you know/trust the source or it has no invasive/risky permissions. This apk requests only one permission (keep phone awake). I don't know exactly why it requests that particular permission, but it's not a privacy or security sensitive permission. Also I verified it does not remain in "running services" after you launch it...it's gone. So it won't end up keeping the phone awake, and therefore there's no risk of running the battery down.
 

Attachments

If you want to use my "solution" but don't have Tasker, you are welcome to use the attached apk (ClearClipboard.2.apk) that I created directly from above tasker code (nothing else).

Install the apk
It requires you to allow installation from "unknown sources"
Launch the app and it runs the above code to clear the keyboard. You won't see any feedback that the app does anything, but if you're skeptical you can satisfy yourself the app does what it's supposed to by going into an application like Samsung Calendar, Samsung stock sms or Color Notes and long-press in the text field and selecting clipboard...you will see only the numbers 1-20 (not any of your old clips).

Standard warning - Only install APK's if you know/trust the source or it has no invasive/risky permissions. This apk requests only one permission (keep phone awake). I don't know exactly why it requests that particular permission, but it's not a privacy or security sensitive permission. Also I verified it does not remain in "running services" after you launch it...it's gone. So it won't end up keeping the phone awake, and therefore there's no risk of running the battery down.

Thank you for sharing your solution with other folks! :)

One recommendation: Given the inherent risk in downloading/installing APKs from unknown people, you could, if you choose to, just provide your Tasker template (export as .xml) - that way, somebody can just import your xml, review the steps and create their own APK (assuming of course that they have tasker/app-factory).
That way, folks who are new to tasker don't struggle trying to figure out exactly where to enter the information you provided.

Again, this is your solution, so you absolutely don't have to :)
 
Back
Top Bottom