Live data from Hacker News

Who keeps an eye on clipboard access?

blog.ovalerio.net

91–100 of 147 posts

Re: Who keeps an eye on clipboard access?

#91
post #39

Earlier quoted context omitted.

Sure, but that should really be a permission you have to grant explicitly. For global keyboard shortcuts an app should make commands available and it should be up to the user to tell their OS which shortcuts they want to give an app. Not just for security, but also for customisability and to avoid conflicts

> Sure, but that should really be a permission you have to grant explicitly. That could work but still feels dodgy since if you can grant that permission to a clipboard manager, you can also grant it to something like a TikTok client or an Adobe DRM reader or whatever else program you want to use (ie. the reason you are using your computer in the first place) but also might want to snoop for your data. IMO a better s…

Of course if an app asks for some very dangerous permissions somebody will grant them to it even if they don't belong to the app's advertised functionality.

Naming and description could help a little: Full access to copy and paste (maybe somebody doesn't know what clipboard means), it allows this app to access everything is selected and copied including passwords, private data, etc. Only keyboards and clipboard managers should get this permission.

Re: Who keeps an eye on clipboard access?

#92
post #82

With most installations of X11 / Xlib, there is also an extension library: libXFixes. With this, it is possible to receive an event whenever the clipboard (or any other selection) changes (even if our program is not the owner). [0] I used this in the past when porting a Windows text editor to Linux that needed to know when the clipboard had changed. In the C bindings, it corresponds to XFixesSetSelectionOwnerNotifyMa…

I think the goal here is to be notified when an application accesses the clipboard, not modifies it. You need to be the owner to do that (excluding some system-wide hack like patching the X server or MITM-ing all X11 connections).

Re: Who keeps an eye on clipboard access?

#93
I've been thinking it would be fun to make a self-hosted web clipboard that lets you paste text/files into a simple web page, and have them available on all your devices. Sort of like cl1p.net but e2ee and it would maintain history.

You wouldn't need an account because your password could be hashed to yield a unique URL.

Only reason I haven't hacked it together already is because I don't trust myself to get the crypto right yet.

Anyone aware of something like this already existing?

Re: Who keeps an eye on clipboard access?

#94
post #87

I think Linux dynamic user probes would lend themselves quite well for something like this. Fooling around with bpftrace for a few minutes yielded this one-liner, which catches all the conscious X11 selection accesses (and a few unconscious ones, too :)) I provoked on my desktop during a few minutes of testing: sudo bpftrace -e 'uprobe:/usr/lib/libX11.so:XGetSelectionOwner{time("%H:%M:%S ");printf("%-6d\n", pid);}' I…

I am not familiar with bpftrace (though that does look extremely potent), but XSetSelectionOwner is called when an application wants to make data available via the clipboard, not access it. Also not sure if that would also catch stuff with Xlib, and I guess it won't if it's statically linked (this is why I pivoted hax11 from hooking library calls to MITM-ing the connection).

My bad, I actually had the "production" trace command set to look for `XGetSelectionOwner`, but mis-pasted into my comment ;) Will that fare any better? It did make a few more PIDs/culprits end up in the trace output for me after all.

You are correct that "bringing your own function"/shared object will break that particular bpftrace script, but I would assume one could find a way to set up a probe in the X server, where all clients messing with clipboard state via some kind of IPC have to pass thru? (Again, I can only wildly speculate how X11 works under the hood - kinda shameful that I never bothered to look over all these years :-S )

Re: Who keeps an eye on clipboard access?

#95

I've been thinking it would be fun to make a self-hosted web clipboard that lets you paste text/files into a simple web page, and have them available on all your devices. Sort of like cl1p.net but e2ee and it would maintain history. You wouldn't need an account because your password could be hashed to yield a unique URL. Only reason I haven't hacked it together already is because I don't trust myself to get the crypt…

I had thought about something similar, only with publishable subscriuptions so N people could share the same clipboard. Only I wanted the opposite: It would be ephemeral, only as long as you subscribed to the ‘feed’ would you see what was there, there would be no history, and pragmatically, no long term retention in the cloud…mostly as a cost savings measure.

I got so far as thinking you’d have two guids: One to subscribe to, and the other to revoke the feed.

It never got past the thought stage…and I made a logo and registered a URL that I’ve since let expire as the coding took longer than my attention span.

Re: Who keeps an eye on clipboard access?

#96

I've been thinking it would be fun to make a self-hosted web clipboard that lets you paste text/files into a simple web page, and have them available on all your devices. Sort of like cl1p.net but e2ee and it would maintain history. You wouldn't need an account because your password could be hashed to yield a unique URL. Only reason I haven't hacked it together already is because I don't trust myself to get the crypt…

I had thought about something similar, only with publishable subscriuptions so N people could share the same clipboard. Only I wanted the opposite: It would be ephemeral, only as long as you subscribed to the ‘feed’ would you see what was there, there would be no history, and pragmatically, no long term retention in the cloud…mostly as a cost savings measure. I got so far as thinking you’d have two guids: One to subs…

You're just a few steps away from reinventing Twitter!

Re: Who keeps an eye on clipboard access?

#97

Earlier quoted context omitted.

> Which distributions and which settings are you talking about? kernel.yama.ptrace_scope = 1 > If you can run gdb on that distribution, then you can definitely do it, even if it's just because they whitelist gdb in selinux/aa (in which case you can just script gdb). No, you can't. Try it. > And I rather doubt it is a default, since ptrace-based sandboxing is a thing (even Firefox was using it). You can trace child pr…

Which distribution enables this by default ? EDIT: Apparently Ubuntu, but not Debian, SuSE, Arch, etc. Well, TIL. > No, you can't. Try it. You definitely can, it's just that that as you said, gdb just can't attach to anything but a child process; making gdb only work with a process it spawned itself. Anyway, in addition to changing .profile, you still can do practically everything including modifying SHM segments, wr…

> but for some reason it doesn't seem like the right approach.

The approach being used in containerization is namespaces. You can put new processes into a new IPC / user / PID / network / time / etc. namespace, which isolates them from the parent namespace. Once that's done and you can't mess with other processes via the filesystem / kernel, the remaining hole is servers with inadequate security models, such as X11.

Re: Who keeps an eye on clipboard access?

#98
post #33

Earlier quoted context omitted.

Forget a permissions model. How about an informed notification model, where the OS marks the application with a badge notification whenever it requests a paste? And you can see a history of what it requested? Generally I find it odd that there is so much hand-wringing over basic transparency. As with companies giving away private data to third parties, before talking about consent, how about a paper trail to start wi…

That is exactly what is discussed in the article. A way to notify the user if a program request the contents of the clipboard. iOS apperently does just that. The thing with the clipboard is that the feature is ancient. And back then, most applications were generally very unconcerned with security. So now the genie is out of the bottle, and it's difficult to convince some people that it's a problem. The article's POC…

anything similar for Mac OS?

Re: Who keeps an eye on clipboard access?

#99

Earlier quoted context omitted.

An email client certainly needs the capabilities mentioned there. The ILOVEYOU virus (which is what the page refers to) was an executable (a VBS script but any executable could do the same thing) that asked Outlook Express for the address book and use it to send mail with itself as an attachment. The issue with it was that Outlook Express was too happy to run programs attached to mail (also that Windows hide file ext…

so, I can't help but note that when I said an email client should not need to request these capabilities and anything that did would be malware, you said an email client definitely needed to request these capabilities and gave as the example the ILOVEYOU virus.

Yes?

In a system based on permissions (which is basically what a capability system is) somehow applications need to gain those permissions - so it makes sense that an email client will need to request them. Otherwise how is it going to work if it cannot access the internet, the address book or any other functionality it might need?

BTW the ILOVEYOU virus example is what the linked page brought up, not me. They call it "Love Bug" but that is just another name for the same virus:

https://en.wikipedia.org/wiki/ILOVEYOU

Re: Who keeps an eye on clipboard access?

#100
post #91

Earlier quoted context omitted.

> Sure, but that should really be a permission you have to grant explicitly. That could work but still feels dodgy since if you can grant that permission to a clipboard manager, you can also grant it to something like a TikTok client or an Adobe DRM reader or whatever else program you want to use (ie. the reason you are using your computer in the first place) but also might want to snoop for your data. IMO a better s…

Of course if an app asks for some very dangerous permissions somebody will grant them to it even if they don't belong to the app's advertised functionality. Naming and description could help a little: Full access to copy and paste (maybe somebody doesn't know what clipboard means), it allows this app to access everything is selected and copied including passwords, private data, etc. Only keyboards and clipboard manag…

> Naming and description could help a little: Full access to copy and paste (maybe somebody doesn't know what clipboard means), it allows this app to access everything is selected and copied including passwords, private data, etc. Only keyboards and clipboard managers should get this permission.

I don't think the problem of users not reading the text in warning messages can be solved with having them read even more text.

Actually this is an old problem, people do not read message boxes, popups, warnings, etc:

http://www.zuschlogin.com/?p=53

Post reply on HN