MIDREAL
Menu

Show HN: Nobody blocks a keyboard – Rooted Android as a physical USB Deck

https://github.com/mr-anjaneyam/Emittr (github.com) OVERHYPED

57 points | 5d ago | Discuss on Hacker News | Back to Radar

Comments

atmanactive 5d ago on HN
While we're on the subject, for non-rooted phones, I can recommend InputStick.
mr-anjaneyam (author) 4d ago on HN
Yes. Thanks for the suggestion. It is a readymade hardware, pretty easy to use. My app's motive is to repurpose.
minekaz3333 5d ago on HN
Except Qubes OS. It of course blocks USB keyboards by default. You can enable USB devices (filtered by device ID, USB controller/port, ...) if you want.

Even better: USB controllers are PCI-passed-through to dedicated (disposable) VM(s), so Linux kernel bugs don't expose your system to untrusted USB devices. Same with network devices, etc.

mr-anjaneyam (author) 4d ago on HN
Cool, I haven't heard of this default in Qubes. Plus, Emittr exposes itself as legitimate dell keyboard(configurable). So most of the non-paranoid devices can accept.
breakwaterlabs 3d ago on HN
> filtered by device ID

This is of course a very weak protection, since a bad actor can MITM the real device.

It is conceptually similar to sticky-MAC protections, except those raise a very loud alarm that requires admin intervention when the attacker goofs. I suspect you're not shutting down the USB port on rule violation.

minekaz3333 2d ago on HN
Perhaps I should have started with the sentence about the USB controllers PCI passed through to an empty disposable virtual machine, not the "how to reenable what you really need" part...

> This is of course a very weak protection

Not a protection at all, the opposite. Like a network firewall: block everything by default and enable what the user wants.

By default you have zero allowed USB devices (not even a host USB controller) in a laptop setting (built in keyboards are mostly PS/2, pointing devices, wifi, etc. are PCI devices).

Best part is even if you need some USB devices in some task specific virtual machines, you still don't give the whole controller to the VM, but just the device with a USB-over-ethernet like mechanism.

> I suspect you're not shutting down the USB port on rule violation

There is no port to shut down. The host OS and the task specific VMs don't ever see the USB controller and it's ports.

breakwaterlabs 2d ago on HN
You misunderstand.

USB ID is conceptually similar to network “sticky mac”, in that only approved (unauthenticated) device identifiers are allowed on the bus: others see their traffic bit-binned.

The problem is of course that the identifier is sent in plain text, and is not device-bound (an attacker can spoof it).

So the very simplest attack on such systems is to put an interposer between the trusted device and the bus, capture the “trusted” ID, and use it to impersonate.

This is relevant to OS security because rubber ducky attacks can send key streams that do all sorts of fun things.

The network analogue here— sticky mac—- can actually be made tenable; any errors in interposing will result in a loud alarm in the NOC (port gets ERR_SHUTDOWN), and you can use 802.1x. USB device ID has no equivalent: it’s just an ID, and should not be relied upon for (false) security.

mr-anjaneyam (author) 46h ago on HN
Spot on. USB descriptors are completely unauthenticated. In ConfigFS it takes just two lines to spoof any VID/PID you want, which is why Emittr's tagline was about standard consumer OSes, not hardened setups like Qubes.
minekaz3333 39h ago on HN
Plugging USB devices into a computer is insecure, they can present themselves as any of billions of other USB devices and can change what they present themselves as any moment while still plugged in.

So in an spherical cow like theoretical ideal world computers don't have USB controllers. But in the real world some people want to use USB devices in some of their workflows.

If you can lock the host USB controller into an empty disposable virtual machine, you are approaching the ideal. But it gives you the ability to lower your security as you wish and use the plugged in devices. Trusting USB IDs, port numbers etc. are only an optional convenience so real world people don't have to use even more insecure systems just because they want to use a mouse or a flash drive.

But it is even better: what if my USB mouse switches to be a keyboard 2 minutes after approval to be used in the host system? In Qubes OS nothing, because it is not the actual USB mouse that is passed back to the host, but only the mouse movements/click events through a very minimal, easy to audit "mouse event forwarder" system. The same is true for some other categories of USB devices, so linux kernel vulnerabilities in your "host OS" or in task specific virtual machines are not exploitable with USB devices. Only if you specifically choose to tunnel the whole USB device into a specific VM, USB-over-ethernet style, but then only that VM can be attacked.

lefra 3d ago on HN
It is possible to design a keyboard, with a 4g chip inside to send all keypresses to whomever or remotely take control of the airgapped computer. The firmware will of course spoof a legitimate device ID. That's not even hard, a few weeks of work at most for an electronics engineer + embedded software developper.

You don't protect against that with software, but with careful supply-chain control, a faraday cage, and an armed guard who detains anyone attempting something funny.

minekaz3333 2d ago on HN
The fake keyboard can happily type away in the small, empty, networkless, disposable virtual machine the USB controller of the machine (the PCI device) is locked into.

Neither the "host OS" (no such thing really, Qubes OS is based on Xen hypervisor) or any other VM even sees the physical USB controller, let alone anything plugged into it.

_Microft 4d ago on HN
And is that really a good idea? These systems might be airgapped for good reason.
mr-anjaneyam (author) 3d ago on HN
This doesn't break the containment. This comes handy when it's needed to type some complex scripts chatgpt gives to debug. once our work is done, we can plug out to respect the airgap
thereader12 3d ago on HN
I mean entering a complex script from an ai very well may introduce a virus that otherwise wouldn't be possible. And if the android can connect to the internet, then hasn't containment been broken?
mr-anjaneyam (author) 3d ago on HN
This can type script to the machine, if the machine is offline then any curl type commands will definitely fail. By complex scripts - i meant lengthy or not typing friendly scripts
HeWhoLurksLate 3d ago on HN
you can also get an okay bitrate back out again if you combine toggling num lock, screen lock, and caps lock (and googling it, compose and kana gets you to 5 bits)
mr-anjaneyam (author) 2d ago on HN
Cool.. i never knew that. Learned something new
exe34 3d ago on HN
mr-anjaneyam (author) 3d ago on HN
curl: (6) Could not resolve host. Guess you will have to type the virus manually ¯\_(ツ)_/¯
VikingCoder 3d ago on HN
I actually can't imagine how you can say it doesn't break containment.

Of course it does.

alhadrad 3d ago on HN
Its wildly unethical.
clickety_clack 3d ago on HN
Did the people that built the containment approve the device?
luxuryballs 3d ago on HN
hey don't tell! I opted against sharing my fun versions of this approach for a reason :)
mr-anjaneyam (author) 3d ago on HN
Haha! Now you made me more curious. I'll take the hint though :)
lefra 3d ago on HN
If I went to the extreme of air-gapping a machine, I'd make sure that anyone trying to plug a phone to it gets fired on the spot.
recursive-call 3d ago on HN
This. One of the main selling points being that a security audit won't catch your usage of the device really makes this whole thing feel shady. I'm sure spies will love it.
djriley 3d ago on HN
That sort of felt like the whole purpose to me. First thing I did after reading the README is looked up how to lock USB down completely. Looks like USBGuard is the best way to do this on Linux, it allows you to inspect attributes and pin devices to a specific port.

This is shady. It's also an issue a lot of people may not be aware of. It's best to call attention to holes lest someone fall in one. Anyone maintaining a serious air-gapped system should already be strictly controlling who has physical access to the machine. But there are a lot of less serious but very vulnerable targets that admins would be wise to consider this sort of thing. Retail displays, road signs, kiosks, etc.

Just because trespassing is a crime doesn't mean it's still not wise to lock your doors.

mr-anjaneyam (author) 3d ago on HN
If they are already collecting data from input devices somehow, from laptop's keyboard or attached one, they can see keystrokes from this USB device too. (I tried a software keylogger to test, but it prioritized internal keyboard only)
leonidasrup 3d ago on HN
I have seen computers in some air-gapped high security areas where all USB ports were physically disabled - filled with glue. Of course there were very strict rules about not bringing in any kind of unregistered electronic devices (also any dangerous objects, knives or even screwdrivers) and entries to this facilities were controlled by security personnel with metal detectors.
mr-anjaneyam (author) 3d ago on HN
These scenarios can be an exception. air-gapped can either be for system safety (like in internal server rooms) or high security areas where it's reasonable
0cf8612b2e1e 3d ago on HN
Does anyone still make PS/2 peripherals just for high security areas?
mr-anjaneyam (author) 3d ago on HN
Would be funny if PS/2 ended up being the last trusted interface in these environments :)
tosapple 3d ago on HN
i've casually stockpiled ps2 kbs for a while, goodwill is a decent source that technically can't be interdicted.

they made optical mice during the ps2 era too but i'm unsure about the resolution.

there are also usb-to-serial and usb-to-irda adapters.

the usb-to-irda may be convertible to visible light freqs via basic soldering.

palmos and windowsce hardware devices may be sufficiently early enough to not suffer from arm trustzone and intel amt | me or amd psp.

mr-anjaneyam (author) 46h ago on HN
good will supply chain security is undefeated. wild how old PS/2 and IrDA gear ends up being more trustworthy than modern hardware :)
kube-system 3d ago on HN
There's tons of specialty peripherals out there

https://stacosystems.com/m816/

mr-anjaneyam (author) 3d ago on HN
Some like me feel using their own mechanical keyboard. Our phone can wear a mask of keyboard if connected :) I wonder how can you classify a legitimate keyboard vs a legitimated keyboard.
mkesper 3d ago on HN
By only allow registered USB IDs?
fn-mote 3d ago on HN
No, you can lie about that, too.

It’s a keyboard if you can show it to your site manager and they nod and say “OK” instead of “you’re fired.”

mr-anjaneyam (author) 46h ago on HN
This. At the end of the day, it's a physical/policy boundary, not a USB descriptor one. Emittr is meant for your own gear or an approved admin toolkit.
crtified 3d ago on HN
One is a keyboard.

The other is a small self-contained computer with multiple airwave capabilities, some of its protections removed (rooting), all in an obsolete system (an old Android phone) which is itself a hive of vulnerabilities for anybody that gets access to it physical or digital.

If that was brought into my workplace there'd be serious discussions.

That is not a criticism of your creative work here, just an acknowledgement that a portion of workplaces would not take this lightly. Most who that applies to, should know, but it's still worth mentioning.

clickety_clack 3d ago on HN
I can’t imagine a workplace paranoid enough to have an air-gapped system, but chill enough to let people connect whatever they want to it.
mr-anjaneyam (author) 46h ago on HN
100% fair. Definitely not for sneaking into restricted workplaces. It's for authorized admin work & personal labs. And for the truly paranoid, you can always pull wifi/cellular antennas out of spare phone, and turn it into a dumb, wired-only USB tool.
clickety_clack 3d ago on HN
100% this. Like, not even a shadow of a hesitation.
jasode 3d ago on HN
>, so it works in every locked down OS as well, BIOS, GRUB, etc.

Fyi... Apple MacBook laptops and iPhones block USB peripherals (including keyboards) unless the password is first entered on the real builtin keyboard or touchscreen to approve it.

Supposedly, Apple does this to prevent gadgets like yours from brute-forcing passwords.

mr-anjaneyam (author) 3d ago on HN
Yes, absolutely. Apple has these protections for a good reason. But Emittr is primarly intended for systems we own/authorized to manage. I see it more as a feature-rich, programmable super keyboard than a bypass tool
evandrofisico 3d ago on HN
Yep, I do this on my notebook, not loading USB peripherals until the luks partition is unlocked.
mr-anjaneyam (author) 2d ago on HN
Hm yea! And if we allow the keyboard, Emittr works just fine with no installation in macbook
GuB-42 3d ago on HN
So, it essentially turns the phone into a "BadUSB" device.

I wanted to do this with a Flipper Zero on a locked-down system but I refrained, a keyboard firing a script at 1000 WPM really looks like an attack, and I don't want to do something that looks like an attack on a system that is not mine.

It doesn't mean it is not useful, in fact, it may be too useful, that's the problem...

ray_v 3d ago on HN
I did this over the weekend with Claude. My Flipper Zero was paired to my tablet as a Bluetooth HID keyboard ... Claude wrote a custom app for the Flipper that acted like the keyboard, with human-like timing between keystrokes. Claude called the device over RPC on USB, through a small HTTP daemon it also wrote, so anything on my network could send text to type. This was a few hours worth of effort. Wild times.
mr-anjaneyam (author) 2d ago on HN
Sounds cool. I did a similar one with ESP32. Connects to any device via bluetooth as Keyboard, and starts a small webserver over LAN. Any device can send keystrokes via air.
arde 3d ago on HN
Now, if it could also use the camera to forward video it would turn into a full KVM-over-IP. Or it could parse the camera input for text output or automation. Or it could use STT for its input, so it would enable easy verbal interaction with any device.
mr-anjaneyam (author) 3d ago on HN
Interesting directions! Camera + HID would be really an exciting combination. imagine having both visual feedback and input control without installing anything on the target machine. STT idea is also worth exploring!
rootsudo 3d ago on HN
https://en.wikipedia.org/wiki/BadUSB
mr-anjaneyam (author) 3d ago on HN
Yes, same underlying concept. Emittr is more about interactive input and repurposing your phone into a feature-rich programmable keyboard. The difference is more in the approach and intended use.
Fe2O3 3d ago on HN
> Placeholder. Actual demo soon

That's all I needed to see.

mr-anjaneyam (author) 3d ago on HN
I recorded only a few scenarios. Didn't get enough time to edit. I'm planning to add by end of this week :)
mzajc 3d ago on HN
> Nobody blocks a keyboard

Some of us do: https://usbguard.github.io/

mr-anjaneyam (author) 3d ago on HN
True. USBGuard is linux specific. I was thinking more broadly about systems that don't have restrictions turned on by default. BIOS/UEFI and other OS have their own mechanisms though
yjftsjthsd-h 3d ago on HN
> Out of band bridge : we don't store passwords or authenticators on rooted phone. Emittr exposes a web UI on LAN, so we can send keystrokes from our main phones.

Depending on threat model (do you trust the network?), that seems less secure than keeping credentials on-device.

mr-anjaneyam (author) 46h ago on HN
Depends on the network, for sure. Treating the rooted device as stateless dongle over Private LAN/Hotspot feels safer to me, than storing credentials on a unlocked device. If the network isn't trusted, Direct mode skips it entirely. (over the network feature can be disabled)
pritambaral 3d ago on HN
Non-slop, pre-existing alternative: https://github.com/Arian04/android-hid-client
alhadrad 3d ago on HN
I take issue with this project unapologetically condoning and promoting wildly unethical use.
gunalx 3d ago on HN
Dosent this defeat the entire point of the airgap? I know the pain but still.
mr-anjaneyam (author) 46h ago on HN
Not really. An airgap is about preventing network access and data exfiltration. HID is strictly one way protocol, so keystrokes in , nothing out. so it's no different from typing it manually, just faster and without typos.

Comments are loaded live from Hacker News and are not stored by Mid or Real.