18 Commits

Author SHA1 Message Date
cecio
39b0a09ff8 bump to release 0.12.3 2023-08-06 12:43:32 +02:00
cecio
adaf489a82 bump to release 0.12.2 2023-08-02 17:20:27 +02:00
cecio
d57360e566 Merge branch 'main' of https://github.com/cecio/USBvalve 2023-07-28 14:48:52 +02:00
cecio
b3e43ff63d Bump to release 0.12.1 2023-07-28 14:47:42 +02:00
WM
999985150f STL files for 1.2 PCB (#6)
STL files for 1.2 PCB and 32 display cover.
2023-07-26 09:37:48 +02:00
cecio
ced8536f8c - HID serial read optimization
- BOOTSLE act now as reset
- bump to releas 0.12.0
2023-07-19 21:48:08 +02:00
cecio
77f995533e - HID serial read optimized
- BOOTSEL now act as reset button
- bump to release 0.12.0
2023-07-19 21:45:42 +02:00
cecio
3b0f285567 logo mods 2023-07-08 15:00:50 +02:00
cecio
52af9dabb7 Update README.md 2023-07-08 00:28:54 +02:00
cecio
94a5d2e8c5 Update README.md 2023-07-07 21:36:57 +02:00
cecio
ef2ddde66f added logo pic 2023-07-07 21:27:57 +02:00
cecio
7953e269af Update README.md 2023-07-05 00:53:07 +02:00
cecio
5aa63c8efe bump to release 0.11.0 2023-07-04 22:01:53 +02:00
cecio
39c3145e71 README mods 2023-07-04 21:38:30 +02:00
cecio
7daafb4d41 README mods 2023-07-04 21:36:54 +02:00
cecio
5a7a485aa4 README mods 2023-07-04 21:35:35 +02:00
cecio
08512d5d87 gitignore updated 2023-07-04 14:55:30 +02:00
cecio
1c351f3a7b Added Dockerfile for build environment 2023-07-04 14:54:42 +02:00
12 changed files with 124 additions and 12 deletions

2
.gitignore vendored
View File

@@ -50,3 +50,5 @@ modules.order
Module.symvers
Mkfile.old
dkms.conf
USBvalve_out

38
Dockerfile Normal file
View File

@@ -0,0 +1,38 @@
#
# To Build:
# docker build -t usbvalve/arduino-cli .
#
# To Run:
# docker run --rm --name usbvalve -v $PWD:/mnt usbvalve/arduino-cli /mnt/USBvalve
#
FROM ubuntu:22.04
WORKDIR /app
# OS setup
RUN apt-get update -y \
&& apt-get install -y git wget python3 \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# arduino-cli setup
RUN cd /app \
&& git clone --recursive https://github.com/arduino/arduino-cli.git \
&& cd arduino-cli \
&& ./install.sh \
&& export PATH=$PATH:/app/arduino-cli/bin \
&& arduino-cli --additional-urls https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json core search 2040 \
&& arduino-cli --additional-urls https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json core install rp2040:rp2040 \
&& arduino-cli lib install "Adafruit TinyUSB Library" \
&& arduino-cli lib install "ssd1306" \
&& arduino-cli lib install "Pico PIO USB" \
&& arduino-cli lib install "SSD1306Ascii"
# Compilation setup
RUN echo "#!/bin/bash" > /app/entrypoint.sh \
&& echo "export PATH=\$PATH:/app/arduino-cli/bin" >> /app/entrypoint.sh \
&& echo "arduino-cli compile --fqbn rp2040:rp2040:rpipico --board-options \"usbstack=tinyusb\" --board-options \"freq=240\" --output-dir \"/mnt/USBvalve_out\" \"\$1\"" >> /app/entrypoint.sh \
&& chmod +x /app/entrypoint.sh
ENTRYPOINT ["/app/entrypoint.sh"]

View File

@@ -1,5 +1,6 @@
# USBvalve
*Expose USB activity on the fly*
<h1><img width="200" alt="logo, landscape, dark text, transparent background" src="https://github.com/cecio/USBvalve/blob/main/pictures/USBvalve_logo_scaled.png"></a></h1>
### *Expose USB activity on the fly*
<img src="https://github.com/cecio/USBvalve/blob/main/pictures/versions.png" alt="The two models" width="30%" height="30%" />
@@ -131,7 +132,7 @@ It's done!
I don't know if it will ever be the case, but you may want to customize the firmware in order to avoid detection done by *USBvalve-aware* malware :-)
I grouped most of the variables you may want to modify in this section
I grouped most of the variables you may want to modify in this section ([see Dockerfile below for rebuilding](https://github.com/cecio/USBvalve#dockerfile))
```C
// Anti-Detection settings.
@@ -161,12 +162,25 @@ I grouped most of the variables you may want to modify in this section
Obviously you can also build your own firmware. To build the *standard* one I used:
- Arduino IDE 2.1.0
- Arduino IDE 2.1.1
- ~~as board I used `Raspberry Pi Pico - Arduino MBED OS RP2040` version `4.0.2`~~
- ~~`Adafruit TinyUSB Library` version `1.14.4`. Newer versions are not working because the RPI SDK of the board is stick to an older version. May be migrate the entire project directly on Raspberry Pi Pico SDK is the solution here.~~
- `Adafruit TinyUSB Library` version `2.2.1` and Board `Raspberry Pi RP2040 (2.7.0)` setting clock at 240MHz (overclock)
- `Adafruit TinyUSB Library` version `2.2.2` and Board `Raspberry Pi RP2040 (3.3.2)` setting clock at 240MHz (overclock)
- `ssd1306` OLED library version `1.8.3`
If you want to re-create a new fake filesystem, you may want to have a look to the `utils` folder, where I placed some utilities to build a new one.
**NOTE**: if you have ideas or improvements in your mind, I encourage you to open an issue so that we can improve the project together! Thanks!
#### Dockerfile
If you want to build your own firmware, after you customized it, I provide a `Dockerfile` which builds a complete **Arduino** environment and compile the firmware. Enter the following commands in the main `USBvalve` folder:
```
docker build -t usbvalve/arduino-cli .
docker run --rm --name usbvalve -v $PWD:/mnt usbvalve/arduino-cli /mnt/USBvalve
```
The firmware will be placed with extension `uf2` in folder `USBvalve_out`.
### Contribute
If you have ideas or improvements in your mind, I encourage you to open an issue so that we can improve the project together! Thanks!

Binary file not shown.

Binary file not shown.

View File

@@ -42,7 +42,7 @@ Adafruit_USBH_Host USBHost;
// Define vars for OLED screen
#define I2C_ADDRESS 0x3C // 0X3C+SA0 - 0x3C or 0x3D
#define RST_PIN -1 // Define proper RST_PIN if required.
#define OLED_HEIGHT 32 // 64 or 32 depending on the OLED
#define OLED_HEIGHT 64 // 64 or 32 depending on the OLED
#define OLED_LINES (OLED_HEIGHT / 8)
SSD1306AsciiWire oled;
@@ -74,11 +74,13 @@ bool activeState = false;
//
// USBvalve globals
//
#define VERSION "USBvalve - 0.10.0"
#define VERSION "USBvalve - 0.12.3"
boolean readme = false;
boolean autorun = false;
boolean written = false;
boolean written_reported = false;
boolean hid_sent = false;
boolean hid_reported = false;
// Anti-Detection settings.
//
@@ -221,6 +223,17 @@ void loop() {
written = false;
written_reported = true;
}
if (hid_sent == true && hid_reported == false) {
oled.print("\n[!!] HID Sending data");
hid_sent = false;
hid_reported = true;
}
if (BOOTSEL) {
oled.print("\n[+] RESETTING");
swreset();
}
}
// Main Core1 loop: managing USB Host
@@ -351,6 +364,13 @@ void hexDump(unsigned char* data, size_t size) {
SerialTinyUSB.println();
}
// Reset the Pico
void swreset()
{
watchdog_enable(1500, 1);
while(1);
}
//
// BADUSB detector section
//
@@ -381,6 +401,10 @@ void tuh_hid_mount_cb(uint8_t dev_addr, uint8_t instance, uint8_t const* desc_re
// Invoked when device with hid interface is un-mounted
void tuh_hid_umount_cb(uint8_t dev_addr, uint8_t instance) {
SerialTinyUSB.printf("HID device address = %d, instance = %d unmounted\r\n", dev_addr, instance);
// Reset HID sent flag
hid_sent = false;
hid_reported = false;
}
// Invoked when received report from device
@@ -389,8 +413,9 @@ void tuh_hid_report_received_cb(uint8_t dev_addr, uint8_t instance, uint8_t cons
static bool kbd_printed = false;
static bool mouse_printed = false;
oled.print("\n[!!] HID Sending data");
// Used in main loop to write output to OLED
hid_sent = true;
// Read the HID protocol
uint8_t const itf_protocol = tuh_hid_interface_protocol(dev_addr, instance);
@@ -533,4 +558,4 @@ void cursor_movement(int8_t x, int8_t y, int8_t wheel) {
SerialTinyUSB.printf("(%d %d %d)\r\n", x, y, wheel);
}
// END of BADUSB detector section
// END of BADUSB detector section

View File

@@ -1,5 +1,7 @@
/*
USBvalve
RAMDISK file written by Cesare Pizzi
*/
/*
@@ -607,7 +609,38 @@ DISK_LABEL, 0x08, 0x00, 0x00, 0xaf, 0x60,
},
{
//------------- Block 85: -------------//
0x00
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x35, 0xc3, 0x28, 0x56, 0xaa, 0x10, 0x9b, 0xd7, 0xd2, 0x75, 0x6e, 0xcf, 0x1e, 0x1e, 0x21, 0xaf,
0xcc, 0x52, 0x04, 0xe4, 0xc3, 0x7d, 0x3e, 0xee, 0xf7, 0xf1, 0x7d, 0xe0, 0x09, 0x95, 0x11, 0x6c,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
},
{
//------------- Block 86: -------------//

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB