vendor:
Socat
by:
hieubl from HPT Cyber Security
7.8
CVSS
HIGH
Heap-Based Overflow
190
CWE
Product Name: Socat
Affected Version From: 1.7.3.4
Affected Version To: 1.7.3.4
Patch Exists: NO
Related CWE: N/A
CPE: a:dest-unreach:socat
Metasploit:
N/A
Other Scripts:
N/A
Platforms Tested: Ubuntu 16.04.6 LTS
2020
Socat 1.7.3.4 – Heap Based Overflow (PoC)
The source code of socat.c contains _socat() function which has the Integer Overflow vulnerability. After that, the the line of code 'if ((bytes2 = xiotransfer(sock2, sock1, &buff, socat_opts.bufsiz, true)) < 0) {' calls the xiotransfer() function. The xiotransfer() function calls xioread() function. Finally xioread() function calls Read() function. In addition, the 'Makefile' file does not turn on the Position Independent Executables (PIE) mitigation (the CFLAGS does not contains '-pie' flag). By default, Ubuntu 16.04 does not turn on this mitigation. Consequently, it is easier to exploit the program, may even lead to Remode Code Execution (RCE).
Mitigation:
Turn on Position Independent Executables (PIE) mitigation by adding '-pie' flag in CFLAGS.