News for hackers. Stuff that matters.
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by xchaotic on Tuesday October 17, 2017 @01:18AM (#15488844)
It doesn't log passwords using EnableSecureEventInput. There are probably other use cases, but Apple seems to have implemented things rather well here.
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by dangero on Tuesday October 17, 2017 @01:55AM (#15488964)
Yes I once spent a whole day debugging an issue related to this because I was unaware of it. I was getting a game Steam ready and I was working on the Steam overlay that is triggered by the tab key.

QA reported that on the login screen, you sometimes had to press tab twice to get the overlay to open. Just on that one screen.

I had a piece of code that was looking for the tab keydown event to open the overlay, but in some cases the event was not being triggered. Turned out that the browser password field used EnableSecureEventInput and so the if the cursor focus was in the password input box, the tab button press would not be detected by my code. Pressing it twice worked because:

-first tab press moved cursor focus out of the password box

-second tab press was in the username input field which was not a secure input field, so my code received the tab keydown event.

The weird part about this is since the tab keydown moves the cursor focus out of the secure text box what you receive is a tab keyup event with no keydown before it.

Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by passivepinetree on Tuesday October 17, 2017 @02:48AM (#15489128)
Interesting anecdote. What did you end up doing? Did you just leave it as-was?
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by Iv on Tuesday October 17, 2017 @03:58AM (#15489321)
I guess he looked for key-up events.
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by dangero on Tuesday October 17, 2017 @02:00PM (#15493117)
Yes, you could detect the condition by tracking key-up events without matching keydown events, so I wrote a little logic that would keep track of tab keyup-keydown states and with that I could detect it.
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by jwandborg on Tuesday October 17, 2017 @03:37AM (#15489263)
S?he probably listened to the keyup event instead.
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by iaml on Tuesday October 17, 2017 @05:30AM (#15489652)
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by jwandborg on Tuesday October 17, 2017 @09:11AM (#15490592)
Thank you, that is much better than

    /S?he|\w+kin|.*/
This irrational regular expression is an attempt at comedy.

On a serious note, I was looking for that word, but failed to remember it[0].

[0] https://news.ycombinator.com/item?id=15490542

Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by Legogris on Tuesday October 17, 2017 @04:28AM (#15489434)
You'd have to listen to both, right? Otherwise it'd be the same issue when the user tabs into the password input rather than out of.
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by thomastjeffery on Tuesday October 17, 2017 @05:32AM (#15489660)
No.

You could listen for the keydown, but you wouldn't hear it, so you may as well ignore what you can't hear.

Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by michaelmior on Tuesday October 17, 2017 @06:39AM (#15489902)
You should get a key down event when moving into the password field since you're coming from a field which is not secure.
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by dangero on Tuesday October 17, 2017 @02:02PM (#15493138)
Yes you're right. I made a variable that tracked the current state of keyup keydown and could detect this special case.
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by Void_ on Tuesday October 17, 2017 @03:57AM (#15489319)
His name is Dan ...
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by jwandborg on Tuesday October 17, 2017 @09:04AM (#15490542)
- I did not read their username.

- I did not click through to their profile.

The cause for both of these is that my mobile HN experience is horrible for me (a lazy person).

I spent a few seconds looking for a word to replace "She/He", when none came to mind I fell back to a regular expression[1]. As iaml pointed out[2] (along with others) https://en.wikipedia.org/wiki/Singular_they is the proper solution to this issue, and I will try to remember that in the future.

---

[1] as we so often do in our daily lives.

[2] https://news.ycombinator.com/item?id=15489652

---

In my second attempt at comedy today, Trying to perform the error-prone art of interpreting genders based on usernames, the best I came up with for you is

    /^\0_$/
Feedback welcome, this is my first attempt at matching null in a regular expression.

I'll explain the joke, so that no-one feels left out: I interpret name "Void" as gender "null", then carry the underscore over, using artistic license, to make the regex more interesting.

Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by Moter8 on Tuesday October 17, 2017 @04:25AM (#15489423)
People don't first go to the user profile to look for a name. dangero seems like a random nick
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by zbentley on Tuesday October 17, 2017 @08:21AM (#15490308)
dangero . . . us?
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by dan1234 on Tuesday October 17, 2017 @05:14AM (#15489600)
Dan could be short for Danielle or Danika or…
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by jen729w on Tuesday October 17, 2017 @07:09AM (#15490018)
People always assume I’m “Jen”, female, which is often enlightening. They’re my initials.
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by novium on Tuesday October 17, 2017 @04:07AM (#15489357)
Still not a reason to assume things here.
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by kupiakos on Tuesday October 17, 2017 @04:44AM (#15489492)
Should just default to the singular they then.
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by jwandborg on Tuesday October 17, 2017 @09:06AM (#15490557)
My fault. I'm more comfortable with regular expressions than the English language.
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by eradicatethots on Tuesday October 17, 2017 @09:40AM (#15490777)
Is it just me or is none of this a big deal?
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by dannyw on Tuesday October 17, 2017 @01:46AM (#15488935)
It would be nice if macOS had the same permissions models as iOS, and then some. A permission before apps can access the camera, or access what keys are held down when the app isn't in the foreground - that would block this case.
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by nfoz on Tuesday October 17, 2017 @03:02AM (#15489169)
Yes, it would be very nice if operating systems had a sane (let alone user-friendly!) way to properly, thoroughly sandbox userland applications.

It's a large reason why "web applications" became a thing -- it gives you sandboxed remote programs (and easy-access to boot!) Even if the web-browsing sandbox is flawed, it's been a convenient band-aid over a fundamental OS feature that, sadly, still doesn't properly exist.

Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by Gaelan on Tuesday October 17, 2017 @10:08AM (#15490985)
macOS has sandboxed apps, with the same underlying model as iOS (not sure if it asks for camera permissions and such, but apps declare a list of “entitlements” and are granted only those). It’s required for App Store apps, but other than that it’s opt-in. Outside of the App Store, basically it’s just something like DEP or ASLR: a mitigation that isn’t really visible to users unless they look for it.
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by NiveaGeForce on Tuesday October 17, 2017 @04:13AM (#15489374)
Like UWP on Windows.
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by tinus_hn on Tuesday October 17, 2017 @07:32AM (#15490099)
Most applications can’t offer the functionality you expect without a great amount of permissions.

New apps in the Mac App Store have to run in the sandbox and they are quite severely limited.

Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by pkamb on Tuesday October 17, 2017 @02:10PM (#15493235)
And permissions do not exist for many common and expected behaviors of Mac apps, leaving the Sandbox/Mac App Store pretty unviable.
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by sametmax on Tuesday October 17, 2017 @02:06AM (#15489002)
This would effectively kill innovation. There is a reason you can't do half the things you do on a laptop on a phone unless you root said phone.
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by ClassyJacket on Tuesday October 17, 2017 @03:11AM (#15489199)
The idea is not to prevent programs doing those things, it's to prevent programs doing those things without user permission.
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by sametmax on Tuesday October 17, 2017 @05:41AM (#15489696)
That's not the problem. The problem is that the whitelist of permissions is limited, fixed, i have no control over it and i can't easily work around it.

I can't create a great way to batch install/update/migrate my phone because everything requires manual approval.

I can't use my own browser or sms app on ios cause it's not allowed by the permissions system.

I can't install a new driver on my phone.

Remember the bs update apple did that broke the home button, forcing people to buy a new phone ? I can't prevent that either.

I'm actually for permissions and sandboxes for most apps. But i want a manual override when i need one.

Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by BoorishBears on Tuesday October 17, 2017 @08:44AM (#15490422)
On Android you can batch install while granting all permission with the `-g` argument on Android versions with runtime permissions
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by sametmax on Tuesday October 17, 2017 @09:05AM (#15490548)
Not on ios though. See, the problem is not the permissions, but the fact you are at their mercy. And because by definition innovations assume you have nit thought of it before, this will limit innovation.
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by BoorishBears on Tuesday October 17, 2017 @10:39AM (#15491269)
To m, that just shows that it's up to the implementation.
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by sametmax on Tuesday October 17, 2017 @02:18PM (#15493319)
You are assuming the implementator can think of everything. Innovating however, assume to come up with something you haven't thought before.
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by oblio on Tuesday October 17, 2017 @04:46AM (#15489503)
Is there (or was there every) any OS app store that allowed an app to go trawling through another apps's memory? Or if you don't want to be that radical, one that at least allows overlays.

I don't know of any.

Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by pluma on Tuesday October 17, 2017 @05:23AM (#15489632)
Plenty of apps on Android are allowed to draw over other apps (e.g. Facebook messenger, Lux Auto Brightness). There are also apps that use the accessibility APIs to determine what the user is seeing (e.g. LastPass with AppFill enabled).

I think both of these features require explicit manual permissions (i.e. having to go to the system settings and whitelist the app) to be enabled. Also Android permission dialogs refuse to pop up if there is an untrusted screen overlay (which meant that my experience with Lux when with other apps' permission dialogs involved either manually disabling the virtual screen brightness adjustment or having it automatically disabled temporarily, which resulted in unpleasant surprises while using the phone at night).

Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by zaksoup on Tuesday October 17, 2017 @02:11AM (#15489013)
I'm not sure I buy that requiring user opt-in to camera access is why the Mac app ecosystem is is much larger than that of iOS. Can you elaborate on what apps/innovations would become impossible because of a mandatory opt-in? I cannot think of any...
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by sametmax on Tuesday October 17, 2017 @05:30AM (#15489651)
Everything that is either very low level or is used for deep introspection of other parts of the system.

I'm not against sandboxing, but if there should be a way to say i know what i'm installing, go with it. Otherwise you will say good bie to new ways of debugging, alternative drivers, unusual way of routing network packets, innovative UI interactions that are not part of the standards widgets, or anything you haven't think of yet.

The computing experience you have today is the result of all the stuff we fiddle with for the last 30 years because it was allowed to. It would be foolish thz big players invented most of it.

Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by icebraining on Tuesday October 17, 2017 @03:17AM (#15489213)
The problem with an opt-in system is that you have to sandbox the whole app (otherwise, evading the opt-in would be trivial) and therefore lock out any advanced access not explicitly listed as an opt-in permission.

If you want an example, there's F.lux, which doesn't work (without rooting) on Android and iOS.

Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by kmbriedis on Tuesday October 17, 2017 @03:06AM (#15489183)
Keyloggers which don't require any permissions, apparently
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by sneak on Tuesday October 17, 2017 @04:13AM (#15489370)
There is also a reason I can do 99% of the things I do on a laptop on my (totally sandboxed, not rooted) iPad Pro.
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by sametmax on Tuesday October 17, 2017 @05:32AM (#15489659)
No you can't. You just have a very limited way to use it. Even with the same screen size, give me a laptop os and i'll be more productive, with a factor of 10. It's not a figure of style. Phone os are terribly limited.
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by sneak on Tuesday October 17, 2017 @03:00PM (#15493760)
You’re objectively wrong, and likely have significantly outdated understanding of what is possible on a “terribly limited” “phone os”.
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by sametmax on Tuesday October 17, 2017 @05:42PM (#15495233)
So, without rooting or plugging your phone into a real computer you can:

Run a database ? (good luck running postgres with the OS killing processes all the time)

Run docker ?

Taking screen captures anywhere ? (this one actually got me yesterday while trying to screen capture netflix on my one plus 3)

Run f.lux ?

Run one virtual machine with windows on it ?

Capture 3G traffic with wireshark ?

Install a driver to read a USB key in another partition format not allowed by the OS ?

Bypass DRM ?

Resize partitions to get a dual boot ?

Run Wine ? (and they tried hard. Since fosdem 2014 at least)

Install patches as soon as a vulnerability is discovered, and not waiting on your phone seller to wake up ?

And if you just consider iOS, it's way, way worse. At least on android you have access to part of the filesystem.

The thing is, in computing, nothing works exactly right. And with my laptop, I have always a way to work around problems. With phones, I'm just stuck with it. Multitasking sucks. Automation is terrible. You may install a GNU env, but it has access to so little you can't script your way out of anything.

Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by walterbell on Tuesday October 17, 2017 @07:37AM (#15490114)
Depends on workflow and apps. iPad OS has made steady progress. If Apple allowed advanced users to manually override permissions, they would gain data to help the OS to evolve much faster. See landscape architects’ experience with human foot paths.
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by sametmax on Tuesday October 17, 2017 @05:19PM (#15495066)
That's actually my point.
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by rubatuga on Tuesday October 17, 2017 @02:14AM (#15489020)
The permission model on the Mac is that it is up to the user. Don’t run software that you don’t trust, end of story!
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by ben_w on Tuesday October 17, 2017 @02:58AM (#15489158)
I believe that was the problem.
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by LoSboccacc on Tuesday October 17, 2017 @02:19AM (#15489040)
Funny, I wish it was the other way around. The current model makes far to easy to impersonate elevated dialogs in iOS.
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by icebraining on Tuesday October 17, 2017 @03:12AM (#15489200)
Is it hard to impersonate elevated dialogs on macOS?
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by imron on Tuesday October 17, 2017 @02:14AM (#15489022)
> but Apple seems to have implemented things rather well here.

Reading up on it further [0] it seems you could write an anti-keylogger. Just have an app that calls EnableSecureEventInput and never disables it and no other processes would be able to capture key input:

"The system will no longer pass keyboard intercept processes keyboard events if your process has enabled secure input even when your process is moved to the background. It now becomes your process' responsibility to call DisableSecureEventInput when secure entry input is not required, such as when your process detects that it is moving to the background."

0: https://developer.apple.com/library/content/technotes/tn2150...

Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by TrickyRick on Tuesday October 17, 2017 @02:40AM (#15489102)
Although that would probably break some apps. See for example: https://news.ycombinator.com/item?id=15488964
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by imron on Tuesday October 17, 2017 @03:21AM (#15489224)
I'm sure it would, so you could have an icon in the task bar that could temporarily enable keylogging again.
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by splicer on Tuesday October 17, 2017 @10:59AM (#15491462)
Thanks to a vulnerability I reported a decade ago: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-0724
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by goerz on Tuesday October 17, 2017 @11:51AM (#15491952)
So are there any keyloggers for MacOS in the wild that still manage to capture keystrokes with EnableSecureEventInput, or can I consider this as "secure"? Also, is there a way to tell when/for which processes EnableSecureEventInput is active?
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by goerz on Tuesday October 17, 2017 @12:27PM (#15492279)
Answering my own question: EnableSecureEventInput does not protect from processes that have root privileges, see https://security.stackexchange.com/questions/47749/how-secur...

A good way to check whether EnableSecureEventInput is enabled is to start the Keyboard Viewer that comes with MacOS and see if it echoes keystrokes.

Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by jasonmp85 on Tuesday October 17, 2017 @12:57PM (#15492538)
Does Keyboard Viewer still come with macOS? I thought it disappeared years ago…
Re:Swift-Keylogger – Keylogger for MacOS written in Swift us... by RaleyField on Tuesday October 17, 2017 @03:18AM (#15489218)
It's still wrong. Relevant XKCD https://xkcd.com/1200/