pentestfunctions / BlueDucky

🚨 CVE-2023-45866 - BlueDucky Implementation (Using DuckyScript) 🔓 Unauthenticated Peering Leading to Code Execution (Using HID Keyboard)
1.27k stars 218 forks source link

I get the error No Compatible {blue}Bluetooth devices{reset} are connected. #49

Open Aggelos11 opened 6 months ago

Aggelos11 commented 6 months ago

Screenshot from 2024-05-18 10-53-19 Screenshot from 2024-05-18 10-53-57 Screenshot from 2024-05-18 10-55-13 Screenshot from 2024-05-18 10-55-41

Flynnlin commented 6 months ago

same

DG1FI commented 6 months ago

Same - with internal RPI4 BT Device and an Cambridge Stick.

YKTV8 commented 6 months ago

Confirmed. Same issue. RPI4 Asus BT adapter.

Aggelos11 commented 6 months ago

I don’t think it’s the adaptor problem . The developer modified the script some days before and probably he broke something . He needs to fix it asap

Lamentomori commented 6 months ago

I don’t think it’s the adaptor problem . The developer modified the script some days before and probably he broke something . He needs to fix it asap

Its a problem with your adapter. If you check BlueDucky.py, on Line: 640 We have a new Function Called "troubleshoot_bluetooth". The purpose of this function is to troubleshoot the adapters capability with bluetoothctl, if the adapter is not capatible with Bluetoothctl, or Bluetoothctl has been installed incorrectly you will be notified of whats preventing you from accessing the application. It is designed to keep people who are not capable of accessing the application later from accessing it initially..

Please Reference the code found in this function

 # Check if bluetoothctl is available
    try:
        subprocess.run(['bluetoothctl', '--version'], check=True, stdout=subprocess.PIPE)
    except subprocess.CalledProcessError:
        print("{reset}[{red}!{reset}] {red}CRITICAL{reset}: {blue}bluetoothctl {reset}is not installed or not working properly.")
        return False

    # Check for Bluetooth adapters
    result = subprocess.run(['bluetoothctl', 'list'], capture_output=True, text=True)
    if "Controller" not in result.stdout:
        print("{reset}[{red}!{reset}] {red}CRITICAL{reset}: No {blue}Bluetooth adapters{reset} have been detected.")
        return False

    # List devices to see if any are connected
    result = subprocess.run(['bluetoothctl', 'devices'], capture_output=True, text=True)
    if "Device" not in result.stdout:
        print("{reset}[{red}!{reset}] {red}CRITICAL{reset}: No Compatible {blue}Bluetooth devices{reset} are connected.")
        return False

    # if no issues are found then continue
    return True
Lamentomori commented 6 months ago

If you think this may be a mistake, please contact me via discord with anything that may help your problem if it does NOT concern your Bluetooth Adapter, If your Bluetooth adapter is not supported, Then it is NOT supported. You will need to use another device or purchase a new Adapter, and I will work with you to fix the problem | I apologize for any inconvenience. @youjsgotpwned

Aggelos11 commented 6 months ago

Well my Bluetooth adaptor is Asus USB-BT500 USB Bluetooth 5.0 . Do you know if I should install any drivers or something ? Because it recognised by Kali and I can scan for Bluetooth devices using the hcitool. Do you have any adaptor to suggest ?

Lamentomori commented 6 months ago

Screenshot from 2024-05-18 10-53-19 Screenshot from 2024-05-18 10-53-57 Screenshot from 2024-05-18 10-55-13 Screenshot from 2024-05-18 10-55-41

I do apologise, I did not see the screenshot.

Lamentomori commented 6 months ago

Well my Bluetooth adaptor is Asus USB-BT500 USB Bluetooth 5.0 . Do you know if I should install any drivers or something ? Because it recognised by Kali and I can scan for Bluetooth devices using the hcitool. Do you have any adaptor to suggest ?

within BlueDucky.py the original developer Hardcoded Hci0 causing issues. I added this to make debugging easier, I will make a modification to check for another Bluetooth adapter as it defaults to hci0. For now Please open BlueDucky.py and 'Control + F' and find hci0 and replace it with hci1.

Lamentomori commented 6 months ago

Well my Bluetooth adaptor is Asus USB-BT500 USB Bluetooth 5.0 . Do you know if I should install any drivers or something ? Because it recognised by Kali and I can scan for Bluetooth devices using the hcitool. Do you have any adaptor to suggest ?

within BlueDucky.py the original developer Hardcoded Hci0 causing issues. I added this to make debugging easier, I will make a modification to check for another Bluetooth adapter as it defaults to hci0. For now Please open BlueDucky.py and 'Control + F' and find hci0 and replace it with hci1.

Doing what I described above, should resolve your issues. As right now its defaulting to an adapter that is DOWN or currently Not Available. Feel free to contact me via discord: @youjsgotpwned

Aggelos11 commented 6 months ago

Yes but as you can see in the screenshot I sent I already replaced hci0 with hci1 in the line 674 I think where it says default=… . Should I replace it to other points as well ?

Aggelos11 commented 6 months ago

Also can you check if my adaptor is supported pls or not ? Because as I told you it can scan for Bluetooth devices using the the hcitool which I think it’s a sign that it should work

alex8819 commented 6 months ago

On raspberry Pi 5 with ubuntu server i solved with this:

Restart the bluetooth sudo systemctl restart bluetooth

Start the process: bluetoothctl

execute command:

power on
agent on
default-agent
scan on

Exit from bluetoothctl exit

after that: sudo python3 BlueDucky.py will start.

Aggelos11 commented 6 months ago

Do I need to do this every time I wanna use it or only once ?

alex8819 commented 6 months ago

After BlueDucky.py crash, every time i need to make this command 2 times, after that BlueDucky.py start, but when it will crash i need to do it again. i mada a small script to speed up: sudo nano reset.sh

#!/bin/bash
# Script per ripristinare il Bluetooth dopo un crash di BlueDucky.py

echo "Ripristino del Bluetooth in corso..."
sudo systemctl restart bluetooth
bluetoothctl power on
bluetoothctl agent on
bluetoothctl default-agent
bluetoothctl scan on

Add permission: sudo chmod +x reset.sh

execute the script: ./reset.sh

Stop the script CTRL + C

Execute agin,stop again and start: sudo python3 BlueDucky.py

Aggelos11 commented 6 months ago

Which chipset does your wireless adaptor have ?

DG1FI commented 6 months ago

the commands are working. with "bluetoothctl scan on" it found many bluetooth devices, like mobile phones and bluetooth speatker. the blueducky script found only my lge tv. i've tried it many times and with different adapters...

without the commands above, the adapters are not working -> no compatible adapters found

DG1FI commented 6 months ago

# List devices to see if any are connected result = subprocess.run(['bluetoothctl', 'devices'], capture_output=True, text=True) if "Device" not in result.stdout: print("{reset}[{red}!{reset}] {red}CRITICAL{reset}: No Compatible {blue}Bluetooth devices{reset} are connected.") return False

i've try it out... the command "bluetoothctl devices" is here empty at startup... the command "scan on" initiates the scan and add devices to the list, like this:

Device 48:E1:5C:76:34:B2 48-E1-5C-76-34-B2 Device 3E:55:13:F2:A9:72 3E-55-13-F2-A9-72 Device 74:FF:8F:4C:5E:76 74-FF-8F-4C-5E-76 Device 61:76:CB:39:FD:7F 61-76-CB-39-FD-7F Device 18:58:80:51:30:89 [LG] webOS TV UQ70006LB Device C4:35:34:37:12:75 Govee_H6072_1275 Device C4:42:25:D7:3B:34 T-Echo DG1FI-11 [bluetooth]#

but if i run blueducky, only my lge tv is listed- the other devices not.

Aggelos11 commented 6 months ago

Same for me … I also contacted the developer on Discoed but he does not respond as he has said ..

Flynnlin commented 6 months ago

在带有 ubuntu 服务器的树莓派 5 上,我解决了这个问题:

重新启动蓝牙 sudo systemctl restart bluetooth

启动进程: bluetoothctl

执行命令:

power on
agent on
default-agent
scan on

退出bluetoothctl exit

之后: sudo python3 BlueDucky.py将开始。

worked. my device is Pi ZERO 2W

Aggelos11 commented 6 months ago

It worked for me once but I need to repeat this process each time I want to run the script . Also most times it does not work ( does not find Bluetooth devices )

Christiancoding commented 6 months ago

I had the same issue: {reset}[{red}!{reset}] {red}CRITICAL{reset}: No Compatible {blue}Bluetooth devices{reset} are connected.

I fixed it by connecting it to a Bluetooth device. After that, it worked just fine.

Aggelos11 commented 6 months ago

And how exactly did you do that ?

mohamedmajid91 commented 6 months ago

!/bin/bash

Script to unblock and restore Bluetooth after a crash of BlueDucky.py

echo "Restoring Bluetooth..." Unblock the Bluetooth device

if ! sudo rfkill unblock bluetooth; then echo "Failed to unblock Bluetooth device." exit 1 fi Bring up the Bluetooth interface

if ! sudo hciconfig hci1 up; then echo "Failed to bring up Bluetooth interface." exit 1 fi Restart the Bluetooth service

if ! sudo systemctl restart bluetooth; then echo "Failed to restart Bluetooth service." exit 1 fi Wait for the service to restart

sleep 5 Use bluetoothctl to configure Bluetooth

{ echo "power on" sleep 1 echo "agent off" sleep 1 echo "agent on" sleep 1 echo "default-agent" sleep 1 echo "scan on" sleep 5 } | bluetoothctl

echo "Bluetooth restored successfully." Delay before running the Python script

sleep 5 Run the Python script

if ! sudo python3 BlueDucky.py; then echo "Failed to run BlueDucky.py." exit 1 fi

exit 0

sudo nano restore_bluetooth.sh

sudo chmod +x restore_bluetooth.sh

ABC00012345 commented 5 months ago

or just remove the return False in the script, it is working for me

Aggelos11 commented 5 months ago

Can you explain it a bit more please ? Exactly what I need to do in which line etc?

or just remove the return False in the script, it is working for me

ABC00012345 commented 5 months ago

Can you explain it a bit more please ? Exactly what I need to do in which line etc?

or just remove the return False in the script, it is working for me

Here, I think it's near to line 640, the last return False, where it says before no compltatible bluetooth devices connected. Or you can also remove the complete if condition:

Check if bluetoothctl is available try: subprocess.run(['bluetoothctl', '--version'], check=True, stdout=subprocess.PIPE) except subprocess.CalledProcessError: print("{reset}[{red}!{reset}] {red}CRITICAL{reset}: {blue}bluetoothctl {reset}is not installed or not working properly.") return False

# Check for Bluetooth adapters
result = subprocess.run(['bluetoothctl', 'list'], capture_output=True, text=True)
if "Controller" not in result.stdout:
    print("{reset}[{red}!{reset}] {red}CRITICAL{reset}: No {blue}Bluetooth adapters{reset} have been detected.")
    return False

# List devices to see if any are connected
result = subprocess.run(['bluetoothctl', 'devices'], capture_output=True, text=True)
if "Device" not in result.stdout:
    print("{reset}[{red}!{reset}] {red}CRITICAL{reset}: No Compatible {blue}Bluetooth devices{reset} are connected.")
    return False # HERE ....................... Remove this

# if no issues are found then continue
return True
Robotic31 commented 4 months ago

Pada raspberry Pi 5 dengan server ubuntu saya selesaikan dengan ini:

Mulai ulang bluetoothnya sudo systemctl restart bluetooth

Mulai prosesnya: bluetoothctl

jalankan perintah:

power on
agent on
default-agent
scan on

Keluar dari bluetoothctl exit

setelah itu: sudo python3 BlueDucky.pyakan dimulai.

good its work

Kami-Sama123 commented 4 months ago

On raspberry Pi 5 with ubuntu server i solved with this:

Restart the bluetooth sudo systemctl restart bluetooth

Start the process: bluetoothctl

execute command:

power on
agent on
default-agent
scan on

Exit from bluetoothctl exit

after that: sudo python3 BlueDucky.py will start.

Bro Alex you are amazing

harshads-dev commented 2 months ago

can i run this on my laptop?

harshads-dev commented 2 months ago

@alex8819 @mohamedmajid91 @Christiancoding @Flynnlin @Aggelos11 will this code run on my laptop?

Jaron-Wilson commented 2 months ago

After BlueDucky.py crash, every time i need to make this command 2 times, after that BlueDucky.py start, but when it will crash i need to do it again. i mada a small script to speed up: sudo nano reset.sh

#!/bin/bash
# Script per ripristinare il Bluetooth dopo un crash di BlueDucky.py

echo "Ripristino del Bluetooth in corso..."
sudo systemctl restart bluetooth
bluetoothctl power on
bluetoothctl agent on
bluetoothctl default-agent
bluetoothctl scan on

Add permission: sudo chmod +x reset.sh

execute the script: ./reset.sh

Stop the script CTRL + C

Execute agin,stop again and start: sudo python3 BlueDucky.py

Yours dont work so i made one:



# Restart Bluetooth service
echo "Restarting Bluetooth service..."
sudo systemctl restart bluetooth

# Start Bluetoothctl and execute commands
echo "Starting bluetoothctl and executing commands..."
(
    echo "power on"
    sleep 1
    echo "agent on"
    sleep 1
    echo "default-agent"
    sleep 1
    echo "scan on"
    sleep 5  # Adjust the delay as needed for scanning
    echo "exit"
) | bluetoothctl

# Start BlueDucky.py
echo "Starting BlueDucky.py..."
sudo python3 BlueDucky.py
MohammadParsaTheFirst commented 2 months ago

thank you for your guidance --- it worked for me

harshads-dev commented 2 months ago

@Jaron-Wilson brother i get error port 17 refused error even in android 11 and I tried on android 9 its sends a pair passkey for pairing it doesn't work, any thing to fix? Or which bluez version i should install in my laptop?

Help me, I am trying from more then 3 weeks

Jaron-Wilson commented 2 months ago

The port 17 is that android and ios forced an update without permission, when you turn on your phone and don't restart it it does the update in background, I used ble low power mode and that's the one for watches and that works. Error port 17 is patched, and the people who made this only posted the code after it got patched.

harshads-dev commented 2 months ago

@Jaron-Wilson Can you tell how you setup blueducky and bluez for this? which version of bluez you installed, when i tried on older device i get "ERROR - [TX-19] Bluetooth error: [Errno 104] Connection reset by peer" can you tell me how you setup this tool, bluez and blueducky, pybluez these

thank you for support brother

victordonat0 commented 1 month ago

The port 17 is that android and ios forced an update without permission, when you turn on your phone and don't restart it it does the update in background, I used ble low power mode and that's the one for watches and that works. Error port 17 is patched, and the people who made this only posted the code after it got patched.

working with my orange pi 3b i test on a A10