Hmm, what's this?
Someone has lost their USB Powerbank.
Manufactured by ACME!
I think they've got a pretty good reputation for reliability and quality.
This is a keeper, I'm taking this home.
Let's get it charged up - looks like it's working - the light is flashing.
I'll get on with the working day.
Yawn - time to call it a day.
What just happened to my computer?
I'll explain all after this quick plug for the channel sponsors PCBWay.
I know I say it every time, but they really are worth having a look at.
They don't just do PCBs, they also do 3D printing, CNC work and whole bunch of other useful things.
I've put a link in the description.
So, what happened?
My computer just got hacked!
There's a few things to unpack.
What's the anatomy of this hack?
We start off with a bit of social engineering
I've made a reasonable facsimile of a powerbank
It's got a USB connection for charging,
and it's a got a USB socket for powering other devices
It's also got a flashing light!
It's obviously completely fake
but if you were a serious hacker there's no reason why you could take a real power bank and replace the electronics with your own.
You could even make it completely functional so that it still acts as a power bank.
If you look inside my power bank it's not going to do much.
The USB socket is not connected to anything
and the charging side of things is actually going to a Teensy microcontroller.
I'm using the Teensy 4.1 but any Teensy version would do the job.
The Teensy is a really nice little device that has some useful features for what we're doing.
The first thing we need to make our fake power bank look realistic is a charging LED
getting a flashing LED on the Teensy is pretty easy,
we can just use the IntervalTimer functionality and turn the built in LED on and off.
You could get fancy here if you wanted and have the LED fade in and out using PWM.
To make it look nice I've used hot glue to make light pipe from inside the case.
This actually looks surprisingly good.
I think there's a project around using hot glue for light pipes in the future.
That's the social engineering side of things, we've got a reasonably realistic-looking power bank
that might fool someone enough that they would plug it into their computer.
The next thing we need to do is defeat some of the safety measures that are built into the computer.
The main one for this hack is the screen lock.
My computer is setup to lock its screen after a minute of idle time.
Once it's locked you can only access it with my password.
This would prevent us from taking over the computer and running our hack.
We need to stop the computer from locking the screen so that we can take control of it.
This is where the Teensy functionality comes in handy.
We can configure the Teensy to act as a USB mouse.
If you look carefully at the cursor you can see that it is moving very slightly.
This is obviously speeded up considerably, in a real hack attack
you'd probably only need to move it every 30 seconds.
It looks very obvious close-up, but when you are looking at the screen normally
with it only moving occasionally you don't notice
If we watch the computer now with the Teensy plugged in
we can see that it doesn't lock anymore.
So, what's next?
We now need to trigger our attack.
For my simple demo,
I'm just triggering the attack after a certain amount of time has passed since it was plugged in.
You could get very sophisticated here
you could include a real-time clock in your device so that it could be triggered at a particular time.
Or you could even include a remote control so the attack could be triggered manually.
This could be done using one of these wireless controls
or if you wanted very long-range there's no reason why you could include a GSM module and run the hack by sending a text message.
With the hack triggering mechanism done we need to execute the hack and deliver the payload.
To do this we take advantage of the fact that the Teensy can also act as a USB keyboard.
I'm targetting a Mac computer in this demo
so I have a set of keyboard commands that will use the quick launch mechanism of spotlight to run the Terminal application and then run a short script.
We run the terminal application by sending Command+Space to open up spotlight quick launch
and follow that by sending the string "terminal.app" followed by the return key.
This will either launch a new instance of Terminal or bring an existing running Terminal instance to the foreground.
If an existing Terminal is brought to the foreground it may be already running something.
To ensure we get a fresh prompt we use the Command+T keyboard combination to create a new Tab.
You'll notice in the code that I have a short delay between each of these commands
we need to give the computer time to launch the application
and to run any startup scripts for the terminal session.
With our terminal prompt active it's now a very simple case of just runing a small script
to download and run our payload.
You could embed the entire hacking script in the Teensy
but having it delivered from a remote server gives you a lot more flexibility.
For my demo I'm just downloading the script from my website.
This is a fun little demo, but it shows how careful you should be with random USB devices.
You don't really know what they are doing.
You are probbably thinking "I'd never fall for anything so obvious"
but what about your work colleagues?
Are they as smart as you?
And what about your children?
Or your parents?
When it comes to computer security paranoia really is your friend.
They are out to get you!
I've left out a couple of things that make this hack really effective.
You'll know if you are a regular mac user that when it detects a new keyboard it pops up this screen.
I'll leave it as an exercise for the viewer on how they would go about bypassing this.
So, that's it, thanks for watching
I've got quite a few projects in the pipeline so don't forget to subscribe.
I'll see you in the next video.