1080 - Pentesting Socks

1080 - Pentesting Socks

htARTE (HackTricks AWS Red Team Expert)를 통해 AWS 해킹을 처음부터 전문가까지 배워보세요!

HackTricks를 지원하는 다른 방법:

기본 정보

SOCKS는 클라이언트와 서버 간에 프록시를 통해 데이터를 전송하는 데 사용되는 프로토콜입니다. 다섯 번째 버전인 SOCKS5는 선택적 인증 기능을 추가하여 인증된 사용자만 서버에 액세스할 수 있도록 합니다. 이 프로토콜은 주로 TCP 연결의 프록시 및 UDP 패킷의 전달을 처리하며 OSI 모델의 세션 계층 (레이어 5)에서 작동합니다.

기본 포트: 1080

열거

인증 확인

nmap -p 1080 <ip> --script socks-auth-info

브루트 포스

기본 사용법

nmap --script socks-brute -p 1080 <ip>

고급 사용법

Socks Proxy

A SOCKS proxy is a protocol that allows a client to establish a TCP connection through a proxy server. It can be used to bypass firewalls and access restricted networks. In a pentesting scenario, SOCKS proxies can be useful for hiding the attacker's IP address and maintaining anonymity.

소켓 프록시

SOCKS 프록시는 클라이언트가 프록시 서버를 통해 TCP 연결을 설정할 수 있는 프로토콜입니다. 방화벽을 우회하고 제한된 네트워크에 접근하는 데 사용될 수 있습니다. 펜테스팅 시나리오에서 SOCKS 프록시는 공격자의 IP 주소를 숨기고 익명성을 유지하는 데 유용할 수 있습니다.

Dynamic Port Forwarding

Dynamic port forwarding is a technique that allows a client to create a secure tunnel between their local machine and a remote server. This can be useful for accessing resources on a remote network that are not directly accessible. In a pentesting context, dynamic port forwarding can be used to bypass network restrictions and gain access to internal systems.

동적 포트 포워딩

동적 포트 포워딩은 클라이언트가 로컬 머신과 원격 서버 사이에 안전한 터널을 생성할 수 있는 기술입니다. 이는 직접 접근할 수 없는 원격 네트워크의 리소스에 접근하는 데 유용할 수 있습니다. 펜테스팅 환경에서 동적 포트 포워딩은 네트워크 제한을 우회하고 내부 시스템에 액세스하는 데 사용될 수 있습니다.

Proxychains

Proxychains is a tool that allows applications to use proxy servers for network connections. It can be used to redirect network traffic through multiple proxies, providing an additional layer of anonymity. In a pentesting scenario, Proxychains can be used to hide the attacker's IP address and route traffic through different servers to avoid detection.

Proxychains

Proxychains는 응용 프로그램이 네트워크 연결에 프록시 서버를 사용할 수 있도록 하는 도구입니다. 이를 사용하여 네트워크 트래픽을 여러 프록시를 통해 리디렉션하여 추가적인 익명성을 제공할 수 있습니다. 펜테스팅 시나리오에서 Proxychains는 공격자의 IP 주소를 숨기고 감지를 피하기 위해 트래픽을 다른 서버를 통해 라우팅하는 데 사용될 수 있습니다.

nmap  --script socks-brute --script-args userdb=users.txt,passdb=rockyou.txt,unpwdb.timelimit=30m -p 1080 <ip>

Pentesting SOCKS

Introduction

SOCKS (Socket Secure) is a protocol that allows a client to establish a connection through a proxy server. It is commonly used for bypassing network restrictions and anonymizing internet traffic. In this section, we will explore various techniques for pentesting SOCKS servers.

Enumeration

Version Detection

To determine the version of the SOCKS server, we can send a SOCKS5 handshake request and analyze the response. The server will reply with its supported version and authentication methods.

$ nc -v <target_ip> <target_port>
> 05 01 00
< 05 00

In the above example, the server responded with 05 00, indicating that it supports SOCKS5 and does not require authentication.

User Enumeration

Some SOCKS servers may require authentication. To enumerate valid usernames, we can use a brute-force approach. By sending a SOCKS5 handshake request with different usernames, we can analyze the server's response to determine if the username is valid.

$ nc -v <target_ip> <target_port>
> 05 01 00 02 00 00 00 00 00 00
< 05 02

In the above example, the server responded with 05 02, indicating that it requires authentication. We can continue sending handshake requests with different usernames to determine valid ones.

Exploitation

Proxy Chaining

One technique for exploiting a SOCKS server is proxy chaining. By chaining multiple SOCKS servers together, we can create a chain of proxies that can be used for various purposes, such as bypassing network restrictions or hiding the source of an attack.

To set up proxy chaining, we need to configure each SOCKS server to forward traffic to the next server in the chain. This can be done by modifying the server's configuration file or using a tool like proxychains.

$ proxychains <command>

In the above example, <command> represents the command or tool that we want to run through the proxy chain.

Traffic Analysis

Another technique for exploiting a SOCKS server is traffic analysis. By analyzing the traffic passing through the server, we can gather valuable information about the network and potentially identify vulnerabilities or sensitive data.

To perform traffic analysis, we can use tools like Wireshark to capture and analyze network packets. By filtering the captured packets based on the SOCKS server's IP address and port, we can focus on the relevant traffic.

Conclusion

Pentesting SOCKS servers can provide valuable insights into network security and help identify potential vulnerabilities. By understanding the enumeration and exploitation techniques discussed in this section, pentesters can effectively assess the security of SOCKS servers.

PORT     STATE SERVICE
1080/tcp open  socks
| socks-brute:
|   Accounts
|     patrik:12345 - Valid credentials
|   Statistics
|_    Performed 1921 guesses in 6 seconds, average tps: 320

터널링과 포트 포워딩

기본적인 proxychains 사용법

socks 프록시를 사용하기 위해 proxy chains를 설정합니다.

nano /etc/proxychains4.conf

다음은 SOCKS 프록시에 대한 펜테스팅 기술에 관한 내용입니다. 아래 내용은 /hive/hacktricks/network-services-pentesting/1080-pentesting-socks.md 파일에서 가져온 것입니다. 관련된 영어 텍스트를 한국어로 번역하고, 번역된 내용을 동일한 마크다운 및 HTML 구문으로 유지하여 반환하세요. 코드, 해킹 기술 이름, 해킹 관련 용어, 클라우드/SaaS 플랫폼 이름(예: Workspace, aws, gcp...) 및 'leak'이라는 단어, 펜테스팅, 마크다운 태그와 같은 내용은 번역하지 마세요. 또한 번역 및 마크다운 구문 이외의 추가 내용은 추가하지 마세요.

socks5 10.10.10.10 1080

인증이 있는 경우

socks5 10.10.10.10 1080 username password

자세한 정보: 터널링과 포트 포워딩

htARTE (HackTricks AWS Red Team Expert)를 통해 AWS 해킹을 처음부터 전문가까지 배워보세요!

HackTricks를 지원하는 다른 방법:

Last updated