hacktricks/network-services-pentesting/pentesting-modbus.md

89 lines
3.2 KiB
Markdown
Raw Normal View History

2023-06-06 18:56:34 +00:00
# Informação Básica
2022-04-28 16:01:33 +00:00
2023-06-06 18:56:34 +00:00
O Protocolo Modbus é uma estrutura de mensagens desenvolvida pela Modicon em 1979. É usado para estabelecer comunicação mestre-escravo/cliente-servidor entre dispositivos inteligentes.
2022-04-28 16:01:33 +00:00
2023-06-06 18:56:34 +00:00
**Porta padrão:** 502
```
PORT STATE SERVICE
502/tcp open modbus
```
# Enumeração
2022-04-28 16:01:33 +00:00
2023-06-06 18:56:34 +00:00
## Modbus TCP
2022-04-28 16:01:33 +00:00
2023-06-06 18:56:34 +00:00
### Nmap
2022-04-28 16:01:33 +00:00
2023-06-06 18:56:34 +00:00
```bash
nmap -sV --script modbus-discover <target>
```
2022-04-28 16:01:33 +00:00
2023-06-06 18:56:34 +00:00
### Modscan
2022-04-28 16:01:33 +00:00
2023-06-06 18:56:34 +00:00
Modscan is a tool that can be used to perform Modbus enumeration and exploitation.
2022-04-28 16:01:33 +00:00
2023-06-06 18:56:34 +00:00
```bash
modscan32.exe <target>
```
2022-04-28 16:01:33 +00:00
2023-06-06 18:56:34 +00:00
### mbtget
2022-04-28 16:01:33 +00:00
2023-06-06 18:56:34 +00:00
mbtget is a tool that can be used to read and write Modbus registers.
2022-04-28 16:01:33 +00:00
2023-06-06 18:56:34 +00:00
```bash
mbtget -a <target>
```
2023-06-06 18:56:34 +00:00
### Metasploit
2023-06-06 18:56:34 +00:00
Metasploit has a module that can be used to perform Modbus enumeration and exploitation.
2023-06-06 18:56:34 +00:00
```bash
use auxiliary/scanner/scada/modbusclient
```
2023-06-06 18:56:34 +00:00
### Other tools
Other tools that can be used for Modbus enumeration and exploitation include:
- [CAS Modbus Scanner](https://www.chipkin.com/products/software/modbus-software/cas-modbus-scanner/)
- [Simply Modbus](http://www.simplymodbus.ca/)
- [Modbus Poll](https://www.modbustools.com/modbus_poll.html)
## Modbus RTU
### mbtget
mbtget can also be used to read and write Modbus RTU registers.
```bash
mbtget -s /dev/ttyS0 -a <target>
```
2023-06-06 18:56:34 +00:00
### Other tools
2023-06-06 18:56:34 +00:00
Other tools that can be used for Modbus RTU enumeration and exploitation include:
- [CAS Modbus Scanner](https://www.chipkin.com/products/software/modbus-software/cas-modbus-scanner/)
- [Simply Modbus](http://www.simplymodbus.ca/)
- [Modbus Poll](https://www.modbustools.com/modbus_poll.html)
```bash
nmap --script modbus-discover -p 502 <IP>
msf> use auxiliary/scanner/scada/modbusdetect
msf> use auxiliary/scanner/scada/modbus_findunitid
```
2022-04-28 16:01:33 +00:00
<details>
2023-04-25 18:35:28 +00:00
<summary><a href="https://cloud.hacktricks.xyz/pentesting-cloud/pentesting-cloud-methodology"><strong>☁️ HackTricks Cloud ☁️</strong></a> -<a href="https://twitter.com/hacktricks_live"><strong>🐦 Twitter 🐦</strong></a> - <a href="https://www.twitch.tv/hacktricks_live/schedule"><strong>🎙️ Twitch 🎙️</strong></a> - <a href="https://www.youtube.com/@hacktricks_LIVE"><strong>🎥 Youtube 🎥</strong></a></summary>
2022-04-28 16:01:33 +00:00
2023-06-06 18:56:34 +00:00
- Você trabalha em uma **empresa de segurança cibernética**? Você quer ver sua **empresa anunciada no HackTricks**? ou você quer ter acesso à **última versão do PEASS ou baixar o HackTricks em PDF**? Confira os [**PLANOS DE ASSINATURA**](https://github.com/sponsors/carlospolop)!
2022-04-28 16:01:33 +00:00
2023-06-06 18:56:34 +00:00
- Descubra [**A Família PEASS**](https://opensea.io/collection/the-peass-family), nossa coleção exclusiva de [**NFTs**](https://opensea.io/collection/the-peass-family)
2022-04-28 16:01:33 +00:00
2023-06-06 18:56:34 +00:00
- Adquira o [**swag oficial do PEASS & HackTricks**](https://peass.creator-spring.com)
2022-04-28 16:01:33 +00:00
2023-06-06 18:56:34 +00:00
- **Junte-se ao** [**💬**](https://emojipedia.org/speech-balloon/) [**grupo do Discord**](https://discord.gg/hRep4RUj7f) ou ao [**grupo do telegram**](https://t.me/peass) ou **siga-me** no **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.**
2022-04-28 16:01:33 +00:00
2023-06-06 18:56:34 +00:00
- **Compartilhe seus truques de hacking enviando PRs para o [repositório hacktricks](https://github.com/carlospolop/hacktricks) e [hacktricks-cloud repo](https://github.com/carlospolop/hacktricks-cloud)**.
2022-04-28 16:01:33 +00:00
</details>