[Security][riscv64] Guest-to-Hypervisor Escape via Incorrect G-stage MemoryRegion Splitting
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 12/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- rust
- Ambito
- operating-systems, security
Direzione di ricerca
Start in src/device/iommu/riscv_iommu/viommu.rs at VirtualIommuInner::handle_ddt1lvl_mode() and compare how it builds subregions with MemoryRegion::new_with_offset_mapper() against the original G-stage mapping. Because this is a reported guest-to-hypervisor escape, do not work on it publicly; the reporter asks for private disclosure, so route any patch through the maintainers. Done means the split preserves the original GPA-to-HPA offset and the error and TLB paths are checked.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I found a potential VM escape vulnerability in the RISC-V vIOMMU implementation of hvisor v0.6.
Affected Code
src/device/iommu/riscv_iommu/viommu.rs
Function: VirtualIommuInner::handle_ddt1lvl_mode()
Root Cause
When a guest configures the vIOMMU DDTP register to use the one-level DDT mode, hvisor removes the DDT page from the original G-stage mapping and splits the corresponding MemoryRegion into two subregions.
However, both subregions are created using MemoryRegion::new_with_offset_mapper() with the guest physical address as the host physical address.
For example, the original mapping is:
HPA = GPA + OFFSET
After the split, the new mapping incorrectly becomes:
HPA = GPA
This breaks the original GPA-to-HPA mapping and may expose Hypervisor physical memory to the guest.
Impact
A malicious guest can trigger this issue by writing a crafted DDTP value to the virtual IOMMU.
We reproduced the vulnerability in a QEMU-based RISC-V environment. The guest can access and modify Hypervisor memory, including executable code. By triggering the modified code through an SBI ecall, we successfully demonstrated code execution in HS-mode.
This is a guest-to-Hypervisor escape, rather than merely a guest crash or an in-guest privilege escalation.
Suggested Fix
The subregions should preserve the original memory mapper instead of reconstructing the mapping using GPA as HPA.
A possible solution is to introduce a MemoryRegion::subregion() method that retains the original mapper when splitting a region.
It would also be worth checking the error handling and G-stage TLB invalidation paths to ensure that failed mapping operations cannot leave inconsistent memory mappings.
Reproduction and Disclosure
I have a working PoC and QEMU validation logs demonstrating the issue, including Hypervisor memory modification and HS-mode code execution.
I can share the complete reproduction package and a proposed fix with the maintainers through a private channel.
Could you please confirm whether this is a known issue and advise on the preferred vulnerability disclosure process?
Thanks for maintaining hvisor.
- Lingua principale
- Rust
- Stelle
- 209
- Fork
- 62
- Merge medio
- 1g 21h
- PR unite (30g)
- 20
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di syswonder/hvisor
-
aarch64 good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
bug ci enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
syswonder/hvisor#459 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
aarch64 enhancement loongarch64 riscv64 x86_64
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
I maintainer di solito rispondono entro 1 giorno
-
aarch64 bug documentation
Difficoltà 3/5 1-2 giorni Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
aarch64 bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di syswonder/hvisor
Issue simili
-
[Bug] 查看密码Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
AnalyseDeCircuit/oxideterm#889 ·
I maintainer di solito rispondono entro 1 giorno
-
marketing
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 69/100
haowjy/mars-agents#519 ·
I maintainer di solito rispondono entro 1 giorno
-
bug impeccable priority: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
nledford/Ladderback#1897 ·
I maintainer di solito rispondono entro 1 giorno
-
agent:linux priority:high
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
fa0311/better-tokuly#1204 ·
I maintainer di solito rispondono entro 1 giorno