diff --git a/presentations/dry-run/dry-run.qmd b/presentations/dry-run/dry-run.qmd index 656b49bea16166ba6cbefb56a08f60d4ab4f533b..b63a5871aca614461b8d6349e5cf8875a14a8918 100644 --- a/presentations/dry-run/dry-run.qmd +++ b/presentations/dry-run/dry-run.qmd @@ -93,7 +93,7 @@ of a computer system **without being detected**"_ [^2] | \textcolor{teal}{User mode} | \textcolor{red}{Kernel mode} | |--------------- | --------------- | | `LD_PRELOAD` library hijacking | Syscall table _hooking_ | -| Patching de binaire \footnotesize (e.g. `su`, `passwd`) | Injection de modules/pilotes malicieux \footnotesize(GNU/Linux, Windows) | +| Binary patching \footnotesize (e.g. `su`, `passwd`) | Injection de modules/pilotes malicieux \footnotesize(GNU/Linux, Windows) | [^2]: [Oxford English Dictionary, s.v. "rootkit (n.)," December 2024](https://doi.org/10.1093/OED/6892331220) @@ -149,14 +149,37 @@ Est simplement chargé en tant que pilote Windows (`.sys`) [^4]: [Subverting Vista™ Kernel For Fun and Profit](https://media.kasperskycontenthub.com/wp-content/uploads/sites/43/2008/08/20084218/BH-US-06-Rutkowska.pdf) -## Cloudskulk +<!--HACK: à voir si je fais les deux ci-dessous--> -## CoVirt +<!--## Cloudskulk--> +<!----> +<!--## CoVirt--> -# Implémentation/_Reverse-Engineering_ +# _Reverse-Engineering_ + +## Hyperviseur sous forme de module noyau chargeable + +::: {.incremental} +- Concerne l'architecture x86 pour Intel VT-x +- Détection du CPU et de ses capacités pour la virtualisation (_support for VMX_) + - Appel à `cpuid` avec `eax = 1` (bit 5 de `ecx`) +- Vérification du _"feature control"_ MSR (_"model specific registers"_) pour +déterminer si la virtualisation n'a pas été désactivée depuis le BIOS. +- Initialisation de la région **VMXON** associée à une future VM +- Vérification des valeurs dans les registres de contrôle **CR0** et **CR4** +- Activation de **VMX** à travers le **bit 13** du registre **CR4** +- Exécution de l'instruction **`vmxon`** avec comme opérande l'adresse de la +région allouée et initialisée +::: ## Anatomie d'un _world-switch_ +- Chaque CPU possèdent une région **VMCS** (_"Virtual Machine Control Structure"_) +- Semblable en tout genre à la région **VMXON** +- Est utilisé pour sauvegarder l'état du CPU ou vCPU à chaque _world-switch_ + - VMEntry $\rightarrow$ état du CPU en mode \textcolor{red}{root} + - VMExit $\rightarrow$ état du CPU en mode \textcolor{teal}{non-root} + # Méthodes de détection ## _Timing analysis_