/Mini-WAF-Proof-Of-Concept

Proof of Concept created to show how Mini-WAF works and can avoid directly attacks to many servers.

Primary LanguageJavaScriptMIT LicenseMIT

Mini-WAF Proof of Concept

  • (Português) Prova de conceito criada para mostrar como o Mini-WAF funciona e consegue contornar ataques diretos a vários servidores.

  • (English) Proof of Concept created to show how Mini-WAF works and can avoid directly attacks to many servers.

> Reproduzindo o experimento do Firewall (Mini-WAF)

1.1 Requisitos de hardware

O ambiente de testes requer um computador com:

[+] 2 GB de memória RAM (ou mais);
[+] Processador i3 ou superior com no mínimo 2.4 GHz de frequência;
[+] Disco rígido ou SSD com espaço suficiente para executar uma imagem linux de 16 GB (para melhor desempenho recomenda-se 24GB);
[+] Acesso à conexão cabeada com a internet;
[+] Monitor, mouse e teclado para operar o sistema.

1.2 Requisitos de software

[+] Sistema operacional Windows 7 ou superior / Linux kernel 3.2 ou superior;
[+] Navegador com acesso a internet (de preferência Chrome, Chromium, Mozilla ou Opera);
[+] Oracle VM VirtualBox (https://www.virtualbox.org/wiki/Downloads)
[+] Utilitário de descompressão de arquivos zipados (WinRAR, 7Zip, por exemplo).

2.1 Como preparar o ambiente

Após certifica-se de que todos os requisitos de hardware e software foram atendidos, realize o download da imagem mais recente da máquina virtual contendo os aparatos para o experimento de segurança e importe-o em sua Oracle VM VirtualBox. O processo de importação da máquina Virtual pode ser feito da seguinte forma:

1 - Execute a Oracle VM VirtualBox

2 - Clique em "Importar Appliance..."

3 - Clique no botão imediatamente à direita da caixa de texto e selecione a imagem baixada anteriormente com a extensão ".ova".

4 - Concorde com a licença do Appliance e importe a máquina virtual

5 - Após a importação, a máquina virtual estará pronta para ser executada.

OBS: A senha do sistema é: sbseg2020

2.2 Como realizar os testes

Os testes são realizados na imagem pronta do ambiente de testes. Execute a máquina virtual e efetue o login no usuário sbseg2020 com a senha também sbseg2020. Após efetuar seu login, procure na área de trabalho pela pasta Proof Of Concept e siga as instruções do arquivo README (LEIA-ME) presente.

sudo su
chmod +x poc-setup.sh
./poc-setup.sh

Após o comando acima, aguarde até que o ambiente seja preparado. A linha de comando iniciará:

  • Apache
  • MySQL/MariaDB
  • DVWA
  • Minimalistic WAF

Além disso, o comando instalará na mesma pasta Proof Of Concept o SQLMAP na versão mais atual para fins de testes de injeção de SQL necessários em alguns módulos do DVWA.

Observe que o ambiente será acessível no localhost que é o proxy contendo o Mini-WAF para o verdadeiro DVWA que roda em localhost:8081.

A imagem acima ilustra o esquema de proteção implantado no DVWA onde o cliente acessa o localhost que é o proxy do Mini-WAF e o proxy redireciona e filtra conexões maliciosas para o servidor do DVWA na porta 8081.

3.1 Resultados obtidos

3.2 Resultados em ambiente real

1. Burlando a proteção da Cloudflare e obtendo o endereço de IP real do servidor (ferramenta CloudFail utilizada no processo).

2. Realizando uma conexão SSH com o servidor alvo de domínio particular e estabelecendo um túnel TCP entre as portas 5901 do servidor remoto e local para posterior uso do VNC.

3. De posse do endereço de IP real do servidor (191.240.183.32), iniciando uma simulação de injeção de SQL no parâmetro GET http://191.240.183.32?id= (ferramenta Sqlmap usada no processo).

4. Após o tunelamento SSH concluído nas portas 5901, conectando-se ao servidor VNC remoto e visualizando o Minimalistic WAF contendo mais de 90% dos ataques realizados e rejeitando as conexões de entrada com status HTTP 403.

Nessa etapa, foram usados payloads de level 1 e level 2, obtendo respectivamente os seguintes números de conexões bloqueadas:

Nível Requisições Não bloqueadas Bloqueadas
1 78 5 73
2 372 22 350

[+] Vídeo do experimento

4.1 Licença do projeto

O projeto está sendo mantido sob a licença MIT e pode ser encontrada aqui. Aceitamos contribuições de qualquer pessoa no projeto bem como sugestões e relatórios de bugs que também serão muito bem vindos.

4.2 Mantenedores do projeto

Esse projeto é mantido por Muryllo Pimenta de Oliveira - GitHub Profile, atualmente orientado pelo professor da Universidade de Pernambuco Carlo Marcelo Revoredo - GitHub Profile.

1.1 Hardware requirements

The test environment requires a computer with:

[+] 2 GB of RAM (or more);
[+] Processor i3 or higher with a minimum frequency of 2.4 GHz;
[+] Hard disk or SSD with enough space to run a 16 GB linux image (24 GB is recommended for best performance);
[+] Access to the wired internet connection;
[+] Monitor, mouse and keyboard to operate the system.

1.2 Software requirements

[+] Operating system Windows 7 or higher / Linux kernel 3.2 or higher;
[+] Browser with internet access (preferably Chrome, Chromium, Mozilla or Opera);
[+] Oracle VM VirtualBox (https://www.virtualbox.org/wiki/Downloads)
[+] Zip file decompression utility (WinRAR, 7Zip, for example).

2.1 How to prepare the environment

After making sure that all hardware and software requirements have been met, download the latest image of the virtual machine containing the devices for the security experiment and import it into your Oracle VM VirtualBox. The Virtual machine import process can be done as follows:

1 - Run the Oracle VM VirtualBox

2 - Click on "Importar Appliance..."

3 - Click the button immediately to the right of the text box and select the previously downloaded image with the extension ".ova".

4 - Agree to the Appliance license and import the virtual machine

5 - After import, the virtual machine will be ready to run

OBS: The password of the system is: sbseg2020

2.2 How to perform the tests

The tests are performed on the ready image of the test environment. Run the virtual machine and log in to the user sbseg2020 with the password also sbseg2020. After logging in, look on the desktop for the Proof Of Concept folder and follow the instructions in the README (LEIA-ME.txt) file present.

sudo su
chmod +x poc-setup.sh
./poc-setup.sh

After the above command, wait until the environment is prepared. The command line will start:

  • Apache
  • MySQL/MariaDB
  • DVWA
  • Minimalistic WAF

In addition, the command will install SQLMAP in the most current version in the same Proof Of Concept folder for the purpose of SQL injection testing required in some DVWA modules.

Note that the environment will be accessible on localhost which is the proxy containing the Mini-WAF for the real DVWA that runs on localhost:8081.

The image above illustrates the protection scheme implemented in DVWA where the client accesses the localhost which is the Mini-WAF proxy and the proxy redirects and filters malicious connections to the DVWA server on port 8081.

3.2 Results in real environment

1. Bypassing the protection of Cloudflare and obtaining the real IP address of the server (tool CloudFail used in the process).

2. Making an SSH connection with the target server of private domain and establishing a TCP tunnel between ports 5901 of the remote and local server for later use of VNC.

3. With the real IP address of the server (191.240.183.32), starting a SQL injection simulation in the GET parameter http://191.240.183.32?id= (tool Sqlmap used in the process).

4. After the SSH tunneling completed on ports 5901, connecting to the remote VNC server and viewing the Minimalistic WAF containing over 90% of the attacks carried out and rejecting incoming connections with HTTP 403 status.

In this step, level 1 and level 2 payloads were used, obtaining respectively the following numbers of blocked connections:

Level Requests Non-blocked Blocked
1 78 5 73
2 372 22 350

[+] Video of experiment

4.1 License of project

The project is being maintained under the MIT license and can be found [here] (https://github.com/MurylloEx/Mini-WAF). We accept contributions from anyone on the project as well as suggestions and bug reports that are also very welcome.

4.2 Maintainers of project

This project is maintained by Muryllo Pimenta de Oliveira - GitHub Profile, currently supervised by professor at the University of Pernambuco Carlo Marcelo Revoredo - GitHub Profile.