Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/securing/gattacker
A Node.js package for BLE (Bluetooth Low Energy) security assessment using Man-in-the-Middle and other attacks
https://github.com/securing/gattacker
Last synced: about 1 month ago
JSON representation
A Node.js package for BLE (Bluetooth Low Energy) security assessment using Man-in-the-Middle and other attacks
- Host: GitHub
- URL: https://github.com/securing/gattacker
- Owner: securing
- License: mit
- Created: 2016-08-03T10:21:08.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-01-31T05:53:09.000Z (almost 3 years ago)
- Last Synced: 2024-10-23T12:29:05.128Z (about 2 months ago)
- Language: JavaScript
- Homepage: http://www.gattack.io
- Size: 305 KB
- Stars: 702
- Watchers: 35
- Forks: 141
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- bluetoolkit - https://github.com/securing/gattacker - 16/materials/us-16-Jasek-GATTacking-Bluetooth-Smart-Devices-Introducing-a-New-BLE-Proxy-Tool.pdf](https://www.blackhat.com/docs/us-16/materials/us-16-Jasek-GATTacking-Bluetooth-Smart-Devices-Introducing-a-New-BLE-Proxy-Tool.pdf) | MITM BLE | (Install / Vulnerabilities to be added soon)
- awesome-hacking-lists - securing/gattacker - A Node.js package for BLE (Bluetooth Low Energy) security assessment using Man-in-the-Middle and other attacks (JavaScript)
- awesome-network-stuff - **385**星 - in-the-Middle and other attacks (<a id="42f9e068b6511bcbb47d6b2b273097da"></a>未分类 / <a id="3bd67ee9f322e2c85854991c85ed6da0"></a>投毒&&Poisoning)
README
![gattacker](https://raw.githubusercontent.com/securing/gattacker/master/img/gattacker.png)
A Node.js package for BLE (Bluetooth Low Energy) Man-in-the-Middle & more.
## Prerequisites
see:
https://github.com/sandeepmistry/noble
https://github.com/sandeepmistry/bleno
## Install
```sh
npm install gattacker
```## Usage
### Configure
Running both components Set up variables in config.env:
* NOBLE_HCI_DEVICE_ID : noble ("central", ws-slave) device
* BLENO_HCI_DEVICE_ID : bleno ("peripheral", advertise) deviceIf you run "central" and "peripheral" modules on separate boxes with just one BT4 interface, you can leave the values commented.
* WS_SLAVE : IP address of ws-slave box
* DEVICES_PATH : path to store json files### Start "central" device
```sh
sudo node ws-slave
```
Connects to targeted peripheral and acts as websocket server.Debug:
```sh
DEBUG=ws-slave sudo node ws-slave
```### Scanning
#### Scan for advertisements
```sh
node scan
```
Without parameters scans for broadcasted advertisements, and records them as json files (.adv.json) in DEVICES_PATH#### Explore services and characteristics
```sh
node scan
```
Explore services and characteristics of chosen peripheral.
Saves the explored service structure in json file (.srv.json) in DEVICES_PATH.### Hook configuration (option)
For active request/response tampering configure hook functions for characteristic in device's json services file.
Example:
```javascript
{
"uuid": "06d1e5e779ad4a718faa373789f7d93c",
"name": null,
"properties": [
"write",
"notify"
],
"startHandle": 8,
"valueHandle": 9,
"endHandle": 10,
"descriptors": [
{
"handle": 10,
"uuid": "2902",
"value": ""
}
],
"hooks": {
"dynamicWrite": "dynamicWriteFunction",
"dynamicNotify": "customLog"
}
}
```Functions:
dynamic: connect to original device
static: do not connect to original device, run the tampering function locally
It will try to invoke the specified function from hookFunctions, include your own.
A few examples provided in hookFunctions subdir.staticValue - static value
### Start "peripheral" device
```sh
node advertise -a [ -s ]
```It connects via websocket to ws-slave in order to forward requests to original device.
Static run (-s) sets services locally, does not connect to ws-slave. You have to configure the hooks properly.## MAC address cloning
For many applications it is necessary to clone MAC address of original device.
A helper tool bdaddr from Bluez is provided in helpers/bdaddr.```sh
cd helpers/bdaddr
make
```wrapper script:
```sh
./mac_adv -a [ -s ]
```## Dump, replay
Dump files are saved in a path configured by `DUMP_PATH` in config.env (by default `dump`).
More info:
https://github.com/securing/gattacker/wiki/Dump-and-replay## Troubleshooting
Turn off, cross fingers, try again ;)
### reset device
```sh
hciconfig reset
```### Running ws-slave and advertise on the same box
With this configuration you may experience various problems.
Try switching NOBLE_HCI_INTERFACE and BLENO_HCI_INTERFACE
### hcidump debug
```sh
hcidump -x -t
```## FAQ, more information
FAQ: [https://github.com/securing/gattacker/wiki/FAQ](https://github.com/securing/gattacker/wiki/FAQ)
More information: [www.gattack.io](www.gattack.io)
## License
Copyright (C) 2016 Slawomir Jasek, SecuRing
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.