Weil Jimmer's BlogWeil Jimmer's Blog


BadUSB 初體驗 Arduino Duckuino Hid Keyboard Attack

-
更新於 2017-12-24 19:36:21

最近不知道為啥,突然心血來潮一直想要來編譯 USB隨身碟,做一支 BadUSB,遺憾的是一直找不到目標型號的控制器(Controller)。後來搜尋,沒想到網路上竟然已經有賣類似功能的東西了!

BadUSB 顧名思義就是壞的 USB 碟,會執行一些程式碼,可能會讓電腦受損,而這類攻擊都是需要實體插入電腦裡面的,並且,防毒軟體有很大機率是掃描不到,程式碼都是在閃存控制器(Flash Memory Controller)裡面,除非很底層的軟體,否則幾乎是碰不到那區塊。

雖然一般隨身碟拿來修改的話,價格比較便宜,但是不太好操作,真正的 Rubbery Ducky 又太貴了,買不起。網路上的 Arduino 做成的微型控制器比較便宜一點。很久以前也有萌生用 Arduino 實作的想法,不過太醜了,就是一塊電路板,沒有殼,網路上找不太到賣殼的,而現在我找到的真的很精美,不是 MicroUSB 所以連轉接都不用,於是乎買來體驗一下。僅僅是測試,至於啥麼用途,可以自由發揮,例如:騙別人這是普通的隨身碟之類的,插上去就立刻變身成鍵盤執行惡意代碼。

上圖即是我網購的帶有 Arduino ATmega32U4 控制器的 USB,外觀就像正常的隨身碟,不是所有 Arduino 都可以當成鍵盤用,例如 Arduino Nano 就不行。

這樣一來就可以把 Arduino 當成 Rubbery Ducky 使用,直接實行 Hid Keyboard Attack。網路上已經有教學文章可以直接將 Rubbery Ducky 的程式碼 轉為 Arduino專用的程式碼。這樣就不太需要自己修改。

可以參考:https://github.com/Nurrl/Duckuino

DELAY 2000
GUI r
DELAY 100
SHIFT
STRING cmd
ENTER
DELAY 100
STRING shutdown -t 0 -y -s
ENTER

以上是我編譯的 Script Example,用途是立刻將電腦關機,當我實際運行時有遇到不少麻煩,好像開不了 Windows Key + R Key,最後解決方法是把

Keyboard.press("r"); 
換成
Keyboard.press('r');

就這個單雙引號害我 Debug 好久,加上 Delay 好像也沒用。覺得奇特。

運行結果如下方影片:

By Weil Jimmer


This entry was posted in Arduino, C, General, Experience, Functions, Note By Weil Jimmer.

About Weil Jimmer

avatar

Hi! Everyone! My name is Weil Jimmer. This is my personal blog. I'm a webmaster of this site. I hope the site will be popular. Now, Let's go! Enjoy gaining more knowledge.
More Details About Me : https://weils.net/profile.php

Leave a Reply

Name*:

Email*:

Website:

Privacy:   

Comment*:

Visitor Count

pop
nonenonenone

Note

台灣假新聞橫行,沒一家霉體能信的,網軍側翼到處洗風向,堪憂。

毋忘初心,
絕不利慾薰心。

支持網路中立性.
Support Net Neutrality.

飽暖思淫欲,
饑寒起盜心。

支持臺灣實施無條件基本收入

今天是國際盲人節。

Words Quiz


Search

Music

Blogging Journey

4428days

since our first blog post.

The strong do what they can and the weak suffer what they must.

Privacy is your right and ability to be yourself and express yourself without the fear that someone is looking over your shoulder and that you might be punished for being yourself, whatever that may be.

It is quality rather than quantity that matters.

I WANT Internet Freedom.

Reality made most of people lost their childishness.

Justice,Freedom,Knowledge.

Without music life would be a mistake.

Support/Donate

This site also need a little money to maintain operations, not entirely without any cost in the Internet. Your donations will be the best support and power of the site.
MethodBitcoin Address
bitcoin1gtuwCjjVVrNUHPGvW6nsuWGxSwygUv4x
buymeacoffee
Register in linode via invitation link and stay active for three months.Linode

Support The Zeitgeist Movement

The Zeitgeist Movement

The Lie We Live

The Lie We Live

The Questions We Never Ask

The Questions We Never Ask

Man

Man

THE EMPLOYMENT

Man

In The Fall

In The Fall

Facebook is EATING the Internet

Facebook

Categories

Android (7)

Announcement (4)

Arduino (2)

Bash (2)

C (3)

C# (5)

C++ (1)

Experience (52)

Flash (2)

Free (13)

Functions (36)

Games (13)

General (60)

Git (2)

HTML (7)

Java (13)

JS (7)

Mood (24)

NAS (2)

Note (32)

Office (1)

OpenWrt (6)

PHP (9)

Privacy (4)

Product (12)

Python (4)

Software (11)

The Internet (25)

Tools (16)

VB.NET (8)

WebHosting (7)

Wi-Fi (5)

XML (4)