Search K
Appearance
Appearance
Other ways to support HackTricks:
Data sharing within and across applications on iOS devices is facilitated by the UIPasteboard
mechanism, which is divided into two primary categories:
Security considerations play a significant role when utilizing pasteboards. For instance:
Ensuring that sensitive information is not inadvertently stored on the global pasteboard is crucial. Additionally, applications should be designed to prevent the misuse of global pasteboard data for unintended actions, and developers are encouraged to implement measures to prevent copying of sensitive information to the clipboard.
For static analysis, search the source code or binary for:
generalPasteboard
to identify usage of the systemwide general pasteboard.pasteboardWithName:create:
and pasteboardWithUniqueName
for creating custom pasteboards. Verify if persistence is enabled, though this is deprecated.Dynamic analysis involves hooking or tracing specific methods:
generalPasteboard
for system-wide usage.pasteboardWithName:create:
and pasteboardWithUniqueName
for custom implementations.setPersistent:
method calls to check for persistence settings.Key details to monitor include:
setItems:options:
method.An example of monitoring tool usage is objection's pasteboard monitor, which polls the generalPasteboard every 5 seconds for changes and outputs the new data.
Here's a simple JavaScript script example, inspired by the objection's approach, to read and log changes from the pasteboard every 5 seconds:
const UIPasteboard = ObjC.classes.UIPasteboard;
const Pasteboard = UIPasteboard.generalPasteboard();
var items = "";
var count = Pasteboard.changeCount().toString();
setInterval(function () {
const currentCount = Pasteboard.changeCount().toString();
const currentItems = Pasteboard.items().toString();
if (currentCount === count) { return; }
items = currentItems;
count = currentCount;
console.log('[* Pasteboard changed] count: ' + count +
' hasStrings: ' + Pasteboard.hasStrings().toString() +
' hasURLs: ' + Pasteboard.hasURLs().toString() +
' hasImages: ' + Pasteboard.hasImages().toString());
console.log(items);
}, 1000 * 5);
Other ways to support HackTricks: