Skip to content
KitploitKITPLOIT
StrumentiBlog
Invia
StrumentiBlog
Invia

Strumenti di Hacking, PenTest e Cybersecurity per il tuo Arsenale di Sicurezza!

Kitploit è una directory di strumenti di hacking, cybersecurity e pentesting. Scopri gli ultimi aggiornamenti dei progetti per trovare vulnerabilità, analizzare sistemi, automatizzare i test e rafforzare la tua sicurezza.

··Feed·Contatto·Privacy·© 2026 Kitploit

Directory degli strumenti

Categorie

Vedi tutte le categorie
Loading categories
CVE-2022-42046 — CVE-2022-42046 Prova di concetto dell'elevazione locale dei privilegi di wfshbr64.sys tramite DKOM | Kitploit
Strumenti/GitHubGitHub/kkent030315/cve-2022-42046
Escalation di PrivilegiAnalisi delle VulnerabilitàExploitBinary Exploitation
GitHubkkent030315/cve-2022-42046

CVE-2022-42046

CVE-2022-42046 Prova di concetto dell'elevazione locale dei privilegi di wfshbr64.sys tramite DKOM

Vedi Repository
161263 anni faRevisionato da Kitploit

Più Popolari

Vedi tutti →

Scopri gli strumenti più utilizzati dalla nostra community.

Esplora tutti gli strumenti

Sfoglia la nostra collezione di strumenti

Vedi tutti gli strumenti →
Condividi

EvilWfshbr

CVE-2022-42046 Proof of Concept di elevazione locale dei privilegi di wfshbr64.sys

Il payload appositamente creato di wfshbr64.sys e wfshbr32.sys consente a un utente arbitrario di eseguire operazioni bitwise con offset EPROCESS arbitrari e valori di flag per elevare deliberatamente il processo di gioco alla protezione CodeGen Full manipolando i flag EPROCESS.Protection e EPROCESS.SignatureLevel (buco di sicurezza come funzionalità).

Il driver è firmato da Microsoft Hardware Compatibility Publisher, presentato tramite il Microsoft Hardware Program.

Questo progetto è stato oggetto di una ricerca congiunta con @DoranekoSystems

È disponibile una ricca versione CLI in Rust qui

  • https://www.virustotal.com/gui/file/b8807e365be2813b7eccd2e4c49afb0d1e131086715638b7a6307cd7d7e9556c
  • https://www.virustotal.com/gui/file/89698cad598a56f9e45efffd15d1841e494a2409cc12279150a03842cd6bb7f3

Licenza

MIT. Vedi LICENSE

Suggerimento (per sviluppatori)

  1. Usa ObRegisterCallbacks invece di elevare con la forza la protezione del processo eseguendo una manipolazione diretta degli oggetti del kernel. C'è un buon esempio qui.

2. IRP

Non fare riferimento all'IRP dopo il completamento. Se hai il driver verifier abilitato verrai scoperto.

root@kitploit:~
IofCompleteRequest(Irp, IO_NO_INCREMENT); // IRP is freed here
return Irp->IoStatus.Status;

Dovresti invece usare una variabile locale.

root@kitploit:~
NTSTATUS status = STATUS_SUCCESS;
Irp->IoStatus.Status = status;
IofCompleteRequest(Irp, IO_NO_INCREMENT); // IRP is freed here
return status;

3. Contesto del processo

Sembra che tu stia verificando un puntatore nullo rispetto al valore restituito da IoGetCurrentProcess, ma per progettazione non restituisce mai un puntatore nullo, quindi non devi controllarlo.

root@kitploit:~
PEPROCESS CurrentProcess = IoGetCurrentProcess();
  if ( !CurrentProcess ) // no need to check for null pointer
    break;

Il trucco

Qualche tempo dopo il report, lo sviluppatore ha implementato una subdola "verifica aggiuntiva" per sconfiggere la nostra prima PoC invece di rinunciare a trasformare i buchi di sicurezza in una funzionalità.

Controlli aggiunti a:

  • IOCTL_WFSHBR_REMOVE_FLAG
  • IOCTL_WFSHBR_ADD_FLAG
  • IOCTL_WFSHBR_AND_FLAG
root@kitploit:~
case IOCTL_WFSHBR_ADD_FLAG: // 0xAA013884
      if ( !KwfsVerifyCaller(Buffer) ) // verify caller
        break;
-     if ( Buffer->ArbitraryEProcessOffset >= 0x1000 ) // offset limitation check
+     if ( !KwfsVerifyOffsetAndFlags(Buffer->ArbitraryEProcessOffset,
+                                    Buffer->DesiredFlags) ) // verify the offset and flags
        break;
      *(ULONG*)(IoGetCurrentProcess() + Buffer->ArbitraryEProcessOffset) |= Buffer->DesiredFlags;

KwfsVerifyOffsetAndFlags

Questa routine è progettata per essere chiamata ogni volta che il client richiede una modifica dell'EPROCESS ed esegue la verifica dell'Offset fornito dal campo ArbitraryEProcessOffset in questa PoC ― e anche dei Flags forniti dal campo DesiredFlags in questa PoC.

La verifica è piuttosto semplice: conta i bit 1 in ogni campo di bit dei flag forniti e se il conteggio è maggiore di otto fallisce.

La mappa dei possibili pattern di flag è solo quattro:

  • 22 00 00 00
  • 00 22 00 00
  • 00 00 22 00
  • 00 00 00 22

Detto questo, eseguire le seguenti operazioni 4 volte può garantire che almeno uno dei tentativi abbia successo:

  • Sottrarre il campo ArbitraryEProcessOffset per indice: offset - index,
  • E regolare i bit nel campo DesiredFlags per indice: flag << (index * 8).

L'offset viene decrementato, quindi la regolazione del campo di bit farebbe sì che l'offset si adatti negli operatori bitwise.

root@kitploit:~
*(ULONG*)(IoGetCurrentProcess() + offset) |= flags;
*(ULONG*)(IoGetCurrentProcess() + offset) &= ~flags;

Abbiamo aggiunto le funzioni WfsProtectProcessSupreme e WfsUnprotectProcessSupreme, che eseguono il tentativo e hanno sconfitto il nuovo trucco.

root@kitploit:~
enum KwfsState {
  KwfsStateOnceCall = 0,
  KwfsStateNeedsValueEquality = 1,
  KwfsStateValueHasBeenSet = 2,
};

bool KwfsVerifyOffsetAndFlags(_In_ ULONG offset, _In_ ULONG offset flags)
{
  if (KwfsState::KwfsState == KwfsState::KwfsStateOnceCall) {
    g_KwfsVerifyState = KwfsState::KwfsStateValueHasBeenSet;
    g_KwfsVerifyStateOffset = offset;
    g_KwfsVerifyStateFlags = flags;
    if (offset < 0x1000) { // offset limitation check moved here
      auto bitcount = 0;
      for (auto i = 0; i < 32; ++i) { // count `1` bits in flags
        if (flags & (1 << i)) {
          ++bitcount;
        }
      }
      if (bitcount <= 8) { // count must less than nine
        g_KwfsVerifyState = 1;
        return true;
      }
    }
  }
  else
  {
    if (g_KwfsVerifyState != KwfsState::KwfsStateValueHasBeenSet
     || offset != g_KwfsVerifyStateOffset
     || flags != g_KwfsVerifyStateFlags) {
      return false;
    }
  }
  return false;
}
Scarica lo strumento