Skip to content

This program utilizes Excel macros and VBS to decrypt passwords saved on Google Chrome in a Windows machine. Este programa utiliza macros do Excel e VBS para descritografar senhas salvas no Google Chrome numa máquina Windows.

Notifications You must be signed in to change notification settings

joaopedrordepaiva/MacroExploit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MacroExploit

This program utilizes Excel macros and VBS to decrypt passwords saved on Google Chrome in a Windows machine. The software and code made available in this repository should not be utilized maliciously, but only for research and/or educational purposes.

Two ways for the Excel to decrypt passwords saved in Google Chrome were developed:

  1. PowerShell + Python 3

    Through this path, the VBS will save and execute a PowerShell script that grabs the key (decrypts it as well), users, urls and encypted passwords from Google Chrome. It will also save and exeucute a Python 3 script that uses the decrypted key to decrypt the passwords and write the output to a file. All files written by the Excel are saved in %temp% and are deleted automatically by the VBS. The execution of the scripts is obfuscated as follows:

    The Shell command in the VBS executes a cmd.exe command, which creates a variable containing a base64 encoded PowerShell command that runs the Powershell and Python 3 scripts and contains the -WindowStyle Hidden -ExecutionPolicy Bypass flags. Then, the cmd.exe command echoes that obfuscated PowerShell command and pipes it to PowerShell so that it will execute with no window and no policy restrictions, because of the flags described above.

    Normally those flags would lead Microsoft Office Security to mark the Excel file as containing malicious macros and not allow the user to open it. But the obfuscation of the command impedes Microsoft Office from recognizing those flags and, therefore, the user can open the Excel and have their computer infected.

  2. C++

    Through this path, the Excel file will save a base64 obfuscated version of the executable from Sheet2 to a file in the %tmp% path. Then, the VBS base64 decodes the executable with the "certutil" command. Finally, it executes the decoded file and imports the output (another file in %temp%) into Sheet1. Sheet2 and all files produced are deleted to cover tracks and because Windows Defender may eventually detect the executable written by the VBS as a threat and signal the user (even though files in %temp% are not usually scanned by Windows Defender).

    To compile the executable yourself, your machine will need OpenSSL intalled in the path: "C:\OpenSSL-x64". If OpenSSL is located in another path in your machine, just modify the "CompileAndExecute.bat" file accordingly. After running the "CompileAndExecute.bat" script, copy the contents of "bin\ExecutableInBase64.txt" to Sheet2 of the Excel. To paste, right-click the very first cell of the Excel, select "Paste Special" and mark the "As Text" option. This way, strings that start with "+" or "=" will not be enterred as formulas.

Este programa utiliza macros do Excel e VBS para descritografar senhas salvas no Google Chrome numa máquina Windows. O software e código disponibilizados neste repositório não devem ser utilizados de forma maliciosa, somente com propoósito educacional e/ou de pesquisa.

Foram desenvolvidas duas formas para o Excel descriptografar as senhas salvas no Google Chrome:

  1. PowerShell + Python 3

    No primeiro método o VBS salvará e executará um script PowerShell que busca a chave (também a descriptografa), usuários, urls e senhas criptografadas do Google Chrome. Ele também salvará e executará um script de Python 3 que usa a chave descriptografada para descriptografar as senhas e gravar a saída em um arquivo. Todos os arquivos gravados pelo Excel são salvos no diretório %temp% e excluídos automaticamente pelo VBS. A execução dos scripts é ofuscada da seguinte maneira:

    O comando Shell no script VBS executa um comando cmd.exe, que cria uma variável contendo um comando PowerShell codificado em base64 que executa os scripts Powershell e Python 3 e contém as flags -WindowStyle Hidden -ExecutionPolicy Bypass. Em seguida, o cmd.exe ecoa esse comando ofuscado do PowerShell e faz um pipe dele para o PowerShell para que seja executado sem janela e sem restrições de policy, devido às flags descritas anteriormente.

    Normalmente, essas flags levariam o Microsoft Office Security a marcar o arquivo do Excel como contendo macros maliciosas e não permitir que o usuário o abrisse. Mas a ofuscação do comando impede o Microsoft Office de reconhecer as flags e, portanto, o usuário pode abrir o Excel e ter seu computador infectado.

  2. C++

    No segundo método o arquivo Excel salvará uma versão ofuscada em base64 do executável gravado na Planilha2 em um arquivo no caminho %tmp%. Em seguida, o VBS decodifica o executável com o comando "certutil". Finalmente, ele executa o arquivo decodificado e importa a saída (outro arquivo em %temp%) para a Planilha1. A Planilha2 e todos os arquivos produzidos são excluídos para cobrir rastros e porque o Windows Defender pode eventualmente detectar o executável escrito pelo VBS como uma ameaça e sinalizar ao usuário.

    Para compilar o executável você mesmo, sua máquina precisará do OpenSSL instalado no caminho: "C:\OpenSSL-x64". Se o OpenSSL estiver localizado em outro caminho em sua máquina, apenas modifique o arquivo "CompileAndExecute.bat" de acordo. Depois de executar o script "CompileAndExecute.bat", copie o conteúdo de "bin\ExecutableInBase64.txt" para a Planilha2 do Excel. Para colar, clique com o botão direito na primeira célula do Excel, selecione "Paste special" e marque a opção "As text". Dessa forma, strings que começam com "+" ou "=" não serão interpretadas como fórmulas pelo Excel.

About

This program utilizes Excel macros and VBS to decrypt passwords saved on Google Chrome in a Windows machine. Este programa utiliza macros do Excel e VBS para descritografar senhas salvas no Google Chrome numa máquina Windows.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published