[Walkthrough] Blue - TryHackMe
0
0

[Walkthrough] Blue - TryHackMe

Resolução do Walkthrough Blue da TryHackMe.

Nathalia Peres
6 min
0
0

Walkthrough

Email image

Resumo

  • IP alvo: 10.10.46.220 (o ip pode mudar de acordo com a máquina).
  • Escopo: Eternal Blue.

Diferente de um CTF, esse desafio trata-se na verdade de um Walkthrough, um passo a passo de como encontrar e explorar uma vulnerabilidade conhecida como o Eternal Blue. Eu particularmente não conhecia essa vulnerabilidade, então pude aprender bastante com esse passo a passo, visto que também pesquisei sobre o assunto para aprofundar ainda mais o conhecimento.

O EternalBlue é uma vulnerabilidade que atinge máquinas com o sistema operacional Windows onde o mesmo possui versões desatualizadas do serviço de compartilhamento de arquivos (SMB v1). O CVE dessa vulnerabilidade é CVE-2017-0144

Email image

Em uma pesquisa rápida no Shodan, um site muito utilizado para reconhecimento e analise de possíveis alvos, procurei por máquinas que ainda utilizassem Windows 2008 no protocolo SMB v.1, eis o resultado. Obviamente, essas máquinas podem até estar com o patch de correção aplicados, ainda assim, no meu ponto de vista nem deveriam mais estar utilizando Windows Server 2008.

Email image

Tentei buscar por vulnerabilidade, mas o shodan não permite esse tipo de pesquisa para quem não é “pagante”

Email image

Questões

Scan the machine. (If you are unsure how to tackle this, I recommend checking out the Nmap room)

Nenhuma resposta é necessária

How many ports are open with a port number under 1000?

3

nmap -sV -p0-1000 10.10.46.220
Email image

What is this machine vulnerable to? (Answer in the form of: ms??-???, ex: ms08-067)

ms17-010

nmap -sV --script vuln -p135,139,445 10.10.46.220
Email image

Start Metasploit

Nenhuma resposta é necessária

Find the exploitation code we will run against the machine. What is the full path of the code? (Ex: exploit/……..)

exploit/windows/smb/ms17_010_eternalblue

Para descobrir o caminho correto, apenas fiz uma pesquisa no Metasploit

Email image

Show options and set the one required value. What is the name of this value? (All caps for submission)

RHOSTS

Antes de verificar as opções é necessário utilizar o comando ‘use + caminho’ para definitivamente utilizar o exploit. Posteriormente, o comando ‘show options’ mostrará as opções que devem ou podem ser preenchidas. Nesse caso, apenas o RHOSTS era obrigatório e não tinha nenhum valor atribuído.

Email image

O RHOSTS nada mais é do que um parametro que deverá receber o valor (IP) da maquina alvo

Email image

With that done, run the exploit!

Nenhuma resposta é necessária, apenas executar o comando. Como a máquina é vulnerável, aparentemente um Windows 7, ao final da execução é retornado um shell

Email image

Confirm that the exploit has run correctly. You may have to press enter for the DOS shell to appear. Background this shell (CTRL + Z). If this failed, you may have to reboot the target VM. Try running it again before a reboot of the target.

Esse passo ele pede para digitar CTRL+Z apenas para colocar o shell obtido em segundo plano.

If you haven’t already, background the previously gained shell (CTRL + Z). Research online how to convert a shell to meterpreter shell in metasploit. What is the name of the post module we will use? (Exact path, similar to the exploit we previously selected)

Nenhuma resposta é necessária, apenas procurei pelo módulo solicitado. Como o shell entregue é um pouco limitado, os próximos passos serão para alterar o shell.

Email image

Select this (use MODULE_PATH). Show options, what option are we required to change?

SESSION

O parâmetro obrigatório nesse módulo é o SESSION pois esse precisa saber em qual sessão já aberta o mesmo será executado.

Email image

Set the required option, you may need to list all of the sessions to find your target here.

Nenhuma resposta é necessária, apenas listar as sessões já abertas, que no caso seria a conexão aberta pelo exploit do Eternalblue na máquina vulnerável.

Email image

Run! If this doesn’t work, try completing the exploit from the previous task once more.

Nenhuma resposta é necessária, porém antes de executar o comando é necessário definir o parâmetro SESSION, ou seja, em qual sessão aberta o módulo vai executar.

Email image

Após executar

Email image

Once the meterpreter shell conversion completes, select that session for use.

Nenhuma resposta é necessária, apenas acessar o shell

Email image

Verify that we have escalated to NT AUTHORITY\SYSTEM. Run getsystem to confirm this. Feel free to open a dos shell via the command ‘shell’ and run ‘whoami’. This should return that we are indeed system. Background this shell afterwards and select our meterpreter session for usage again.

Nenhuma resposta é necessária, apenas verificar o usuário que está executando os comandos

Email image

List all of the processes running via the ‘ps’ command. Just because we are system doesn’t mean our process is. Find a process towards the bottom of this list that is running at NT AUTHORITY\SYSTEM and write down the process id (far left column)

Nenhuma resposta é necessária, porém, para listar os processos é só rodar o comando ‘ps’

Email image

Migrate to this process using the ‘migrate PROCESS_ID’ command where the process id is the one you just wrote down in the previous step. This may take several attempts, migrating processes is not very stable. If this fails, you may need to re-run the conversion process or reboot the machine and start once again. If this happens, try a different process next time.

Nenhuma resposta é necessária, apenas migrar de um processo para outro

Email image

Within our elevated meterpreter shell, run the command ‘hashdump’. This will dump all of the passwords on the machine as long as we have the correct privileges to do so. What is the name of the non-default user?

Email image

Copy this password hash to a file and research how to crack it. What is the cracked password?

alqfna22

Eu tentei decodificar colocando o resultado do hashdump em um arquivo para que a ferramenta JohnTheRipper pudesse, através de uma wordlist, encontrar a senha, porém o resultado não foi o esperado. Em pesquisas, encontrei o site Crackstation. Em tentativas, descobri também que é necessário apenas parte do hash para decodificação

Email image

Flag1? This flag can be found at the system root.

flag{access_the_machine}

Como o sistema operacional é Windows, osystem rootseria o C:, assim como para Linux seria /. Naveguei até o diretório e encontrei o arquivo e posteriormente a flag

Email image

Flag2? This flag can be found at the location where passwords are stored within Windows

flag{sam_database_elevated_access}

Em pesquisa rápida, descobri que o local onde as senhas são salvas é em C:\Windows\System32\config. Sendo assim, naveguei até ele e encontrei a flag

Email image

flag3? This flag can be found in an excellent location to loot. After all, Administrators usually have pretty interesting things saved.

Como a dica não ficou muito clara pra mim, decidi por procurar o arquivo. Acredito que qualquer um dos caminhos encontrados acarretaria na mesma flag

Email image

Naveguei até C:\Users\Jon\Documentse encontrei a flag

Email image

Links

https://tryhackme.com/room/bluehttps://infosecwriteups.com/metasploit-upgrade-normal-shell-to-meterpreter-shell-2f09be895646

https://www.cve.org/CVERecord?id=CVE-2017-0144