Karabiner-Elements: Big security issue - binary being shipped inside this repo, it is not built from source, aka keylogger
Please help me to confirm is this true.
- You are shipping a binary inside this repo that is the kernel extension being installed to intercept the keyboard pressed keys (and this logs all keys somebody is pressing).
- The default installation instructions will make it appear like the user is building the kernel extension when in fact it will fail with signing error and your binary extension will be used as a fallback.
bash ./scripts/codesign.sh dist
code sign org.pqrs.driver.Karabiner.VirtualHIDDevice.v060800.kext
8ECD43BA902B40380BD84C4512385E6C5EB3F160: no identity found
org.pqrs.driver.Karabiner.VirtualHIDDevice.v060800.kext: code object is not signed at all
In architecture: x86_64
bash ./scripts/setpermissions.sh dist
- When user is installing the result binary
Karabiner-Elements-VERSION.dmgby default your attached binary (not build from the source will be used), because only you have the sigining key!!!
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 8
- Comments: 24 (11 by maintainers)
Hi @tekezo ,
First of all I would say that I appreciate all of your giant effort to open source this tool. I really loved to use it, and it was almost indispensable to me.
This is also the reason why this is so frustrating. Because of this I can’t use this project anymore. The risk is simply too high.
There are two ways of distributing the code:
What went wrong: When a user is trying to build the binary from source files, because they care about security, you are presenting the built from sources progress to the user. Even though the process fails because of signing issues, you ignore the entire build process and just use your home built and signed kext from somewhere and build the result dmg file successfully. This gives the user an impression that everything went smooth, when the expected action actually didn’t happen.
Why is this problematic:
I understand why you need to sign the kext. That doesn’t mean that you should attach a signed kext binary and commit it as a part of source code and use it as a fallback.
Like I said, I think that you are aware that Apple won’t be giving those kext signing keys to developers for personal use, the risk for Apple would be too high.
Why am I so frustrated with this:
How to remedy this so that everyone is happy:
What not to do:
Well I guess it’s game theory. I think you are already well aware of these reasons.
Why can’t you just fallback to
CGEventPostif the kext is not present?Why do you insist on distributing privately built binary in your source code? This is a huge red flag.
If the user can’t sign the build, it should fail and give the user message he needs to get a signing certificate or use a prebuilt binary from some location.
@tekezo
Again, you shouldn’t be distributing binary in the source code and fallback on it when the user fails to codesign:
Again, why:
I think you are missing the point completely. It doesn’t matter how to binary is generated. I was never saying how to prove your binary is correct, but how to let users build their own binary (reproducible build) for which you can just provide the signature).
I have no idea how did you investigate this. The goal isn’t stripping the signature, but replacing the signature with your own for the same binary. Seems there are two parts of mach-o you need to change https://github.com/steakknife/unsign/blob/master/unsign.c
I’m really not convinced at the moment that you actually need a kext to send keystrokes. https://stackoverflow.com/questions/8027146/sending-keystroke-events-to-osx
How is an issue like this closed without being addressed?
Thanks a lot. I’ll try to make it work without the kext.
I was surprised because I was not building it from source which exists in the repository, but a different binary was slipped in. If you don’t delete the binary from the repository you are still doing the wrong thing IMHO because users might run make without reading your instructions.
I’m not sure why do you persist on distributing a built binary in your repository. The correct action is to download the binary from some other prebuilt place. In this way there can be no misunderstanding.
You have ~30ish contributors and probably 20-30k users. IMHO it would be more important to inform the users what they are actually doing because that might be not allowed in a lot of companies and they could get in a lot of trouble with the current build process.