Trying Digispark
Eric Lee Lv999

本文仅供学习和研究目的,请勿用于非法用途。未经授权使用Bad USB可能违反法律。

BadUSB

Bad USB是一种利用USB设备进行的计算机安全攻击,它可以通过修改USB设备的固件,让其模拟键盘、鼠标等人机交互设备,从而在插入目标电脑后执行恶意代码。

Bad USB的攻击难以被杀毒软件检测和防御,因为它直接作用于USB控制器,而不是USB存储空间。Bad USB的攻击方法首次在2014年的黑帽大会上被安全研究人员展示,引起了广泛的关注和讨论。

制作Bad USB设备的步骤

要制作一个Bad USB设备,需要以下几个步骤:

准备硬件
编写代码
执行攻击

准备一个可编程的USB设备,如Arduino开发板或TEENSY芯片。本文使用Attiny85开发板Digispark。

使用Arduino IDE或其他工具,编写并上传一段能够模拟键盘输入的代码,如打开命令行窗口,下载并运行恶意脚本等。

将USB设备插入目标电脑,等待代码自动执行,完成攻击。

Bad USB的攻击方式非常隐蔽和危险,因为它可以利用用户对USB设备的信任,轻易地窃取信息、植入后门、传播病毒等。

上代码

Digispark.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "DigiKeyboard.h"

void setup() {
DigiKeyboard.sendKeyStroke(0);
DigiKeyboard.sendKeyStroke(KEY_D, MOD_GUI_LEFT);
DigiKeyboard.delay(100);
DigiKeyboard.sendKeyStroke(KEY_R, MOD_GUI_LEFT);
DigiKeyboard.delay(500);
DigiKeyboard.print("POWERSHELL");
DigiKeyboard.sendKeyStroke(KEY_ENTER);
DigiKeyboard.sendKeyStroke(KEY_ENTER);
DigiKeyboard.delay(500);
DigiKeyboard.print("Start-Process -FilePath 你的恶搞网站");
DigiKeyboard.sendKeyStroke(KEY_ENTER);
DigiKeyboard.sendKeyStroke(KEY_ENTER);
DigiKeyboard.delay(2000);
DigiKeyboard.sendKeyStroke(KEY_F11);
}

void loop() {
}

感兴趣的话你可以自己试试

PS:提供一份html模板,用于恶搞

Digispark.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!DOCTYPE html>
<html>
<head>
<style>
body {
background: #000 no-repeat center center fixed;
margin: 0;
cursor: none;
}

.d1 {
width: 550px;
margin: 0px auto;
}

.d2 {
position: absolute;
top: 50%;
width: 550px;
margin-top: -5%;
}
</style>
</head>

<body>
<div class="d1">
<div class="d2">
<center>
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGwAAABvCAYAAAAJ8iVjAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAZoSURBVHja7J1pbFVFFMd/bUFaKlqKtpRgrLg0hFBRFEXjggTQmCgqasRdjIkmxmAMUfjgEnEnIolL5AOgwRWKGkA0KIpiDC5URGoQ2YIKWKiipdgCxw9nDClq23vfu8vcmX/ykpf33n0z9/7umeXcmXMKRAQve1ToL4EH5uWBeXlgHpiXB+blgdmubo6ff2/gNGAw8BfwbNorXODgxLkEuAK4ChgGVJrP64FTvIWlC9TNwF3ASf/xfRFQAIgHlrzOAWYAQzr4TXPaYbky6HgIWN4JLIDNftCRrMqAV4ELu/j77z2w5NQHWGCawq6qwc/DklF3YE5AWHuBVR5YMnoUuDjgMSuAdR5Y/BoF3B3iuNm2nGCWJs4lwBfAoIDH/QTUAru8hcWrCSFgATxjC6wsWdiRwJfACQGPa0B9iXtsOdGsWNioELAA7rMJVpaAXReyKXzbthPNQpPYF/gOKA9wzLvApUCbbSebBQsbHhDWJ8D1NsLKCrCaEJa109aTzQKwqi78Zh8wzcBqsvlks+D8PaKT7+tR78eyLIyusuqtPwB8BjwNvGMsDA8sHaoHVpt+aSP6sHIl6szdn7U7MQ3D+hKgGF1T0Qr8aSwkSh0GVADVZlpQBPwG7AC2o66qvd7CdJBTC4xEn1cdY4bkJea7VnPhNgMfAu+ZOVY+7qpq4CL00UuNGayUHvIbAf4AGk0dPjVN6qq0WGtcFtYfuAEYCwwNMDrdZ5q3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AljmQ5hgAh+QQF9AEXACzOAAIABAAJAAAFCKAljmRpnmgIACH5BAUoIxcALNIAAgADAAkAAAUHoCWOZGmaIQAh+QQFyDIXACzVAAIAAgAJAAAFBqAljmQ5hgAh+QQFOEoXACzSAAIABQAJAAAFEWBVJcggntN0rlXKpjDLkkMIACH5BAXAXRcALM4AAgAEAAkAAAUOYCWO5GSaI0pW5ySeVQgAIfkEBegDFwAsyAACAAYACQAABRBgJY7iZFbnmKJkq06uuZYhACH5BAWsDRcALLUAAgATAAkAAAUa4DRVZGmeaKqaooi2cLvGa23fuFvFI27DlRAAIfkEBTIAFwAssAACAAUACQAABQ9gJU4kKZ5jOaFsW6ZrFQIAIfkEBTIAFwAsAAAAAAEAAQAABQPgFQIAIfkEBegDFwAsAAAAAAEAAQAABQPgFQIAIfkEBfQBFwAsoAACABAACQAABRngJFakOJHliKbq6r7wappxbd/wTON7rk8hACH5BAVoQhcALFUAAgBLAAkAAAVSYCWOpDid6DSmZVuxbom66bnGuDzrdu7/vl1MSCPyVENjDlbsvZQrYQ1pqgFJSiYQitMef94k9UouP52tsLmKZo/X8KY6+hbXs9Jpmnu+85doIQAh+QQFuAsXACwwAAIAJQAJAAAFLeAkTlU5nmWqomrrvi8Lp+c433iOy3pv0yIXKVcrGoO3n6mmO854ROUK2cOFAAAh+QQF6AMXACwVAAIAGwAJAAAFJWAljmQ1nehUrivKvnDrxrQ526k65nrtp77djUe6BVlE4elICgEAIfkEBcgAFwAsDAACAAkACQAABRJgJY7jZE5kqq7pabKVe4oovIYAIfkEBTIAFwAsBQACAAcACQAABRIgklRkaZLTqaJquqKTC0/iGQIAOw==" >
</center>
</div>
</div>
</body>
</html>
Powered by Hexo & Theme Keep
This site is deployed on