2021-05-25 22:52:07 +00:00
# 1080 - Pentesting Socks
2021-05-14 00:08:24 +00:00
## Basic Information
2021-05-25 22:52:07 +00:00
SOCKS is an Internet protocol that exchanges network packets between a client and server through a proxy server. SOCKS5 optionally provides authentication,
2021-05-14 00:08:24 +00:00
so only authorized users may access a server.
2021-05-25 22:52:07 +00:00
Practically, a SOCKS server proxies TCP connections to an arbitrary IP address, and provides a means for UDP packets to be forwarded.
SOCKS performs at Layer 5 of the OSI model
2021-05-14 00:08:24 +00:00
**Default Port:** 1080
## Enumeration
### Authentication Check
```bash
nmap -p 1080 < ip > --script socks-auth-info
```
2021-05-25 22:52:07 +00:00
### Brute Force
#### Basic usage
2021-05-14 00:08:24 +00:00
```bash
nmap --script socks-brute -p 1080 < ip >
```
2021-05-25 22:52:07 +00:00
#### Advanced usage
2021-05-14 00:08:24 +00:00
```bash
nmap --script socks-brute --script-args userdb=users.txt,passdb=rockyou.txt,unpwdb.timelimit=30m -p 1080 < ip >
```
2021-05-25 22:52:07 +00:00
#### Output
2021-05-14 00:14:06 +00:00
2021-05-25 22:52:07 +00:00
```text
2021-05-14 00:14:06 +00:00
PORT STATE SERVICE
1080/tcp open socks
| socks-brute:
| Accounts
| patrik:12345 - Valid credentials
| Statistics
|_ Performed 1921 guesses in 6 seconds, average tps: 320
```
2021-05-14 00:08:24 +00:00
## Tunneling and Port Forwarding
### Basic proxychains usage
Setup proxy chains to use socks proxy
2021-05-25 22:52:07 +00:00
```text
2021-05-14 00:08:24 +00:00
nano /etc/proxychains4.conf
```
Edit the bottom and add your proxy
2021-05-25 22:52:07 +00:00
```text
2021-05-14 00:08:24 +00:00
socks5 10.10.10.10 1080
```
With auth
2021-05-25 22:52:07 +00:00
```text
2021-05-14 00:08:24 +00:00
socks5 10.10.10.10 1080 username password
```
2021-05-25 22:52:07 +00:00
#### More info: [Tunneling and Port Forwarding](../tunneling-and-port-forwarding.md)