Skip to content

Block clipboard permission to certain apps via ADB in Termux. Requires Android 10 or above.

License

Notifications You must be signed in to change notification settings

jogerj/block-clipboard-android

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Block Read Clipboard Permission in Android

Block clipboard permission to certain apps via ADB in Termux. Requires Android 10 or above.

Background

Recently it has been found that apps on Android and iOS are known to access your clipboard (history) covertly. Apps like TikTok uses these clipboard information to "improve user experience". The implications are these apps could retrieve private information that you stored in your clipboard or even passwords and then send them to a remote server. Since iOS 14 and Android 12, your smartphone would alert you when an app accesses your clipboard, however in Android there's no direct way to block access to these applications from reading your clipboard contents.

How clipboard on Android works

Unless your app is the default input method editor (IME) or is the app that currently has focus, your app cannot access clipboard data on Android 10 or higher. Source

This means that apps no longer can access your clipboard data when running in the background. In Android 12, a toast message will alert the user when an app tries to access clipboard data from a different app (the clipboard is still accessed). However, apps can still access your clipboard data when you open the app in foreground.

What this script does

This script accesses your Android phone via adb (without requiring a separate computer/USB connection) and removes the READ_CLIPBOARD permission from any app you choose. Removing this permission disables pasting text in any text fields within the app. However, you can still paste text from your keyboard if your keyboard supports it (e.g. Gboard, SwiftKey, etc.), which arguably would be more secure than unwanted/untrusted apps accessing your clipboard. Disabling clipboard permission will not interefere with Auto-fill functions used by password managers as they use different API, but you won't be able to manually paste passwords using clipboard (except from keyboard). The entire process is completely reversible, see enable_clipboard.sh. If running on a different computer, make sure to enter the device hostname/IP address when prompted.

Requirements

  • Android device running Android 10 or above
  • Latest version of Termux (to run without separate computer)
    • Without Termux, you can also use a computer with (bash) shell and adb installed on the same network as your device.

How to

  1. Open Termux and clone this repository (requires git installed, pkg install git)

    git clone https://github.com/jogerj/block-clipboard-android
    cd block-clipboard-android

    or download individual scripts files using curl

    curl -o disable_clipboard.sh https://raw.githubusercontent.com/jogerj/block-clipboard-android/main/disable_clipboard.sh && curl -o enable_clipboard.sh https://raw.githubusercontent.com/jogerj/block-clipboard-android/main/enable_clipboard.sh && chmod +x disable_clipboard.sh enable_clipboard.sh
  2. Enable developer mode/options in settings. Enable Wireless ADB Debugging, then enable USB Debugging.

  3. Run bash disable_clipboard.sh

  4. Enter a package name you want to disable. Tip: If you're unsure which package you're looking for, open App Info and click on App details to open the Play Store page. Share the app from the drop down menu, the package name will be shown in the URL (e.g. https://play.google.com/store/apps/details?id=com.example.packagename)

  5. To remove clipboard permissions for another package, rerun the script again. To re-enable clipboard permissions, run bash enable_clipboard.sh

Further Reading

Enabling developer mode

Device Setting
Google Pixel Settings > About phone > Build number
Samsung Galaxy S8 and later Settings > About phone > Software information > Build number
LG G6 and later Settings > About phone > Software info > Build number
HTC U11 and later Settings > About > Software information > More > Build number or Settings > System > About phone > Software information > More > Build number
OnePlus 5T and later Settings > About phone > Build number

(source)

About

Block clipboard permission to certain apps via ADB in Termux. Requires Android 10 or above.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages